MP 0 death I need help

Hi everyone, I am trying to to a system that, when a battler reaches 0 MP, the battler dies.
I am trying everything I know (I know very little about programming...), and I have a problem.
If I use a script in the core of the game, the game crashes when I am in game and try to load or start another new game. It is because of an incompatibility with visustella plugin skill states core (for some reason I don't know about).
The coding is the following:

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

So, this doesn't work.
Can someone please help me?
I think I am missing something pretty common.
It should work. If you're getting a crash, you need to actually give us that information.

Press F8, go to the Console tab, and provide a screenshot of the error trace there.

Also, how are you adding this? You say "in the core of the game," but you should never edit the core scripts directly. You should have that code in a .js file that you've installed as a plugin.
It should work. If you're getting a crash, you need to actually give us that information.

Press F8, go to the Console tab, and provide a screenshot of the error trace there.

Also, how are you adding this? You say "in the core of the game," but you should never edit the core scripts directly. You should have that code in a .js file that you've installed as a plugin.

Oh, yeah, the error is this:
That doesn't appear to have anything to do with your code.

It's saying there's code that creates an infinite loop, looks like when reading a passive state JS notetag.
That doesn't appear to have anything to do with your code.

It's saying there's code that creates an infinite loop, looks like when reading a passive state JS notetag.
But I have no pasive states nor JS notetags...
Then have you done basic troubleshooting? What happens when you turn those plugins off?
Then have you done basic troubleshooting? What happens when you turn those plugins off?
Yes, the only plugin that does the crash is the SkillsStatesCore.
Yes, the only plugin that does the crash is the SkillsStatesCore.
double check your notetags just incase. i took your plugin and dropped it directly into the VS sample project with all of its plugins enabled. there was no issue starting a game and killing an actor by dropping their MP
double check your notetags just incase. i took your plugin and dropped it directly into the VS sample project with all of its plugins enabled. there was no issue starting a game and killing an actor by dropping their MP
No, the script works. The problem is that you cannot load nor start a new game again.
The problem is that you cannot load nor start a new game again.
i did say i started a game, and i would have needed to in order to kill an actor.
I went back to save and load the file and then tried to load another inside of one. there was no issue there either.

do you still get the crash when you put the plugin into the sample project? if not, then its something somewhere in your game that is misconfigured and youll have to check your database entries + plugin parameters
i did say i started a game, and i would have needed to in order to kill an actor.
I went back to save and load the file and then tried to load another inside of one. there was no issue there either.

do you still get the crash when you put the plugin into the sample project? if not, then its something somewhere in your game that is misconfigured and youll have to check your database entries + plugin parameters
I did what you said and still have the error. I don't know what to do.
The thing is that the error starts in battle, but doesn't crash the game.
I've just aknowledged that from the console.
as the error said, there is a loop in your skill that constantly repeat and
doesn't break.

make sure the plugin is in the correct order, so double check this on
the plugin help that it is placed correctly.

check skills if you have any notetags there or turn that plugin off to
see if it works.

if it works, double check the parameters that you don't made a mistake
somewhere.
make sure the plugin is in the correct order, so double check this on
the plugin help that it is placed correctly.
Continuing off of this. It may be helpful to post a screenshot of your plugin manager. Both your main project and the sample project just to be safe. In the case of the sample one, it worked for me both as the first and the last plugin in the list, but i didnt try anywhere else
Continuing off of this. It may be helpful to post a screenshot of your plugin manager. Both your main project and the sample project just to be safe. In the case of the sample one, it worked for me both as the first and the last plugin in the list, but i didnt try anywhere else
This is my plugin list.
Apparently, the error starts with the character creation, so I am debbuging it... but I find no bugs in there. I am going really crazy.

Original thread: https://forums.rpgmakerweb.com/threads/mp-0-death-i-need-help.171965/