Help with counter attack state?

I've created a skill for my warrior class that allows him to apply a counter attack state on himself. The effects of the state are a buff in defense and a 100% counter attack rate for 1 turn. The problem is that sometimes, when he casts the spell, he instantly counter attacks himself. Anyone knows how to solve this?
By default (no plugins) counter-attack only procs for actions of Physical Hit type. Try making your buff skill Magical Hit or Certain Hit instead.
You're right! The skill was a physical hit, I changed it to certain hit and the problem is solved. Thanks!

Original thread: https://forums.rpgmakerweb.com/threads/help-with-counter-attack-state.130326/