Moderator
M
Moderator
11:11, 10th Jun 2010
TriggerHappy:
Leakless & MUI.
TriggerHappy:
Leakless & MUI.
Repel Cast

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to Repel

Actions


-------- Sets the Caster --------


Set Caster = (Triggering unit)


-------- Creates a location for Dummy Unit spawning --------


Set Points[1] = (Position of Caster)


-------- Saves the AoE at which enemies are detected to knockback --------


Set Real[1] = (100.00 + (100.00 x (Real((Level of Repel for Caster)))))


-------- Creates a dummy unit and Stores caster and Detection Range --------


Unit - Create 1 Dummy Unit for (Owner of Caster) at Points[1] facing Default building facing degrees


Hashtable - Save Real[1] as 0 of (Key (Last created unit)) in Hashtable


Hashtable - Save Handle OfCaster as 1 of (Key (Last created unit)) in Hashtable


-------- Checks if there is any instance of this spell in effect --------


-------- If not, turns the Effect trigger on --------


If ((DummyGroup is empty) Equal to True) then do (Trigger - Turn on Repel Effect <gen>) else do (Do nothing)


-------- Adds dummy unit to Dummy Units' group --------


Unit Group - Add (Last created unit) to DummyGroup


-------- Clears Leak --------


Custom script: call RemoveLocation(udg_Points[1])
Repel Effect

Events


Time - Every 0.03 seconds of game time

Conditions

Actions


-------- Every 0.03 seconds of the game --------


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



Loop - Actions




-------- Loads the Knockback detection range and Caster --------




Set Real[1] = (Load 0 of (Key (Picked unit)) from Hashtable)




Set Caster = (Load 1 of (Key (Picked unit)) in Hashtable)




-------- Creates a location for knockbacking offset --------




Set Points[1] = (Position of Caster)




-------- Finds all enemies to knockback --------




-------- NOTE 1 : Finds all visible organic enemies that are not magic immune --------




Set Enemies = (Units within Real[1] of Points[1] matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is Mechanical) Not equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and ((((Matching unit) is dead) Not equal to




-------- Does knockbacking --------




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





Loop - Actions






-------- Finds Enemy's location and a place at which it will be knockbacked --------






Set Points[2] = (Position of (Picked unit))






Set Points[3] = (Points[2] offset by 45.00 towards (Angle from Points[1] to Points[2]) degrees)






-------- Moves (Knockbacks) the enemy --------






Unit - Move (Picked unit) instantly to Points[3]






-------- Creates an Rocky explosion on target --------






Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl






-------- Clears leaks --------






Special Effect - Destroy (Last created special effect)






Custom script: call RemoveLocation(udg_Points[2])






Custom script: call RemoveLocation(udg_Points[3])




-------- NOTE 2 : This spell is based on Windwalk, so it won't interupt current action --------




-------- NOTE 3 : You don't get invisible because the transition time is much longer than duration --------




-------- NOTE 4 : Repel IS dispellable --------




-------- If the caster isn't alive or the Buff of the Repel is gone... --------




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





If - Conditions






(Caster is alive) Equal to True






(Caster has buff Repel ) Equal to True





Then - Actions





Else - Actions






-------- Rids the Hashtable of the unnecessary information stored inside the dummy unit --------






Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable






-------- Removes Dummy unit for Dummy Group --------






Unit Group - Remove (Picked unit) from DummyGroup






-------- Removes Dummy unit from Game --------






Unit - Remove (Picked unit) from the game




-------- Clears the Leaks --------




Custom script: call RemoveLocation(udg_Points[1])




Custom script: call DestroyGroup(udg_Enemies)


-------- Checks if there is any instance of this spell left after loop --------


-------- If not, turns this trigger off --------


If ((DummyGroup is empty) Equal to True) then do (Trigger - Turn off (This trigger)) else do (Do nothing)