MZ Unique Death States for Actors and Enemies

Hi,

I'm looking for a script that will allow the actors and enemies to have different death states.

Basically, the death state is going to have different values for enemies and for players, so i need them to be separate.

If I remember right there was a script for VX ace that did something similar, but I can't find it for the life of me.

Basically, it had a note tag that was like <death state: "insert state id"> and the object (either and actor or enemy) tagged with that state would die like normally but they would have whatever tagged state applied instead.

Thank you!
You don't give a lot of context - it may very possibly be easier to change the reason you need this than it would be to implement this.

It's certainly doable, it's just that the death state is referenced in a handful of places, and changing all of those to work backwards, checking whether it's an actor or an enemy then the appropriate database entry for any notetags and so on...like I said, might be easier to change the reason for needing them.

But you can try this, see if it does what you want.
Code:
Game_BattlerBase.prototype.deathStateId = function() 
{
    if (typeof this == Game_Actor && this.actor().meta.deathid)
        return Number(this.actor().meta.deathid);
    else if (typeof this == Game_Enemy and this.enemy().meta.deathid)
        return Number(this.enemy().meta.deathid);
    return 1;
};
You'd put the notetag <deathid:x> into an actor or enemy. See what works and what doesn't.
You don't give a lot of context - it may very possibly be easier to change the reason you need this than it would be to implement this.

It's certainly doable, it's just that the death state is referenced in a handful of places, and changing all of those to work backwards, checking whether it's an actor or an enemy then the appropriate database entry for any notetags and so on...like I said, might be easier to change the reason for needing them.

But you can try this, see if it does what you want.
Code:
Game_BattlerBase.prototype.deathStateId = function()
{
    if (typeof this == Game_Actor && this.actor().meta.deathid)
        return Number(this.actor().meta.deathid);
    else if (typeof this == Game_Enemy and this.enemy().meta.deathid)
        return Number(this.enemy().meta.deathid);
    return 1;
};
You'd put the notetag <deathid:x> into an actor or enemy. See what works and what doesn't.

Basically, I'm putting a timer on the player death state. They will get back up in 3 turns. I don't want that to happen to the enemy.

Other enemies may have other unique death states where they may rise back as well on different timers.
Tried your script:

Script gives an error about the word "and". It crashed the game upon booting so i changed it to "&&"

That allowed the game to load. Gave the enemy <deathid: 16>

reported this error:
1725158936816.png


EDIT: Since this code doesn't work, I decide to go about it another way.

This requires Visustella battle core and Theo Meta tags.

Tag the actors notebox with this: <Player>

The tag the death state with this:

Code:
JS On Add State>
  this._deathCounter = 0;
</JS On Add State>
<JS Pre-End Turn>
if (user.meta.player) {
  this._deathCounter++;
}
if (this._deathCounter == 3) {
  user.removeState(1);
}
</JS Pre-End Turn>

Change the death counter to whatever you want.
This thread is closed due to being marked as solved. If you need it reopened, report it to let us know. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/unique-death-states-for-actors-and-enemies.171573/