Negating states?

Back in VX, it was possible to remove a state by adding another, and yet the first state was not added either.

Example: Battler with "Attack up" state, actor casts a skill/uses a normal attack/consumes an item/whatever that applies "Attack up" on hit, if this happens, the battles gets rid of both "Attack up" and "Attack down". This can happen backwards too.

This is a feature I'd like to add to my project. Is there a way to do this? Is there a script? I found some but they don't seem to work.
It's possible to achieve that without additional scripts, but it's probably a bit more complex.

One way to do it would be for example:

1.) Make both states resist each other

2.) Whenever you apply "Attack up", remove "Attack down" afterwards (and vice versa).

When you try up to "Attack up" a target that is inflicted with "Attack down", adding the new state will fail since the target is immune to it. However, the second effect will remove the "Attack down" state instead.

Original thread: https://forums.rpgmakerweb.com/threads/negating-states.44463/