• 🏆 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!

TD units stop running problem

Status
Not open for further replies.
Level 3
Joined
Sep 15, 2021
Messages
31
Greetings,

I've been working on updating my TD map and today i get in troble with something.
It happens when maze runners(Enemy units) get frozen by 'Freezingbreath' skill(buff). Once they get frozen, they become dumb and stop running to the waypoints where they are supposed to go to and go back to the previous waypoint or start fighting against my buildings and units. Run triggers are all set up properly.

Is there any way to fix this? Except for this, everything else works totally fine.

Help Plz


P.S.
Sorry for the broken English.. I'm not a native English speaker
 

Attachments

  • Td errors.png
    Td errors.png
    4.2 MB · Views: 20
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
How do you have the waypoints setup? Can you get a unit's next waypoint at any time? If not, you should try to set up your map to be this way using a Hashtable. This will allow you to order any unit to move to it's next region (waypoint) at any time, thus preventing it from "acting dumb". The reason the unit acts this way in the first place is because it's orders get interrupted from a disabling effect (stun).

I attached a map with an example solution using a Hashtable. Press ESCAPE to spawn in an Abomination that will move from Waypoint A to B and finally C.
If you stun the Abomination in any way (Freezing Breath for example) it will resume moving to it's next Waypoint once the stun is finished. This will prevent it from acting dumb and returning to it's previous waypoint/attacking unprovoked.

This is done by saving the unit's next region (waypoint) that it's heading towards in the hashtable. If the unit ever goes off course then we simply load this region from the hashtable and order the unit to move there again. So at all times we're keeping track of the unit's destination.

Lastly, I found that a unit issues an order when it stops being stunned. This allows us to determine when Freezing Breath (and other stuns) are finished:
  • unstun
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
    • Actions
      • -------- This is the "immediate" order which is apparently used exclusively by AI. It happens after a computer unit stops being stunned: --------
      • Custom script: if (GetIssuedOrderId() == 851974) then
      • Unit - Order (Triggering unit) to Move To (Center of (Load 0 of (Key (Triggering unit).) in WaypointHashtable.))
      • Custom script: endif
This trigger detects when the computer unit stops being stunned and orders it to move to it's next waypoint.

Note that I don't fully understand when and why that order is issued so it's possible that it could cause problems. That being said, it seems to work just fine.

Also, my triggers leak Points. You'll want to clean up those memory leaks using a Point variable and Custom script: call RemoveLocation().
 

Attachments

  • Waypoint example.w3m
    18.5 KB · Views: 13
Last edited:
Level 3
Joined
Sep 15, 2021
Messages
31
How do you have the waypoints setup? Can you get a unit's next waypoint at any time? If not, you should try to set up your map to be this way using a Hashtable or Unit Indexing. This will allow you to order a unit to move to it's next waypoint (region) at any time, like after the unit stops being stunned.

I attached a map with an example of this using a Hashtable. Press ESCAPE to spawn in an Abomination that will move from Waypoint A to B and then C. If you stun it in any way (Freezing Breath for example), it will resume moving to it's next Waypoint automatically once the stun is over.

This is done by saving the unit's next region (waypoint) that it's heading towards in a hashtable. If the unit ever goes off course then we simply load this region from the hashtable and order the unit to move there again. So at all times we're keeping track of the unit's destination.

Lastly, I found that a unit issues an order when it stops being stunned. This allows us to determine when Freezing Breath (and other stuns) are finished:
  • unstun
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
    • Actions
      • -------- This is the "immediate" order which is apparently used exclusively by AI. It happens after a computer unit stops being stunned: --------
      • Custom script: if (GetIssuedOrderId() == 851974) then
      • Unit - Order (Triggering unit) to Move To (Center of (Load 0 of (Key (Triggering unit).) in WaypointHashtable.))
      • Custom script: endif
This trigger detects when the computer unit stops being stunned and orders it to move to it's next waypoint.

Note that I don't fully understand when and why that order is issued so it's possible that it could cause problems. That being said, it seems to work just fine.

Also, my triggers leak Points. You'll want to clean up those memory leaks using a Point variable and Custom script: call RemoveLocation().
Thanks a lot !!

I followed your direction and copied that 'Hashtable' way, the problem is totally fixed. You are kind of a Master of this !
 
Last edited:
Status
Not open for further replies.
Top