[RPG MV]Damage in Cure State by Yanfly

Hello people!

I'm creating a skill called Reverse using the Yanfly plugins.
It is a state where Damage causes healing.
I'm trying to use this note in the State:

<Custom React Effect>

// Check if the action is a damage skill.

if (this.isHpDamage()) {

// If it is, let's convert the value into cure!

var heal = Math.floor(target.mhp * rate);

}

</Custom React Effect>


But it does not work, can you help me solve. Thank you!
What do you do with the variable heal? You store a value there, but I don't see where you use it anywhere in that code snippet.
Hi bgillisp!

I used as base the code of "Undead" of Yanfly

<Custom React Effect>
// Check if the action is a recovery skill.
if (this.isHpRecover()) {
// If it is, let's convert the value into damage!
value = Math.abs(value);
}
</Custom React Effect>

So it seems I do not know what I'm doing ... XD Could you help me with that?
I know little Javascript, but the code you used as a base worked as value is already returned by the system. But you stored it as heal, which is not used by the system on a damage skill, which is why it is doing nothing. You'll have to add code to have it actually heal you the amount of what you stored, but I don't know enough Javascript to help with that code. Though it might be included in one of the other tips/tricks videos, check the one on poison or so as I remember seeing one in 2015/2016 that had code for how to do damage or heal inside the react effect.
try this:

Spoiler
<Custom React Effect>
// Check if the current action deals HP damage.
if (this.isHpEffect() && value > 0) {
// Heal the target for equal amount.
target.gainHp(value*2);
// Display the damage popup.
target.startDamagePopup();
// Clear the results.
target.clearResult();
}
</Custom React Effect>

Original thread: https://forums.rpgmakerweb.com/threads/rpg-mv-damage-in-cure-state-by-yanfly.110767/