- Joined
- Nov 3, 2013
- Messages
- 989
While creating a Parry + Counter attack type ability (haven't seen any besides retaliation types in wc3 btw) I didn't think about that I couldn't use unit handle as index so I made a global unit group and thought I'd just save and then load a boolean in the unit group loop instead. For some reason it doesn't work though.
-
Riposte init
-

Events
-


Time - Elapsed game time is 0.00 seconds
-
-

Conditions
-

Actions
-


Set u = Riposter 0000 <gen>
-


Custom script: call SaveBoolean(udg_hash, GetHandleId(udg_u), 0, true)
-
-
-
Riposte 1
-

Events
-


Unit - A unit Is attacked
-
-

Conditions
-

Actions
-


Custom script: local unit udg_u = GetTriggerUnit()
-


Custom script: local unit udg_a = GetAttacker()
-


Custom script: local player udg_p = GetTriggerPlayer()
-


Custom script: local integer udg_id_u = GetHandleId(udg_u)
-


Custom script: local integer udg_id_a = GetHandleId(udg_a)
-


-------- attacked unit has Riptose ability --------
-


Custom script: if LoadBoolean(udg_hash, udg_id_u, 0) then
-


-------- have Riptose ability --------
-


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



If - Conditions
-




(a is in riposte_unitGroup) Not equal to True
-
-



Then - Actions
-




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





If - Conditions
-






(Number of units in riposte_unitGroup) Equal to 0
-
-





Then - Actions
-






Unit - Create 1 Being Attacked (Riposte Dummy Unit) for p at (Center of (Playable map area)) facing Default building facing degrees
-






Custom script: call SaveUnitHandle(udg_hash, udg_id_u, 1, GetLastCreatedUnit())
-
-





Else - Actions
-
-




Unit Group - Add a to riposte_unitGroup
-




Custom script: call SaveBoolean(udg_hash, udg_id_u, udg_id_a, true)
-




Unit - Add Riposte Target (Buff Placer) to a
-
-



Else - Actions
-
-


Custom script: else
-


-------- does not have Riptose ability --------
-


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



If - Conditions
-




(a is in riposte_unitGroup) Equal to True
-
-



Then - Actions
-




Unit Group - Remove a from riposte_unitGroup
-
-



Else - Actions
-
-


Custom script: endif
-
-
-
Riposte 2
-

Events
-


Game - damageEventTrigger becomes Equal to 1.00
-
-

Conditions
-

Actions
-


Custom script: local unit udg_u = udg_target
-


Custom script: local unit udg_a = udg_source
-


Custom script: local integer udg_id_u = GetHandleId(udg_u)
-


Custom script: local integer udg_id_a = GetHandleId(udg_a)
-


Custom script: local player udg_p = GetOwningPlayer(udg_u)
-


Custom script: if LoadBoolean(udg_hash, udg_id_u, 0) then
-


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



If - Conditions
-




damageType Equal to PHYSICAL
-
-



Then - Actions
-




Unit Group - Remove a from riposte_unitGroup
-




Custom script: call SaveBoolean(udg_hash, udg_id_u, udg_id_a, false)
-




Unit - Remove Riposte Target (Buff Placer) from a
-




Unit - Remove Riposte Target (Slow Aura) buff from a
-




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





If - Conditions
-






(Number of units in riposte_unitGroup) Equal to 0
-
-





Then - Actions
-






Custom script: call RemoveUnit(LoadUnitHandle(udg_hash, udg_id_u, 1))
-
-





Else - Actions
-
-
-



Else - Actions
-
-


Custom script: else
-


Custom script: endif
-
-
-
Riposte 3
-

Events
-


Unit - A unit Begins casting an ability
-
-

Conditions
-


(Ability being cast) Equal to Riposte (retaliate)
-
-

Actions
-


Custom script: local player udg_p = GetTriggerPlayer()
-


Custom script: local unit udg_u = GetTriggerUnit()
-


Custom script: local unit udg_a
-


Custom script: local integer udg_id_u = GetHandleId(udg_u)
-


Custom script: local integer udg_id_a
-


Game - Display to (All players) the text: start
-


Unit Group - Pick every unit in riposte_unitGroup and do (Actions)
-



Loop - Actions
-




Custom script: set udg_a = GetEnumUnit()
-




Custom script: set udg_id_a = GetHandleId(udg_a)
-




Custom script: call DisplayTextToForce( GetPlayersAll(), ( GetUnitName(udg_a) + GetUnitName(udg_u) ))
-




Custom script: if LoadBoolean(udg_hash, udg_id_u, udg_id_a) then
-




Game - Display to (All players) the text: true
-




Unit - Cause u to damage a, dealing 150.00 damage of attack type Spells and damage type Normal
-




Custom script: else
-




Custom script: endif
-
-
-
-
