Remove State By Parameter

Hi,

I am working on trying to figure out how to remove a current state once a parameter hits a certain number (this case MP stat hits zero) during a battle.  Sorry if this is located elsewhere, i have done some searching on both google and these forums for a similar stance, but nothing has surfaced yet.  So i thought I would go ahead and ask.  Thanks for any and all assistance on this topic!

Rundown:

I have a weapon that when equiped it grants the weilder a new skill for their class. 

When this skill is used during a battle, it activates a state that grants the user a new "skill type," additional "skill" moves in that type, while draining their MP each turn.

What I want is when the user's MP = 0 then remove the active said [state].

My Example:

Making a quick Fairy Tail game based on the anime.  I am going for Lucy's skill which is a summoning magic type ability.  The character would obtain a key which would be equiped allowing for her to "open a  gate/summon another character." After fatigue hits then she would send the character back.

My terms:

Character Skill Type: Celestial Gate

summon taurus.PNG

Skill: "Summon Taurus" - Generates a state "Summon Taurus" which grants the new Skill Type "Taurus Gate" with Skills "Rampage, Axe Smash...." and Drains 10% Ex-Param "MRG" per turn.

state.PNG

When activated during battle I am trying to achieve a way to obtain when MP=0 then Remove the "Taurus Gate" Skill Type thus removing all corresponding skills.

I also have another skill that works individually called "Close Gate" - This just removes States "Taurus Gate."

I tried going through and adding this formula to the individual skill, but I am not getting it to work properly and it would seem to only apply if the skill is actually used. (if a.mp=0; a.erase_state(31) ; end ; a.mat * 3) My result after i select and use the skill it sets my MP to zero and then removes the state as i wanted, but i dont want my mp to drop to zero after one use, just after X amount of turns.

I am not too familiar with switches, but i tried to play around with them, but couldn't seem to put together the proper terms so they acted during a battle phase.

I am really not familiar with scripting in rpg maker, but I feel like you should be able to write the conditional statement and refer to the state/skill as a notetag in some manner.

Here's to hoping I understood the rules and posted my first in the correct spot.

Thanks again for any help, it is much appreciated!
I've moved this thread to RGSS3 Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.


Game Mechanics Design is for discussion/theory/feedback, not for "how to". I put this into script requests, but I'm not certain that it can't be done just with events.
Not entirely what i was thinking, but it does solve and could have even more versatility than what i was asking for. 

I put this in the state "Summon Taurus" note... <remove if mp=0>

And applied the "Auto State" script from the forum/links below.

Additional Forum here : Auto States - SOLVED.

Download the demo discussed within the forum here.

Thanks to any one that looked at this post.  Additional thanks to Moon and those that contributed to that other forum.

SOLVED.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/remove-state-by-parameter.26089/