In the character me and a friend we're working on, he introduced a counter detection system which works fine, except for one thing:
Here's the code:
[State -2, VarSet];Checks if opponent is in attack state
type = VarSet
triggerall = numenemy
trigger1 = enemy, movetype = A
;trigger2 = name = "SanaeInHerPeriod"
var(44) = 1
ignorehitpause = 1
[State -2, VarSet];This resets the condition if counter not succesful and succesful
type = VarSet
;triggerall = name != "SanaeInHerPeriod"
triggerall = numenemy
trigger1 = enemy, movetype = I || var(45) >= 1 ;Enemy is Idle | Counter was Succesful
trigger2 = var(45) > 10 && enemy, movetype = H ;10 ticks passed & enemy is on gethit state
var(44) = 0
ignorehitpause = 1
[State -2, VarSet];Counter Hit Succesful
type = VarSet
trigger1 = var(44) = 1 && movehit ;Counter Check Ok, Move Hit Succesfully.
trigger1 = stateno != [190,199] ;Does not activate during intros.
trigger1 = stateno != [800,899] ;Does not activate during throws.
trigger1 = stateno != [1605,1606]
trigger1 = stateno != [4000,4999]
trigger2 = var(44) = 1 && projhit = 1 ;Counter Check Ok, Projectile Hit Succesfully.
var(45) = 1
ignorehitpause = 1
[State -2, VarAdd];Counter Hit Timer
type = VarAdd
trigger1 = var(45) >= 1 ;Counter was succesful
var(45) = 1
ignorehitpause = 1
[State -2, VarSet];Counter Hit Reset
type = VarSet
trigger1 = var(45) >= 22 && movehit ;Reset if 22 ticks passed and move hit
trigger2 = p2movetype != H ;Reset if P2 is no longer in gethit state
trigger3 = movetype = H ;Reset if P1 is getting hit
trigger4 = var(45) >= 22 && projhit = 1 ;Reset if 22 ticks passed and projectile hit
var(45) = 0
ignorehitpause = 1
[State -2, Counterhit Explod]
type = Helper;Explod
triggerall = stateno != [800,899] ;Does not activate during throws.
triggerall = stateno != [950,951] ;Don't activate during throws.
triggerall = stateno != [1605,1606]
triggerall = stateno != [4000,4999]
triggerall = !enemynear,movereversed
triggerall = var(44) = 1; && name != "SanaeInHerPeriod"
triggerall = enemy,movetype = H ;Enemy was indeed HIT, otherwise this'd be retarded.
;triggerall = NumHelper(22000) = 0;numexplod(980)+numexplod(981)=0
trigger1 = movehit ;Move hits
trigger2 = projhit = 1 ;Projectile Hits
helpertype = normal
name = "Counter Suwako Kanako"
ID = 22000
stateno = 22000
pos = 0,0
postype = p1
facing = 1
keyctrl = 0
ownpal = 1
supermovetime = 99999999
pausemovetime = 99999999
ignorehitpause = 1
Here's the Issue (I did not take the screenshots in order but the issue is present in that order):
P2 does an attack

Throwing P2 during his attack

Hitting P2 after the throw before he hits the ground (it allows comboing after it) after the throw and BAM there goes the counter hit.

Keep in mind, these counter detections are used for counterbuffs too, so I need this system to work perfectly to not reward counterbuffs when it shouldn't.