Request: an Endure State

I am looking for a way to do an Endure State (I dont want the actor to just gain 1 HP right after dying).

Ex:

Actor has "Endure" state. Actor gets hit by 120 damage while he has 110 HP left. The "Endure" State prevents his death, and puts him at 1 HP left. However, the next attack brings him to 0.

I ultimately want the Actor with the state to Endure an attack with 1 HP left, but if they have only 1 HP left, they die after damage.
Does the built-in immortal state not work for that?
Well, Immortal just makes them never die, I just want this to prevent reducing HP to 0, unless they only have 1 HP.
Bump
You already tried tinkering with the Autolife plugin? Just have the note tag be <autolife: 1> and BOOM!, Bobs your uncle.
It's not how I want it to work.. I want the character NOT to die, but just be left with 1 HP.
Bump
I think I have a solution for this. let me write something up.


The plugin will be designed specifically for such a state.


Here's a small vine: https://twitter.com/HimeWorks/status/670745050591199232
Looks like it will be perfect! (It would be even better if there was some type of popup or something that mentioned that the hit was endured, but that would be only a luxury.)
That would be a separate plugin.
Dont worry about it then. The endure looks good!
http://forums.rpgmakerweb.com/index.php?/topic/51758-state-damage-modifiers/

Using this plugin, you can note-tag a state with

<state damage modifier> return b.hp - 1</state damage modifier>Which will change the damage to your current HP minus 1, which will effectively leave just 1 HP.Note the explicit "return", because now you are actually writing javascript yourself.

So let's say you wanted the state to be removed if the damage is actually greater than your HP.

You can write some code to check this, and also remove the state if necessary.

<state damage modifier>if (d > b.hp) { b.removeState(23)}return b.hp - 1</state damage modifier>Assuming 23 was the ID of your endure state.Depending on your scripting proficiency, you could do literally anything with that formula.
Well, it seems as if it conflicts with my own personal plugin that takes a function placed in the damage formula box and spits out the damage value, among doing other things. However, I believe I can take the formulas used in the notetags that you have provided can actually be placed in my personal function and make it work.
That's strange? Because this formula is evaluated separately from the skill's damage formula.
Under further investigation, I cannot actually do what my plan was, so I had to figure out what exactly was conflicting.

The troublemaker seems to be QuasiParamPlus, which I am using for a hcr (hp cost rate) for yanfly hp costs until an official hcr is released through her plugins.

When your plugin is above QuasiParamPlus, the endure stuff/formulas in notetags does not get applied.

When your plugin is under QuasiParamPlus, the endure works perfect, but when I attack a normal monster, the monster disappears and damage pops up as 0...

I also cannot turn the QuasiParamPlus plugin off, because then I cannot use skills in battle....
Sorry, the formula I provided was wrong.


It doesn't take into account who is the attacker and who is the defender.


This happens because both the attacker AND defender's states are all factored into the damage modifier.


Let me find a better formula.
Oh thank goodness. I was getting frustrated looking through all my plugins seeing what was causing issues.. xD
Ok so the plugin was doing the right thing: it checked the attacker's states to see if there were any damage modifiers. Then it checked the defender's states to see if there were any modifiers.

My formula was based on an older version of the plugin which assumes only the defender's states were checked.

The final version would require you to actually *check* whether state is affected on the target, since the same damage modifier is used for when you're attacking and when you're defending.

Code:
if (b.isStateAffected(23)) {  b.removeState(23)  return b.hp - 1}else {  return d;}
Which actually might be a problem.
Yay! Works like a dream now. I also had to place it under most of my plugins, probably due to the aliasing of the makeDamageValue function.

Thanks a bunch!

Original thread: https://forums.rpgmakerweb.com/threads/request-an-endure-state.49900/