How To Make A Passive State That Leaves Target At 1 HP, 3 Times When Attacked Then Removes Itself

Hi, I was wondering how I could make a guts like passive state that when the hero takes an attack that would have killed them, leaves them at 1 HP and this effect activates 3 times and after that, automatically removes itself. I have all Yanfly Plugins as well if that helps.

I would also prefer it to have a state counter so that the player knows how many times it has left before it's removed.

Any help?

(Also I'm also fine with the reviving the target 3 times instead if the guts effect is harder to implement)
Oh wow, are you trying to make it as complicated as you can? Haha.

Well, I dont know about a plugin that will do this out of the box, but I love a challenge. When I get home, I'll see if I can solve this one without the need of a plugin.
Oh wow, are you trying to make it as complicated as you can? Haha.

Well, I dont know about a plugin that will do this out of the box, but I love a challenge. When I get home, I'll see if I can solve this one without the need of a plugin.
I know Yanfly has a plugin called State Protection, and one of the notetags has an effect called Guts, which does exactly what I want. The only problem is, I'm unaware how to code the state so that it triggers 3 times and remove itself after.
there is a thread how to do it with 1x hp as this checks if hp < 2 is checked.
if so, set it to true, find that one and you can alter it easely to make it true
when you add a counter to it (require buff and state core plugin.

I try to find that thread later if you didn't already.
I know Yanfly has a plugin called State Protection, and one of the notetags has an effect called Guts, which does exactly what I want. The only problem is, I'm unaware how to code the state so that it triggers 3 times and remove itself after.
I have a similar effect in my project that works with just the buffs and states plugin. you can tweak it to work as a passive or make a passive that grants the state at the start of a battle. just make sure the state has a state resist trait for KO and it should work.

Spoiler: state as-is
Code:
<Custom Apply Effect>
user._will = user._will || 1;
if (user._will > 1) user.setStateCounter(stateId, user._will);
</Custom Apply Effect>

<Custom Deselect Effect>
if (target.hp == 0) target._wont = true;
</Custom Deselect Effect>

<Custom Turn End Effect>
if (user.hp == 0) user._wont = true;
if (user._wont){
  delete user._wont;
  user._will -=1;
  user.setStateCounter(stateId, user._will);
  user.gainHp(1);
  user.startDamagePopup();
  user.setStateTurns(stateId, 3);
}
if (user._will <= 0) user.removeState(stateId);
</Custom Turn End Effect>

<custom remove Effect>
delete user._will;
</custom remove Effect>
I have a similar effect in my project that works with just the buffs and states plugin. you can tweak it to work as a passive or make a passive that grants the state at the start of a battle. just make sure the state has a state resist trait for KO and it should work.

Spoiler: state as-is
Code:
<Custom Apply Effect>
user._will = user._will || 1;
if (user._will > 1) user.setStateCounter(stateId, user._will);
</Custom Apply Effect>

<Custom Deselect Effect>
if (target.hp == 0) target._wont = true;
</Custom Deselect Effect>

<Custom Turn End Effect>
if (user.hp == 0) user._wont = true;
if (user._wont){
  delete user._wont;
  user._will -=1;
  user.setStateCounter(stateId, user._will);
  user.gainHp(1);
  user.startDamagePopup();
  user.setStateTurns(stateId, 3);
}
if (user._will <= 0) user.removeState(stateId);
</Custom Turn End Effect>

<custom remove Effect>
delete user._will;
</custom remove Effect>

[/SPOILER

Thanks, this was essentially what I was looking for.
I cannot find it, but the closest I find is this [Living Dead] which keep the user
for 3 turns alive as it was coded, than die or can die.

you might still need to adjust some values, but it should get you somewhere 🙂

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-a-passive-state-that-leaves-target-at-1-hp-3-times-when-attacked-then-removes-itself.167621/