Recreating - Endure

In Pokemon, Endure allows you to survive any hit that will cause you to faint when using the move for the next turn.


E.G: Victini is hat 50 HP, Victini uses endure, Pachirisu uses Discharge, Victini endures the hit, Victini's current HP: 1 
I think you will need Yanfly's States and Buffs scripts, and then use lunatic code to recreate it. Should be doable from there. Unfortunately I don't know the code, so will have to ask on the JavaScript forums for that one more than likely.
I doubt I will get any answer from the boards but thanks anyways.
It's something you'd need to script if you want it to work like Pokemon.  If no one will make this script for you, get into the code and make the changes yourself; this kind of thing is pretty basic.  I've seen you make a lot of requests so learning to do it yourself will be necessary in the long run anyhow.  Figure out where the death state is applied (when a battler is reduced to 0 HP), and if the battler has the state applied (and has 0 or less HP), set their HP to 1 instead of applying the death state.


The closest you can get without scripting would be to have a state that lasts for as long as you want it to which has the Resist State: KO feature.  The major difference between this and how it works in Pokemon is that this state will allow the user to keep battling while at 0 HP, and when it's removed I think the user dies unless they've been healed above 0 HP.
I would just add a state that makes the user resist KO, and add a low hp regen% with it as well(somewhere that gives at whatever level the skill is learned the user 1hp)
You can try to suggest Yanfly your idea for her tip and trick : https://www.youtube.com/watch?v=1wP8BpSIOAc
Hello!


If you use Yanfly's Buff & State Core, you can use the following notetag in your Endure state:


<Custom React Effect>
if ($gameParty.inBattle() && !this.isCertainHit() && value >= target.hp) {
  value = target.hp - 1;
}
</Custom React Effect>


If you wanna endure one hit only, simply check the 'Remove by Damage' box.


You can also use <Action Start: 1> to make it last until that battler's next turn.


Hope that helps!


- Riff
@Riff I was having this same problem too, so thanks for the code! One more thing though, I want the state to last more than one turn, as in I want the state to last UNTIL you would normally be killed or after 10 turns have passed. (though that is irrelevant for the code in question) I know this is like, 4 years later, but would you mind if you gave some additional code to allow the state to only end when the character would normally die? Because if I do it with the "Remove By Damage" thing it will only last until the actor is hit when I want it to last for multiple turns or until the state is activated. Can you please help with that? Thanks!
This is what I use, there's more than 1 way to achieve this effect:
Code:
<Custom Respond Effect>
if (target.hp === 0) {
  target.gainHp(1);
}
</Custom Respond Effect>
You can use "React" like in Riff's example or "Respond" like in mine, your choice. They're just 2 ways to achieve the same goal. If you use "React" you'll want to use Riff's code though as mine allows dmg calculation to go thru, but then keeps the character at 1hp afterwards.

If you need it to last 10 turns, simply add the duration in the auto removal timing section (choose Action End or Turn End). You'll prolly also want to tick "Remove at Battle End"
I want the state to last more than one turn, as in I want the state to last UNTIL you would normally be killed or after 10 turns have passed.
That person is likely gone given how old this thread is, so here's how I'd probably try going about it:
  1. Uncheck the "remove on damage" box
  2. Set it to 10-10 turns and "remove after battle" as mentioned by the post above this one
  3. Use this code, replacing ENDURE_STATE_ID with the id number of your Endure state.
  4. Optionally, replace ACTIVATION_ANIMATION_ID with an animation to play when the state is removed. This not only looks cool, but it gives a visual queue to the player that Endure did its thing. If you don't want an animation to play out when it activates, just remove the user.startAnimation() line.

Code:
<Custom React Effect>
if ($gameParty.inBattle() && !this.isCertainHit() && value >= user.hp)
{
  value = user.hp - 1;
  user.startAnimation(ACTIVATION_ANIMATION_ID);
  user.removeState(ENDURE_STATE_ID);
}
</Custom React Effect>
Would @Dalamar's method also work?

Original thread: https://forums.rpgmakerweb.com/threads/recreating-endure.60107/