Moderator
M
Moderator
23:36, 17th Oct 2010
TriggerHappy:
Leakless, MUI, and useful.
TriggerHappy:
Leakless, MUI, and useful.
Whirlwind Cast

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to Whirlwind

Actions


-------- Stores Caster into variable --------


Set Caster = (Triggering unit)


-------- Finds caster's location and target point --------


Set Points[1] = (Position of Caster)


Set Points[2] = (Target point of ability being cast)


-------- Fixes out of map bugg --------


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



If - Conditions




(Terrain pathing at Points[2] of type Walkability is off) Equal to True



Then - Actions




Item - Create Tome of Experience at Points[2]




Custom script: call RemoveLocation(udg_Points[2])




Set Points[2] = (Position of (Last created item))




Item - Remove (Last created item)



Else - Actions


-------- Counts speed of the Caster --------


-------- NOTE 1: Change your speed. That speed must be multiplied by Sliding trigger's loop interval --------


Set Real[1] = ((240.00 + (40.00 x (Real((Level of Whirlwind for Caster))))) x 0.03)


-------- Counts distance-to-slide --------


Set Real[2] = (Distance between Points[1] and Points[2])


-------- Counts angle between caster and target point --------


Set Real[3] = (Angle from Points[1] to Points[2])


-------- Counts damage interval --------


