Creating a Rebirth State

Hi! I'm using RPGMaker MV and trying to create a state called Rebirth - when a character takes lethal damage, they will revive with full HP and the state will be removed. I've tried a couple of approaches and both of them have their own issues.

1) Passive States

The first approach was to have a particular character have the passive state of Rebirth (using YEP_AutoPassiveStates plugin). i.e. in the character's Note I have <Passive State: 11> which corresponds to my Rebirth state. Rebirth itself doesn't do anything,
its behavior is handled by the Knockout state.

In my Knockout state, I have the following code in the Note section (using YEP_BuffsStatesCore).

State #1 will be automatically added when HP reaches 0.​
<Custom Apply Effect>​
if (target.isStateAffected(11))​
{​
target.startAnimation(42);​
target.gainHp(target.mhp);​
target.startDamagePopup();​
target.removeState(11);​
}​
</Custom Apply Effect>​

This almost works. When the character dies in battle, they are reborn with full HP the way they're supposed to.

However, Rebirth isn't removed, even though I have a call to removeState. I've tried working around it by making Rebirth have a conditional switch, but I'm not sure how to activate the switch during the battle. I've thought about messing about with Rebirth's removal conditions, but none of those seem to fit what I need.

I've also tried applying Rebirth at the start of battle instead of having it be a passive state, but then I run into my second problem:

2) Actively applying Rebirth doesn't work

When I use a skill to give a character Rebirth or when I apply it at the start of combat, the same code I used above doesn't work. The character just dies. Rebirth clearly does get applied because its icon shows up, but it doesn't activate. The code for it works when Rebirth is a passive state, but not when I apply it during battle. I'm really not sure why.

I know this is a pretty specific issue but I was wondering if anyone had run into something like this. Thanks in advance for the help!
I might be able to help with this one, it was a pain to figure out how to do it so i know how you feel 😅

You'll need two states if you want to make it a passive (well, you don't need need 2 but for simplicity sake let's do it like that)

The passive state: Have it apply another state (in this example number 5) to the actor when combat starts.

The actual rebirth state:

Make it give state resist: your death state (number 1 by default)

<Custom Respond Effect>

if (target.hp <= value) {

target.startAnimation(202); (100% optional)

var HpHeal = Math.floor(target.mhp);

target.gainHp(HpHeal);

target.removeState(5);

}

</Custom Respond Effect>

Hope it works for you, I haven't test it 100% to be as you wanted because it doesn't fully heal in my game but I think it's close enough... we can tinker with it if not 😉
Have you checked over here ?


Or here :

I might be able to help with this one, it was a pain to figure out how to do it so i know how you feel 😅

Thanks, a variation of what you suggested worked for me!

In case anyone else needs this, for my "rebirth granting state" (state 12), I used the following code:

<Custom Apply Effect>
target.addState(11);
</Custom Apply Effect>
<Custom Remove Effect>
target.removeState(11);
</Custom Remove Effect>

and then the Rebirth state was what you suggested except just using target.mhp instead of the floor. Finally, I used a common event to apply the state at the start of combat in the troops Battle Event.

Original thread: https://forums.rpgmakerweb.com/threads/creating-a-rebirth-state.122561/