[semi-solved]how to add element to a.gainHP(value)?


Jul 4, 2015
Reaction score
Primarily Uses
I'm trying create "Burn" state which says:

"Increase Fire elemental damage(x3), at the end of each turn infected battler recive damage depends of its weakness on fire."
How can i get it, how add element Id to target value damage or damage formula?

Or simply how to make "target.gainHp(-value);" fire damage?

I have for now:

<Custom Regenerate Effect>
//this.item().damage.elementId = 2;

//if (user.elementRate(2) > 0 && !user.isDead()) {
// need add elemental ID to damage formula
// value = user.atk * user.elementRate(2);
user.gainHp(-user.atk * user.elementRate(2));

</Custom Regenerate Effect>

(using Yanfly Buffs&States along with Yanfly Elemental Script.)

But it didn't work. Always recive same number even if i put various Traits(Element Rate: Fire*x) and/or notetags from Yanfly Elemental Script.

Edit:  Same damage values was caused by another state with notetag:

<Force Element Fire Rate: 300%>

Looks like my problem with damage formula is solved, but if anyone knows other ways to making it elemental damage please write it, because it may be useful in the future.

Sorry for bad english, and thanks.
Last edited by a moderator:


May 31, 2013
Reaction score
First Language
Primarily Uses
Try this first as per your description you need 3x damage if fire based. so you need a react effect tag. Basically it checks if the skill uses the element id you assigned an if so multiply by 3.

Next the damage tick with the regenerate tag. Now this block cannot access the enemy stats as far as I know. You have user.atk for the damage so that mean your using the afflicted characters own attack as the base damage. I kinda don't care for that so ill offer an alternative but you can use whatever you like.

I use 1% of the targets total hp as a base then add an additionally value based on the afflicted chars level. Next multiply the flat value by fire resist, then multiply by -1 to make it negative for the gainHP effect. Lastly, round the number to flat value and a burn state is finished.

<Custom React Effect>

if (this.item().damage.elementId == 2) {

value = Math.floor(value * 3);


<Custom React Effect>

<Custom Regenerate Effect>

var value = user.mhp * 0.01 + user.level * 1.75; 

value = Math.floor(user.element.Rate(2) * value * -1);


</Custom Regenerate Effect>

Hope this helps.

**Note** Remove user.level * 1.75 in the regen effect if not using enemy levels by YF or it may not work or crash.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

// Looks at Elfkisser, realizes he'd have to either install Windows 10 or compile it for Linux
// Didn't install Elfkisser.
Too much effort for a curiosity. :popcorn:
I was just high-fiving myself for all I've learnt in the engine, and how far I've come, only to forget to remove the Immortal state from a semi-scripted battle. Now the enemy never dies and I feel so smart >.>
Playtest your stuff. Always playtest.
just spent FOREVER troubleshooting an issue with my keyboard... turns out the cord was just loose OTL
I count on someone one time, I let them promise something to me, and one week later it's complete silence as I'm completely let down. I hate everything.

Forum statistics

Latest member