- Joined
- Sep 28, 2004
- Messages
- 365
Heres the below code:
I modify the Hashtable tutorial knockback spell by a abit to see how i can detect pathing so that it will stop when it hits a cliff or tree. But it is not working? I even looked at Simple Spell Pack v1.2 and his Razor Edge works perfectly by detecting the pathing.
Please help, below is the code:
Eg: when the unit hit a cliff or tree, it keeps moving on.
** Please note that i didn't touch any of the hashtable values or edit them in anyway
I modify the Hashtable tutorial knockback spell by a abit to see how i can detect pathing so that it will stop when it hits a cliff or tree. But it is not working? I even looked at Simple Spell Pack v1.2 and his Razor Edge works perfectly by detecting the pathing.
Please help, below is the code:
-
KnockbackUnits
-
Events
-
Time - Every 0.04 seconds of game time
-
-
Conditions
-
Actions
-
Unit Group - Pick every unit in KnockbackUnits and do (Actions)
-
Loop - Actions
-
-------- Load all necessary variables stored in the Hashtable --------
-
Set KnockbackDistance = (Load (Key distance) of (Key (Picked unit)) from knockbackTable)
-
Set KnockbackAngle = (Load (Key angle) of (Key (Picked unit)) from knockbackTable)
-
Set RemainingTime = (Load (Key time) of (Key (Picked unit)) from knockbackTable)
-
Set KnockbackPos = ((Position of (Picked unit)) offset by KnockbackDistance towards KnockbackAngle degrees)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Terrain pathing at KnockbackPos of type Walkability is off) Equal to True
-
-
Then - Actions
-
Game - Display to (All players) the text: HIT!
-
-------- Knockback is done, clean up --------
-
Hashtable - Clear all child hashtables of child (Key (Picked unit)) in knockbackTable
-
Unit Group - Remove (Picked unit) from KnockbackUnits
-
Custom script: call RemoveLocation(udg_KnockbackPos)
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
RemainingTime Greater than 0.00
-
-
Then - Actions
-
-------- Move the unit and update time remaining --------
-
Unit - Move (Picked unit) instantly to KnockbackPos
-
Hashtable - Save (RemainingTime - 0.04) as (Key time) of (Key (Picked unit)) in knockbackTable
-
-
Else - Actions
-
-------- Knockback is done, clean up --------
-
Hashtable - Clear all child hashtables of child (Key (Picked unit)) in knockbackTable
-
Unit Group - Remove (Picked unit) from KnockbackUnits
-
Custom script: call RemoveLocation(udg_KnockbackPos)
-
-
-
-
-
-
-
-
Eg: when the unit hit a cliff or tree, it keeps moving on.
** Please note that i didn't touch any of the hashtable values or edit them in anyway