MZ A state that applies auto-life once per battle

So I am using the visustella library, and I would like to make a passive state that allows the character to automatically revive once per battle. This could be done by making the passive state apply the auto-life state at the beginning of every battle. Is this included in the VS library? Or would I need custom JS?
If you apply it every battle, it will not run once per game, but per battle.
Also, if you use passive states, you don't have to manually apply it.

Here is what you can do:
Create a plugin (I will create it for you if you want, but I won't be fast, because I would have to figure out how to do it) that triggers a common event instead of game-over when you die.

Now, apply the state to the acture at the beginning of the game. Don't use a passive state, because they won't go away. Use a normal state that won't have a max turns or steps, and won't go away when taking damage. (You could just copy the immortal state if you wish)

Now in the common event that is triggered by the plugin, you put a condition:

Code:
◆If:Actor X is affected by State Y
  ◆Change State:Actor X, - State Y
  ◆
:Else
  ◆Game Over
  ◆
:End

This way, the first time you die in a game, you'll be saved. The second time, sorry, but you're dead. 😛
Googling VisuStella and auto life:

<Auto Life: x%>

- Used for: State Notetags
- When the affected battler dies with this state present, this state will
automatically remove itself (and any other states with <Auto Life: x%>) to
restore that much HP% for the battler.
- Replace 'x' with a number representing that percentage of HP to heal the
battler upon dying.

You can add your auto life state via troop events on Turn 0. I recommend using a Base Troop plugin so that you don't have to copy/paste this page to all your troops.

1687806319281.png
So you are using Visustella library, you can use http://www.yanfly.moe/wiki/Limited_Skill_Uses_VisuStella_MZ and http://www.yanfly.moe/wiki/Life_State_Effects_VisuStella_MZ to do what you want.
Assuming you're using Battle Core and Life State Effects, put this in your passive state note box:
Code:
<JS Post-Start Battle>
 user.addState(stateId);
</JS Post-Start Battle>

Replace stateId with the ID (without leading zeroes) of your life state.
Assuming you're using Battle Core and Life State Effects, put this in your passive state note box:
Code:
<JS Post-Start Battle>
 user.addState(stateId);
</JS Post-Start Battle>

Replace stateId with the ID (without leading zeroes) of your life state.
That works, but I actually found a more elegant solution with the auto-skill triggers plugin. Thanks anyway!
That works, but I actually found a more elegant solution with the auto-skill triggers plugin. Thanks anyway!
No problem.
spy-x-family-spy-family.gif

Original thread: https://forums.rpgmakerweb.com/threads/a-state-that-applies-auto-life-once-per-battle.158718/