Managing states changing into other states, and after battle events?

So in my game, I want there to be a creature that can sort of "lock" you out of party members during battle through a special sequence of statuses.

Basically it goes like this:

If the Enemy lands a successful attack on this party member, the party member gets put into a sort of "Locked" State where the party member can't do anything at all. (Think like being put in a cage).
If the battle ends while this party member is Locked, and all the other party members are KO'd/dead, it should just go to a game over.
If the battle ends while this party member is Locked, but the other party members are fine, it just goes away on its own.

However, in addition to this...once this Locked state is applied, this party member only has 4 turns until they get OHKO'd, and put into a special death state that is similar to regular KO/death, but cannot be revived in-battle.
If the battle ends while this party member is in this special death state, and the other party members are fine, they will be reverted back to a normal KO/death status in the over world (aka, 0 HP).


I am utterly lost on how to make this happen. What are the steps I should take to make this work?

I should also mention, I am using HIME's custom death states, so I don't think there will be problems in regards to these 2 states being "death" statuses...
What should happen if the party member who is Locked gets killed before the lock expires? By default, getting killed would remove the state; you'd need a plugin if you want to change that.


(Only need to use one or the other, pick whichever works for your game)

If the battle ends while this party member is Locked, and all the other party members are KO'd/dead, it should just go to a game over.
There are a couple of plugins you can use for this.


If the battle ends while this party member is Locked, but the other party members are fine, it just goes away on its own.
Under removal conditions, set it to "Remove at Battle End"

However, in addition to this...once this Locked state is applied, this party member only has 4 turns until they get OHKO'd, and put into a special death state that is similar to regular KO/death, but cannot be revived in-battle.
With Yanfly's Buff & States Core, you could set the Locked state to add another state when it expires, via the <Custom Leave Effect> notetag.

JavaScript:
<Custom Leave Effect>
user.addState(1);
user.addState(n);
</Custom Leave Effect>
Where n is the number of your special death state. Set the special death state to "Remove at Battle End"
For your special death state, I think you should be able to set the recovery effect and pharmacology rate to 0% to prevent recovery? Not too sure about that.

What should happen if the party member who is Locked gets killed before the lock expires? By default, getting killed would remove the state; you'd need a plugin if you want to change that.


(Only need to use one or the other, pick whichever works for your game)


There are a couple of plugins you can use for this.



Under removal conditions, set it to "Remove at Battle End"


With Yanfly's Buff & States Core, you could set the Locked state to add another state when it expires, via the <Custom Leave Effect> notetag.

JavaScript:
<Custom Leave Effect>
user.addState(1);
user.addState(n);
</Custom Leave Effect>
Where n is the number of your special death state. Set the special death state to "Remove at Battle End"
For your special death state, I think you should be able to set the recovery effect and pharmacology rate to 0% to prevent recovery? Not too sure about that.


Extremely helpful, and I appreciate you breaking down bits of my post to analyze it. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/managing-states-changing-into-other-states-and-after-battle-events.151579/