Moderator
M
Moderator
18:59, 12th Jul 2010
TriggerHappy:
Nice effect and the coding was fine.
TriggerHappy:
Nice effect and the coding was fine.
Heroic Leap Cast

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to Heroic Leap

Actions


-------- Stores into variables Caster and Target --------


Set Caster = (Triggering unit)


Set Target = (Target unit of ability being cast)


-------- Finds the Distance between the Caster and Target --------


Set Points[1] = (Position of Caster)


Set Points[2] = (Position of Target)


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


-------- Counts up the range at which the Caster shall start landing --------


Set Real[2] = (Real[1] / 2.00)


-------- Makes Caster invurnerable and turns it's Collision off --------


Unit - Make Caster Invulnerable


Unit - Turn collision for Caster Off


-------- Creates a trail SFX and instantly destroys it, removing leak --------


Special Effect - Create a special effect attached to the chest of Caster using Abilities\Spells\Human\Invisibility\InvisibilityTarget.mdl


Special Effect - Destroy (Last created special effect)


-------- Stores target into Hashtable --------


Hashtable - Save Handle OfTarget as 0 of (Key (Triggering unit)) in Hashtable


-------- Stores the Distance-to-jump and distance at which the Caster shall start landing --------


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


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


-------- NOTE 1: All required information is attached to caster. That's why it was made Invulnerable --------


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


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


If ((Leapers is empty) Equal to True) then do (Trigger - Turn on Heroic Leap Loop <gen>) else do (Do nothing)


-------- Adds the Caster into Leapers' group --------


Unit Group - Add Caster to Leapers


-------- Removes leaks --------


Custom script: call RemoveLocation(udg_Points[1])


Custom script: call RemoveLocation(udg_Points[2])
Heroic Leap Loop

Events


Time - Every 0.04 seconds of game time

Conditions

Actions


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



Loop - Actions




-------- Stores Target and Caster into variables --------




Set Target = (Load 0 of (Key (Picked unit)) in Hashtable)




Set Caster = (Picked unit)




-------- Finds the locations of Caster and Target --------




Set Points[1] = (Position of Caster)




Set Points[2] = (Position of Target)




-------- Finds a location to which the Caster would be moved --------




-------- NOTE 1: Here change your speed --------




-------- NOTE 2: Speed is counted by dividing your real number into trigger's loop interval --------




-------- NOTE 3: My speed is 40/0.04=1000 units per second --------




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




-------- Loads the Distance at which caster would start landing --------




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




-------- Counts the Distance between caster and target --------




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




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





If - Conditions






Real[2] Greater than or equal to 120.00





Then - Actions






-------- If distance between caster and target is greater than 120, then... --------






-------- Moves caster to Points[3] --------






Unit - Move Caster instantly to Points[3], facing Points[2]






-------- Increases/decreases the flying heigh of Caster --------






-------- NOTE 4: Here it checks if the Distance between Caster and Target is greater than Distance at which Caster should start landing --------






-------- If yes, then it increases the flying height of the caster, else reduces it by equal amount --------






If (Real[2] Greater than or equal to Real[1]) then do (Set Real[1] = 8.00) else do (Set Real[1] = -8.00)






Unit - Add Storm Crow Form to Caster






Unit - Remove Storm Crow Form from Caster






Animation - Change Caster flying height to ((Current flying height of Caster) + Real[1]) at 1000000000.00





Else - Actions






-------- Else... --------






-------- Resets the Flying height of Caster --------






Animation - Change Caster flying height to 0.00 at 100000000.00






-------- Makes it vurnerable again and turns it's collisiong on --------






Unit - Make Caster Vulnerable






Unit - Turn collision for Caster On






-------- Orders caster to attack target --------






Unit - Order Caster to Attack Target






-------- Creates the Thunderclap --------






-------- NOTE 5: Change damage at dummy ability in Object Editor --------






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






Unit - Add a 3.00 second Generic expiration timer to (Last created unit)






Unit - Add Dummy Thunder Clap to (Last created unit)






Unit - Set level of Dummy Thunder Clap for (Last created unit) to (Level of Heroic Leap for Caster)






Unit - Order (Last created unit) to Human Mountain King - Thunder Clap






-------- Clears the Hashtable and Removes caster from Leapers' group --------






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






Unit Group - Remove (Picked unit) from Leapers




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




Custom script: call RemoveLocation(udg_Points[1])




Custom script: call RemoveLocation(udg_Points[2])




Custom script: call RemoveLocation(udg_Points[3])


-------- Checks if there is any instance left after loop --------


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


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