MZ Having two states cancel each other out using Visustella plugins.

Is there a way to do this?

Example: if I buff myself with an attack up and the enemy debuffs me with an attack down it should remove the buff and debuff and cancel each other out?

I have all of the Visustella MZ plugins.
I just want to clarify some of your terminology.

In RPG Maker, "buff" and "debuff" are their own specific things, and are not states. They work exactly the way you describe - if you target a battler with a skill that adds an Atk buff then with an Atk debuff, it's canceled out. Buffs and debuffs can continue going back and forth stacking up to a total buff or debuff amount of 2.

Does that answer your question, or do you still have something you want to do with states?
sorry it wasn't clear enough, I'm using states to buff and debuff my characters so that I can buff and debuff EX parameters like evasion and critical rates.
Okay. I understand you're using states, but it would be easier for you if you stopped using the words buff and debuff for it because that's why I had to ask for the clarification in the first place 🤣 Those mean something in RPG Maker different from what you're talking about.

In your states, just give them a notetag:
Code:
<JS On Add State>
if (target.isStateAffected(X))
    target.removeState(X);
</JS On Add State>

where X is the ID of the state you want to cancel (no leading zeros). If it should cancel more than one state, copy the two lines of code and paste them as many times as necessary with the various IDs.
Thanks! It worked.

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/having-two-states-cancel-each-other-out-using-visustella-plugins.156557/