- Joined
- Oct 13, 2014
- Messages
- 300
- Reaction score
- 89
- First Language
- Enlish
As we all know, there's multiple ways of creating an "Endure" state in RPG Maker MV.
For those of you who don't know, an "Endure" or "Guts" state is a state where upon taking fatal damage, a character is revived or holds on with minimal HP. I'm using Yanfly's second chance code to replicate this in my game, however, I want to add an extra line of code that will give this effect a chance to occur depending on the characters luck stat.
I've been having trouble accomplishing this however, and would like some help.
Here are the endure codes:
Thank you for reading through my thread!
For those of you who don't know, an "Endure" or "Guts" state is a state where upon taking fatal damage, a character is revived or holds on with minimal HP. I'm using Yanfly's second chance code to replicate this in my game, however, I want to add an extra line of code that will give this effect a chance to occur depending on the characters luck stat.
I've been having trouble accomplishing this however, and would like some help.
Here are the endure codes:
<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>
Basically, I want to add a formula to calculate the chance of this effect happening. Something like if = a.luk / 2 . That way, a character with a high luck chance will have a better chance of activating the endure effect in battle.<Category: Bypass Death Removal>
<Custom Deselect Effect>
// Check if the target's HP is 0 or is currently in the death state.
if (target.hp <= 0 || target.isDead()) {
// Play the auto-life animation on target.
target.startAnimation(49);
// Set the amount of HP recovered to 10%.
var rate = 0.10;
// Calculate the HP healed.
var heal = Math.floor(target.mhp * rate);
// Remove the Auto-Life state.
target.removeState(stateId);
// Heal the target.
target.gainHp(heal);
// Make the damage popup show for the heal.
target.startDamagePopup();
// Clear the target's results.
target.clearResult();
}
</Custom Deselect Effect>
Thank you for reading through my thread!

