Alternatives to death state

Alright, here's the gyst: I want my characters to be able to continue acting when they're dead. If all members are dead, that's when the battle is lost.

It seems state one is heavily hard coded to be a death state. Is there any way to play around that? Either to allow acting through death (which the editor seems to give us a fake choice of) or to make another state be applied on death instead. I've got the other state ready, but countering the hardcode of always applying state 1 when reaching 0 HP is quite a chore. Appreciate the help!
wrong way to go at it.

what is hardcoded is the fact that state #1 is applied whenever HP reaches zero, and that the battle ends if all actors have state#1

The effects of the state are NOT hardcoded - that is why the state is in the database after all, so that you can change its effects.

so the solution for you is extremely easy - just remove the restriction you don't want at death. It should work for actors, but not for enemies as they are handled slightly differently
*** EDIT: @Andar solution will work best!
Hi there!

You could change the death state id. the problem is that a lot of things depend on him.

JavaScript:
Game_BattlerBase.prototype.deathStateId = function() {
    return 1;
};

Game_Battler.prototype.refresh = function() {
    Game_BattlerBase.prototype.refresh.call(this);
    if (this.hp === 0) {
        this.addState(this.deathStateId());
    } else {
        this.removeState(this.deathStateId());
    }
};

Every time your actors get HP = 0, it will apply the death state id, whatever the id it is.

I believe a solution that can safely and quickly put you out of trouble, regarding compatibility issues or strange behaviors in battle, is to not let the actor's hp go to 0.
Let them always stay 1 and you can apply a semi-death state on them.

Then check if everyone is with 1 HP and with the semi-death state.

If yes, then you can kill everyone(or just set their HP to 0) that the battle will finish.
wrong way to go at it.

what is hardcoded is the fact that state #1 is applied whenever HP reaches zero, and that the battle ends if all actors have state#1

The effects of the state are NOT hardcoded - that is why the state is in the database after all, so that you can change its effects.

so the solution for you is extremely easy - just remove the restriction you don't want at death. It should work for actors, but not for enemies as they are handled slightly differently

No, I'm afraid changing the restriction in the database to "None" instead of "Cannot Move" does not work. I wish it was this easy, but it isn't.

*** EDIT: @Andar solution will work best!
Hi there!

You could change the death state id. the problem is that a lot of things depend on him.

JavaScript:
Game_BattlerBase.prototype.deathStateId = function() {
    return 1;
};

Game_Battler.prototype.refresh = function() {
    Game_BattlerBase.prototype.refresh.call(this);
    if (this.hp === 0) {
        this.addState(this.deathStateId());
    } else {
        this.removeState(this.deathStateId());
    }
};

Every time your actors get HP = 0, it will apply the death state id, whatever the id it is.

I believe a solution that can safely and quickly put you out of trouble, regarding compatibility issues or strange behaviors in battle, is to not let the actor's hp go to 0.
Let them always stay 1 and you can apply a semi-death state on them.

Then check if everyone is with 1 HP and with the semi-death state.

If yes, then you can kill everyone(or just set their HP to 0) that the battle will finish.

This is the easy answer, and there's workarounds to be found, but that's not what I want. I genuinely need something that makes it so that the actors (and enemies) can still act even if they are knockout, only getting fully knocked out when the battle ends.
Then you need a different approach, preferably done with base troop events to spare you the work of having to add the required troop events everywhere.

you'll need an immortal state (immunity to death state but no other effect and no message or time-limit) and two variables.
On turn zero, apply the immortal state to everyone and set the variables to zero

for each enemy and each actor you'll need a troop event to trigger on HP=0. this troop event should count up death in the variable for the correct side, then check if the numbe of death is identical to the entire side of the battle.
If yes, remove the immortal state and let the engine handle death and battleend as normal.
Then you need a different approach, preferably done with base troop events to spare you the work of having to add the required troop events everywhere.

you'll need an immortal state (immunity to death state but no other effect and no message or time-limit) and two variables.
On turn zero, apply the immortal state to everyone and set the variables to zero

for each enemy and each actor you'll need a troop event to trigger on HP=0. this troop event should count up death in the variable for the correct side, then check if the numbe of death is identical to the entire side of the battle.
If yes, remove the immortal state and let the engine handle death and battleend as normal.

I've messed around more with the system, and you were right about the restriction; the problem is that Yanfly's ATB plugin seems to not cooperate with that restriction at all, nullifying the ATB gain fully when any death state is applied. When I returned to DTB, actors are still able to act.

I'll likely use what you just suggested, Yanfly's BuffStateCore and PassiveState should help, without the need for base troop events. A simple invisible immortal state and another one to handle whenever this happens.

My only concern, now, is the 1 HP and 0 HP thing. Using your method, I'm assuming that HP will just be stuck at 1 HP, but correct me if I'm wrong. HP kinda matters in what I'm trying to do, and 0 HP is something I want. Is there any way to change that, or affect this at all?
I'm assuming that HP will just be stuck at 1 HP,
no, it should go to 0 and the troop events should be set to trigger at HP=0
no, it should go to 0 and the troop events should be set to trigger at HP=0
Great!

Tested it out, works fine. Thanks to all who participated in this thread; your help was appreciated.

The thread can be closed.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/alternatives-to-death-state.137135/