You can call this function:
-
Custom script: call BlzPauseUnitEx(udg_DamageEventTarget, true)
As many times as you want. You just need to make sure that you undo it the same number of times:
-
Custom script: call BlzPauseUnitEx(udg_AR_Unit, false)
The logic is pretty straightforward, a unit has 0 stun counters by default and isn't considered stunned. Calling this function as
true will +1 this counter, check if it's equal to 1, and stun the unit if so. Calling this function as
false will -1 this counter, check if it's now equal to 0, and unstun the unit if so.
You could make a unit "stun immune" by making sure this counter is always < 0 which is pretty neat. Or, if you're not careful, you can permanently stun a unit if you increase the counter above 0 and fail to subtract it back down again.
Your trigger looks good though, AR_Counter serves useful as a way to Add/Remove the "buff" ability and prevent the function from stacking.
Here's the same trigger after I cleaned some things up:
-
Bash
-

Events
-


Game - DamageEvent becomes Equal to 1.00
-

Conditions
-


IsDamageAttack Equal to True
-


(DamageEventTarget belongs to an enemy of (Owner of DamageEventSource).) Equal to True
-


(DamageEventTarget is A structure) Equal to False
-


(DamageEventSource is A Hero) Equal to True
-

Actions
-


Custom script: local unit udg_AR_Unit = udg_DamageEventTarget
-


Set VariableSet CV = (Custom value of udg_AR_Unit)
-


Set VariableSet AR_Counter[CV] = (AR_Counter[CV] + 1)
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




AR_Counter[CV] Equal to 1
-



Then - Actions
-




Custom script: call BlzPauseUnitEx(udg_AR_Unit, true)
-




Unit - Add Stunned (buff) to udg_AR_Unit
-



Else - Actions
-


Wait 1.00 second game-time
-


Set VariableSet CV = (Custom value of AR_Unit)
-


Set VariableSet AR_Counter[CV] = (AR_Counter[CV] - 1)
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




AR_Counter[CV] Equal to 0
-



Then - Actions
-




Custom script: call BlzPauseUnitEx(udg_AR_Unit, false)
-




Unit - Remove Stunned (buff) from AR_Unit
-



Else - Actions
-


Custom script: set udg_AR_Unit = null
I don't love the usage of Waits but if you don't care then whatever.
Also, I assume you'll have some Condition to check if the (Damage source) actually has the Bash ability.