Temporary buff MaxHp (Yanfly Buffs & States Core)

Hello,

I want to do a skill which gives a status buff to the Max Hp TEMPORARILY, and at the end of the status turns the hp returns to normal.

Example: Erick HP/Max HP: 1000/1000 after status buff (+500) it becomes Erick HP/Max HP: 1000/1500, at the end of the effect return Erick HP/Max HP: 1000/1000.
Example in middle battle: Erick HP/Max HP: 350/1000 after status buff (+500) it becomes Erick HP/Max HP: 850/1500, at the end of the effect return Erick HP/Max HP: 350/1000.

I know, I can do it with the basic engine of RPG MAKER, but I can ONLY increase the maximum number of HP and don't give a TEMPORARY buff to Max Hp.


An perfect example of skill: https://wiki.guildwars.com/wiki/Endure_Pain

No one knows how the script could be with Yanfly Buffs & States Core?
Any suggestions are welcome!

Thank you!
This is just from memory so there might be issues, but maybe try something like:
Code:
<Custom Apply Effect>
var boost = 500;
user.addParam(0, boost);  // mhp up
user.gainHp(boost);  // hp up
</Custom Apply Effect>

<Custom Remove Effect>
var boost = 500;
user.gainHp(-boost);  // hp down
user.addParam(0, -boost);  // mhp down
</Custom Remove Effect>
@Mjolk If the actor loses HP when the buff ends, what happens if their HP goes below zero? Should they die?

Example:
HP before buff: 350/1000
HP buff added: 850/1500
HP after being attacked: 200/1500
HP buff expire: 0/1000 (are they dead?)
This is just from memory so there might be issues, but maybe try something like:
Code:
<Custom Apply Effect>
var boost = 500;
user.addParam(0, boost);  // mhp up
user.gainHp(boost);  // hp up
</Custom Apply Effect>

<Custom Remove Effect>
var boost = 500;
user.gainHp(-boost);  // hp down
user.addParam(0, -boost);  // mhp down
</Custom Remove Effect>

Hello, thank you for answering.
This works very close (I was not aware of the command user.addParam), but when it loses the buff the damage is reflected on the normal hp.
Example: HP before buff: 1000/1000, buff added: 1500/1500 enemy hit (for 300 damage) 1200/1500 HP buff end: 700/1000 <---issues
The real result was: HP buff end: 1000/1000
In practice with this code are +500hp fake.

Anyway, thank you for the answer is very appreciated, now I have some more elements to succeed.
@Mjolk If the actor loses HP when the buff ends, what happens if their HP goes below zero? Should they die?

Example:
HP before buff: 350/1000
HP buff added: 850/1500
HP after being attacked: 200/1500
HP buff expire: 0/1000 (are they dead?)
Yes, right!
The enemy hits the the result of normal hp + temporarily stock of 500 hp, if the hero has less when the buff ends it dies or stays with 1 hp (for me it's the same).

Exactly like in this skill:
https://wiki.guildwars.com/wiki/Endure_Pain

Is written in the notes:
  • This skill is best used when very low on health.
  • The health gained is temporary; your health can drop below zero when this ends. However, if that happens, you won't always die. For example, if you have positive health regeneration, your health bar will show 1 health while you recover the negative health caused from this skill ending. But if you have health degeneration or take any damage, you will die. Healing may also be fatal if it does not bring your health above zero.


Thanks for your interest!











Ok Edit, i have Resolved.

The code is:
Code:
<Custom Apply Effect>
target._boostDmg = target._boostDmg || 500;
var boost = 500;
user.addParam(0, boost);       // mhp up
user.gainHp(target._boostDmg); // hp up
</Custom Apply Effect>

<Custom React Effect>
target._boostDmg = target._boostDmg || 500;
if (this.isHpEffect()) {
   target._boostDmg = target._boostDmg || 500;
   if (value > 0) {
      target._boostDmg -= value;
 }
}
</Custom React Effect>

<Custom Remove Effect>
target._boostDmg = target._boostDmg || 500;
if (target._boostDmg < 0) {
   value = 0;
}
var boost = 500;
user.gainHp(-value);       // hp down
user.addParam(0, -boost);  // mhp down
target._boostDmg = undefined;
</Custom Remove Effect>

I applied a counter that degenerates the hp boost, and if the damage goes further it is reflected in the remaining hp.
Oh I see, nice to see you found a solution! 😀

Original thread: https://forums.rpgmakerweb.com/threads/temporary-buff-maxhp-yanfly-buffs-states-core.109269/