Help with a custom passive state

Hello everyone,

So to make this short, I have a state called "emergency reservoires" that basically checks your MP at the end of the turn, and if your MP are below a certain threshold (in my case 10%), you automatically regain 30% of your max. MP and the state is removed after resolving.

Now I am not very good with these custom state effects and would love if anyone with some spare time could help me out.
Thanks.
How are you getting the passive state to work? A plugin?
Ah yes, that would most likely be YEP_BuffsStatesCore.
Buff and state core doesn’t do passives. Yep passive states does, but so do a few other plugins
👋 Try copy + pasting this into your state's notebox:
Code:
<Custom Turn End Effect>
if (user.mpRate() < 0.1) {
  var gain = Math.floor(user.mmp * 0.3);
  user.gainMp(gain);
  user.removeState(stateId);
}
</Custom Turn End Effect>
Ah yes, that would most likely be YEP_BuffsStatesCore.

My apologies. I think I've been looking at screens too long and I didn't even realize what I'm reading...

Hopefully what @caethyril suggested does the trick.
@HumanNinjaToo No worries, my brain goofes me all the time aswell

@caethyril
Thank you very much! It works exactly as I want it to. I'll remember to credit you in my project.
Just a little thing; is it possible to also play an animation on the character with the state when the state is resolved?
Thank you very much! It works exactly as I want it to. I'll remember to credit you in my project.
Just a little thing; is it possible to also play an animation on the character with the state when the state is resolved?
Great! You can tell it to play an animation like this (replace 123 with the ID of the animation):
JavaScript:
  user.startAnimation(123);
Then just add that line somewhere inside the notetag's if block. 🙂
@caethyril

Excellent!
Thank you very much, friend! 😂

Original thread: https://forums.rpgmakerweb.com/threads/help-with-a-custom-passive-state.123143/