Event or state when MP reaches 0

Correct me if I am wrong, but if any actor or enemy's HP reach 0, state 1 (Dead) is applied. This is hard-coded in to the Javascript that runs the game.

Is there any way to do something similar if MP (or TP) reach 0? What's the most efficient way to do this--is there a way to check in every battle? (Would it have to be manually inserted into every Troop so it gets checked each time?)
You can do this by eventing: use control variable : game data to get the values you want and then check them with conditional branch.
And there are several plugins that provide a base-troop functionality, which means you define a specific troop as the base and all troop events from there are automatically added to all other troops.

That said, this is one of those functionalities where it might be easier to have a plugin handle that, but unfortunately I don't know of any plugin that can do this.
@geek42 A basic plugin to do that would be:

JavaScript:
(() => {
const refresh = Game_Battler.prototype.refresh;
Game_Battler.prototype.refresh = function() {
    refresh.apply(this);
    if (this.mp === 0) {
        this.addState(10); // add a state to the battler
    } else {
        this.removeState(10);
    }
};
})();

This is handled the same way that the game handles applying the death state at zero HP. The real question would probably be what do you want to do, exactly? The above code could be installed as a plugin to apply state 10 at zero MP.

I'm not sure if calling an event would be a good idea, since multiple actors could be reduced to zero MP simultaneously.
I'm a newbie so I am trying to avoid plugins (I figure I should understand the base system fully before trying to mess around with it), but thank you so much for coding this out! It will be very useful for the next person trying to do the same thing or if I ever work my courage up. 😉
I'm a newbie so I am trying to avoid plugins (I figure I should understand the base system fully before trying to mess around with it), but thank you so much for coding this out! It will be very useful for the next person trying to do the same thing or if I ever work my courage up. 😉
Some things just can't be done without a plugin, or require a really convoluted series of eventing to try to accomplish with the built in functions in the engine.

Original thread: https://forums.rpgmakerweb.com/threads/event-or-state-when-mp-reaches-0.156902/