[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

Yay! Got 3 new frying pans, its weird, but I'm so happy about it.
Yelp. I've discovered that I am one of those people who should not be drinking coffee. Took me a week detoxing off of coffee and switching to tea to realize how badly it was affecting me- and I've been drinking the stuff for years. Yikes!
I bought a gaiter with Meijer printed on it.

I'm still a Walmart worker, and I wore it today for work.
Trying out new carpet autotiles and I can't decide if it's working or not. Pixeling soft carpets is hard
It seems like this is going to be another remote semester. RIP.

Forum statistics

Latest member