Yanfly's tip : Second Chance - Remove after action

Hey everyone ! Hope that you're going well !

I need your help, as I have no knowledge on javascript.
Here is the link of the tips and tricks : http://yanfly.moe/2016/03/23/tips-tricks-second-chance-kingdom-hearts/.

I would like to remove the state that revives the character after the effect is done once. Is that possible ?
It may use this <Custom Remove Effect> notetag I believe.

Thanks for reading, and thanks for your help !

I've moved this thread to JavaScript Support. Thank you.

Oh sorry @bgillisp ! I didn't notice that 👋
You'll need to clarify on what you mean by removing the state, as Yanfly set up the state as a passive, so it isn't really removed like normal states are. Do you want to make the state a passive as well? If so, for how long do you want to remove the state? Do you want to permanently remove the state after one use? Or do you have it so the state is being applied like normal states are? It's pretty difficult to tell without knowing how you're planning to apply and use the state.
There's no need to do that. Simply add one line.
<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);
target.removeState(stateID);
}
</Custom Respond Effect>

But it cannot be a passive state as stated above, since passive states cannot be cleansed in any way other than unequipping that particular equip.
It's absolutely not a passive in my game : it is given with a skill, and I want to effect just once 🙂
Thank you @Poryg !


EDIT : I have just tested it and i works perfectly !!! Thank you very much !

Original thread: https://forums.rpgmakerweb.com/threads/yanflys-tip-second-chance-remove-after-action.80156/