Counterattack remove

I have a skill that adds a state that gives CNT +100%. I want it so it will counterattack the NEXT incoming physical attack, then is removed. How can this be done? I tried removing on the attack skill of the enemy, but since the CNT is 100%, no attack can land to remove the state.

Is there another way this can be done?
Performing a counterattack triggers a normal attack. You can use that to remove the state. Just put "a.remove_state(#);" at the start of your Attack skill's formula (skill number 1 unless you've modified the game scripts), where # is the ID number of your counterattack state.


For example, if your counterattack state is number 18, your Attack skill's formula might look like this:


a.remove_state(18); a.atk * 4 - b.def * 2


Note that this will only remove the counterattack state if the counterattack hits, so it's not entirely perfect.
I never thought to try this, very smart. Works like a charm. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/counterattack-remove.37185/