MZ State removal upon reaching 0 MP

Hello!
I'm making a Sonic RPG and I'm trying to code a Super Sonic transformation, and I've already got it so that the transformation changes the actor's images and such, but now I'm trying to get it so that the transformation is removed once the user reaches 0 MP.
I'm using states for the stats of the transformations and common events for the image changing.
I have almost all of the VisuStella plugins, so I can use those to my full disposal
If anyone could help, I would greatly appreciate it!
Moved to: Plugin Support
Hello!
I'm making a Sonic RPG and I'm trying to code a Super Sonic transformation, and I've already got it so that the transformation changes the actor's images and such, but now I'm trying to get it so that the transformation is removed once the user reaches 0 MP.
I'm using states for the stats of the transformations and common events for the image changing.
I have almost all of the VisuStella plugins, so I can use those to my full disposal
If anyone could help, I would greatly appreciate it!
I dont use MZ, but a quick glance at the battle core tells me this should probably work for you

JavaScript:
<JS Post-End Turn>
if (user.mp==0){
 user.removeState(stateId);
}
</JS Post-End Turn>
Thank you so much! I will happily use this for my game!

Original thread: https://forums.rpgmakerweb.com/threads/state-removal-upon-reaching-0-mp.157653/