Setting a passive state

Hi guys!, i'm having a small problem setting a passive state to an actor, basically what i wanna do is that whenever actor Q gets damaged in battle and his hp drops below 50% state (3) will be applied to himself (a hp regen for this case) BUT it can only be triggered once per battle

i tried a bunch of scripts and common events in order to do so but i failed misserably countless times, help would be reeeeally apreciated ):

(dunno if this should be here or in script requests)
Have a common event that runs every turn, that checks for the %HP of the actor. Make a conditional branch that only activates if a switch is OFF, then under that a branch that if the actor is below 50% HP. If the condition is met, it adds the state to the character and turns the switch ON.

Outside of battle, have a parallel event run only if the switch is turned ON, and make that event turn the switch OFF again.
You can try Yanflys lunatic states
umm how do i make a common event that runs (a the end of) every turn? i tried making one that stores actor Q hp in a variable and compares it to his max.hp (also stored in a variable then divided by 2), so far i tried something like this: http://prntscr.com/8rbe2v, tried making it work with yan's lunatic states and Hime's state common events so the notebox of the state looks like this:
 

<close effect><add common event: 5> </close effect>all i get in battle are null popups (which still deal damage) from the enemies and regen not triggering

Original thread: https://forums.rpgmakerweb.com/threads/setting-a-passive-state.45892/