MV how to make attacks heal you when landing a critincal (yanfly can be used)

basically i was thinking of making a passive for someone where all their attacks heal their hp and mp slightly whenver they land a critical attack does anyone know how to achieve that
What have you tried? I see you made another thread a couple weeks ago about calling a sound effect when landing a critical hit. The solution to this thread follows the same logic but depends on what method and plugin(s) you used.
What have you tried? I see you made another thread a couple weeks ago about calling a sound effect when landing a critical hit. The solution to this thread follows the same logic but depends on what method and plugin(s) you used.
i use yanfly's buff and states core, skill core, ciritcal control and sway as well my first attempt was adding this in a state and it didn't seem to work

<Pre-Damage Eval>

if (target.result().critical) {

var hpRecover = Math.floor(user.mhp * 0.10);

var mpRecover = Math.floor(user.mmp * 0.10);

user.gainHp(hpRecover);

user.gainMp(mpRecover);

user.startDamagePopup();

user.clearResult();

}

</Pre-Damage Eval>
i was thinking of making a passive
<Pre-Damage Eval>
thats not a notetag for states. thats notetag for a skill. refer to the notetags within the buffs and states plugin for a state effect rather than a notetag from within the skill core
i use yanfly's buff and states core, skill core, ciritcal control and sway as well my first attempt was adding this in a state and it didn't seem to work

<Pre-Damage Eval>

if (target.result().critical) {

var hpRecover = Math.floor(user.mhp * 0.10);

var mpRecover = Math.floor(user.mmp * 0.10);

user.gainHp(hpRecover);

user.gainMp(mpRecover);

user.startDamagePopup();

user.clearResult();

}

</Pre-Damage Eval>
Works for me. Make sure you have Yanfly's Damage Core added above Critical Control.
Works for me. Make sure you have Yanfly's Damage Core added above Critical Control.
is it possible to add it in a state ?
is it possible to add it in a state ?
Doesn't look like you can do it through notetags for states, but you can use something along the lines of user.isStateAffected(x) within the pre-damage evaluation to check whether the user is affected by the state. Or you can use Yanfly's Buff & States Core and play around with checking for crits at Attacker: Confirm. I haven't used the latter, so someone more experienced would have to chime in.
Doesn't look like you can do it through notetags for states
Why not?

1727226406195.png
coding is hard

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-attacks-heal-you-when-landing-a-critincal-yanfly-can-be-used.172130/