-------- NOTE 2: Change your damage interval here. If the Interval is below 0.03, then it will cut once per 0.03 (Sliding trigger's interval) --------


Set Real[4] = (2.00 - (0.03 x (Real((Agility of Caster (Include bonuses))))))


-------- Counts the coefficients of strength for damage and counts Min and Max damage --------


-------- NOTE 3: Count your damage here --------


Set Real[5] = (0.75 + (0.50 x (Real((Level of Whirlwind for Caster)))))


Set Real[6] = (1.25 + (0.50 x (Real((Level of Whirlwind for Caster)))))


Set Real[5] = (Real[5] x (Real((Strength of Caster (Include bonuses)))))


Set Real[6] = (Real[6] x (Real((Strength of Caster (Include bonuses)))))


-------- Pauses caster --------


Unit - Pause Caster


-------- Turns Caster's collision off --------


Unit - Turn collision for Caster Off


-------- Stores all information into Hashtable --------


-------- NOTE 4: All information is attached to Caster, so be careful with coding your spells --------


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


Hashtable - Save Real[2] as 1 of (Key (Triggering unit)) in Hashtable


Hashtable - Save Real[3] as 2 of (Key (Triggering unit)) in Hashtable


Hashtable - Save Real[4] as 3 of (Key (Triggering unit)) in Hashtable


Hashtable - Save Real[5] as 4 of (Key (Triggering unit)) in Hashtable


Hashtable - Save Real[6] as 5 of (Key (Triggering unit)) in Hashtable


Hashtable - Save Real[4] as 7 of (Key (Triggering unit)) in Hashtable


-------- Checks if there is any instance of spell already running ingame --------


-------- If not, turns sliding trigger on --------


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



If - Conditions




(Whirlwinds is empty) Equal to True



Then - Actions




Trigger - Turn on Whirlwind Slide <gen>



Else - Actions


-------- Adds caster to Casters' group --------


Unit Group - Add (Triggering unit) to Whirlwinds


-------- Fixes the leaks --------


Custom script: call RemoveLocation(udg_Points[1])


Custom script: call RemoveLocation(udg_Points[2])
Whirlwind Slide

Events


Time - Every 0.03 seconds of game time

Conditions

Actions


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



Loop - Actions




-------- Stores caster into variable, purely for faster code writing --------




Set Caster = (Picked unit)




-------- Checks if Caster is dead --------




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





If - Conditions






(Caster is alive) Equal to True





Then - Actions






-------- If it Isn't, then... --------






-------- Loads speed of Caster --------






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






-------- Loads distance-to-slide and reduces it by speed --------






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






Set Real[2] = (Real[2] - Real[1])






-------- Loads angle towards which the Caster will fly --------






Set Real[3] = (Load 2 of (Key (Picked unit)) from Hashtable)






-------- Finds caster's location and counts point to which caster would be moved --------






Set Points[1] = (Position of Caster)






Set Points[2] = (Points[1] offset by Real[1] towards Real[3] degrees)






-------- Loads timer of damaging and reduces it by 0.03 (trigger's loop interval) --------






Set Real[4] = (Load 3 of (Key (Picked unit)) from Hashtable)






Set Real[4] = (Real[4] - 0.03)






-------- Checks if it is time to do the damage --------






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







If - Conditions








Real[4] Less than or equal to 0.00







Then - Actions








-------- If it is, then... --------








-------- Enumerates possible targets --------








-------- NOTE 2: Enumerates all live enemy units that are not ethereal --------








Set Enemies = (Units within 280.00 of Points[2] matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is Ethereal) Not equal to True) and ((((Matching unit) is dead) Not equal to True) and (((Matching unit) belongs to an enemy of (Owner of C








-------- Loads Min and Max damage --------








Set Real[5] = (Load 4 of (Key (Picked unit)) from Hashtable)








Set Real[6] = (Load 5 of (Key (Picked unit)) from Hashtable)








-------- Does the damaging --------








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









Loop - Actions










Unit - Cause Caster to damage (Picked unit), dealing (Random real number between Real[5] and Real[6]) damage of attack type Spells and damage type Normal










Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl










Special Effect - Destroy (Last created special effect)








-------- Fixes the leak --------








Custom script: call DestroyGroup(udg_Enemies)








-------- Resets timer --------








Set Real[4] = (Load 7 of (Key (Picked unit)) from Hashtable)







Else - Actions






-------- Updates timer for next damage tick --------






Hashtable - Save Real[4] as 3 of (Key (Picked unit)) in Hashtable






-------- Moves the Caster --------






Unit - Move Caster instantly to Points[2]






-------- Plays Caster's spin animation --------






-------- NOTE 3: Only models which have Attack Walk Spin thing animation will actually spin --------






-------- Only 4 original Warcraft III models have this animation --------






Animation - Play Caster's spin animation






-------- Destroys trees --------






Destructible - Pick every destructible within 128.00 of Points[2] and do (Destructible - Kill (Picked destructible))






-------- Checks if it isn't time for caster to stop --------






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







If - Conditions








Real[2] Less than or equal to 0.00







Then - Actions








-------- If it is, then... --------








-------- Unpauses the Caster --------








Unit - Unpause Caster








-------- Turns Caster's collision on --------








Unit - Turn collision for Caster On








-------- Resets Caster's animation --------








Animation - Reset Caster's animation








-------- Clears the Hashtable --------








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








-------- Removes Caster from Casters' group --------








Unit Group - Remove (Picked unit) from Whirlwinds







Else - Actions








-------- If it isn't then updates distance-to-slide left --------








Hashtable - Save Real[2] as 1 of (Key (Picked unit)) in Hashtable






-------- Fixes the leaks --------






Custom script: call RemoveLocation(udg_Points[1])






Custom script: call RemoveLocation(udg_Points[2])





Else - Actions






-------- If it is, then... --------






-------- Unpauses the Caster --------






Unit - Unpause Caster






-------- Turns Caster's collision on --------






Unit - Turn collision for Caster On






-------- Resets Caster's animation --------






Animation - Reset Caster's animation






-------- Clears the Hashtable --------






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






-------- Removes Caster from Casters' group --------






Unit Group - Remove (Picked unit) from Whirlwinds


-------- Checks if there is any insance of spell left ingame after loop --------


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


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



If - Conditions




(Whirlwinds is empty) Equal to True



Then - Actions




Trigger - Turn off (This trigger)



Else - Actions