- Joined
- Jun 6, 2017
- Messages
- 96
- Reaction score
- 20
- First Language
- English
- Primarily Uses
- RMMV
Second Chance (MV Plugin Tips & Tricks) - Yanfly.moe Wiki
In my game, I have "Knockout by Slip Damage" turned on, but also I have a state that prevents big attacks from lowering a characters HP below 75%, 50%, 25% and 1 point.
JavaScript:
<Custom Battle Effect>
if ($gameParty.inBattle()) {
target._checkUno = 1;
target._checkDos = 1;
target._checkTres = 1;
target._checkCuatro = 1;
}
</Custom Battle Effect>
<Custom React Effect>
if ($gameParty.inBattle()) {
target._struggleOne = target.hp > (target.mhp*0.75);
target._struggleTwo = target.hp > (target.mhp*0.50);
target._struggleThree = target.hp > (target.mhp*0.25);
target._struggleFinale = target.hp > 1;
}
</Custom React Effect>
<Custom Respond Effect>
if ($gameParty.inBattle() && target._struggleOne && target.hp <= ((target.mhp*0.75)-1) && target._checkUno == 1) {
target.startAnimation(124);
target.setHp(Math.floor(target.mhp*0.75));
target._checkUno = 0;
}
else if ($gameParty.inBattle() && target._struggleTwo && target.hp <= ((target.mhp*0.50)-1) && target._checkDos == 1) {
target.startAnimation(124);
target.setHp(Math.floor(target.mhp*0.50));
target._checkDos = 0;
}
else if ($gameParty.inBattle() && target._struggleThree && target.hp <= ((target.mhp*0.25)-1) && target._checkTres == 1) {
target.startAnimation(124);
target.setHp(Math.floor(target.mhp*0.25));
target._checkTres = 0;
}
else if ($gameParty.inBattle() && target._struggleFinale && (target.hp <= 0) && target._checkCuatro == 1) {
target.startAnimation(124);
target.setHp(1);
target._checkCuatro = 0;
}
</Custom Respond Effect>
However, if a character is inflicted with a Status Ailment, or if they use a skill that costs HP, the State is ignored. Any suggestions?