• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Knockback Pathing Not Detected???

Status
Not open for further replies.
Level 9
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:
  • 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)
The problem is it didnt detect a unwalkable pathing and it didn't print HIT and stop, and continues to move back. Please help!
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
 
Status
Not open for further replies.
Top