State Remove when that Character Attacks

So I have a state for the Rogue class called Hiding. I also have a formula that checks if the character is hiding and does double damage if they are or normal damage if they aren't (thanks to a user whose name I can't remember but deserves lots of thanks for supplying that formula).
The thing is, I would like this to be like a normal RPG where if the thief/rogue attacks they are no longer Hiding.
I can't for the life of me figure this one out. I thought about having the Skill remove the status but that would remove the status from the target, the way Skills are done you can't target an enemy and the user....
I am thinking that I could have a Common Event triggered by the Skill that removes the Hiding State from that Actor but I haven't tried this yet.
Anyone know offhand if that would work?
Write your damage formula to something like this:
Code:
a.removeState( whateverIDisYourHidingStatus ); (damage formula here)
The semicolon is important, and 'removeState' is case sensitive. Also important the removeState function needs to come before and not after your damage formula or else the game will think your removeState thing is your damage formula

EDIT: Actually this might not work because the hiding status would be removed before the damage is calculated. You might need one of YEP's plugins but they charge money nowadays...

EDIT 2: This will work. Just tested it in my own project. this will remove the state after damage calculation and without needing any plugins

Code:
(damage formula here) + (a.removeState( whateverIDisYourHidingStatus )?0:0)
Very COOL!!!
Thanks!!! I appreciate that...wasn't sure if i did this as a common event if the event would happen first or the dmg formula so glad this works! 🙂
@BlueEyedDragon Common events would happen after the damage formula but I tend to avoid it since it tends to hiccup the game flow when the game thinks it's running a cutscene, even if that cutscene is empty. Also common events don't automatically remember who the user and target is when a skill is used so it would have been a dead end unless you're versed in javascript anyway
a.isStateAffected(X) ? Formula A : Formula B; a.removeState(X)

edit: i have a similar thing but made very differently using plugin in mv thats a state remove through notetag condition when ANY skill is used that causes damage

Original thread: https://forums.rpgmakerweb.com/threads/state-remove-when-that-character-attacks.126709/