RPG Maker Forums

Hi,


I would like a tweak to Yanfly tip a trick : second chance.


I would like the code check if the target is under 30% HP, it will heal him 10% of his HP.


I understand where to change the part but I don't know the code to calculate that in %.

Code:
<Custom React Effect>
// Check to see if the party is in battle.
if ($gameParty.inBattle()) {
  // Sets the flag if the target has more than 1 HP at the time of death.
  target._secondChance = target.hp > 1;
}
</Custom React Effect>

<Custom Respond Effect>
// Check to see if the party is in battle, has the Second Chance flag, and if the target is dead with 0 HP.
if ($gameParty.inBattle() && target._secondChance && target.hp <= 0) {
  // Play the revival animation.
  target.startAnimation(49);
  // Set the target's HP to 1.
  target.setHp(1);
}
</Custom Respond Effect>

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,476
Members
137,824
Latest member
dobratemporal
Top