Help with state removal

Hey guys, sorry if this is in the wrong spot, made an account just to ask this.

This is for RPG MV
Anyway im having some issues with a skill ive made. Its for a fencer class, the skill is called riposte, ive made it so that the skill adds a state, the state gives the player a 100% counterattack rate, problem is, i want the state to be removed if the character is attacked, but since they dont take damage during counterattack, i cant use the remove on taking damage restriction. can anybody help me? if i cant do it just using the default program which plugins should i use, Cheers guys
You can use Yanfly's action sequences to do something like this. You'd put this in note of the skill the enemy is using on your actor:


<follow action>


if target.isStateAffected(x)     (x= the number of the state that causes the counterattack)


remove state x: target


end


</follow action>


This should remove the counterattack state after the enemy has been counterattacked.
I tried putting this in, the counterattack state is number 11, i put in this code


<follow action>


if target.isStateAffected(11)


remove state 11: target


end


</follow action>


it dint seem to make a difference (I put it in the attack skill)
there should be something that alter the damage in that code.... like


<follow action>


if target.isStateAffected(11)


skill damage = 0  <<<<< something of this sort????


remove state 11: target


end


</follow action>


i dont have much experience but if the code would work as you need it to that what it should look like ??
Its all good, got it working, i just forgot to install action sequence pack 1. its all working now. Only problem is, if the counter attack kills an enemy, it plays the death sound effect twice

Original thread: https://forums.rpgmakerweb.com/threads/help-with-state-removal.58564/