• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] Stun interrupts move order - fix?

So, when I spawn a unit and order it to move somewhere, if that unit gets stunned along the way, when the stun ends, it goes back to its initial position. Is there a way to fix this without having some kind of periodic check trigger? I want it to keep going where it was ordered to.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
That seems to only happen if the unit is owned by Neutral Hostile and if it's beyond it's Guard Distance (gameplay constant) - At least that's what happened when I tested it on version 1.36.

You can adjust the Guard Distance to fix it. That or use triggers.

I believe there's a way to detect when a unit becomes stunned using the "stun order", which you'd have to look up. Combine that with a system for tracking a unit's destination and you can easily update it's orders whenever it gets stunned. Here's an example:
  • Spawn
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Unit - Create 1 Footman for Neutral Hostile at (Center of (Playable map area)) facing Default building facing degrees
      • Set TempUnit = (Last created unit)
      • Set CV = (Custom value of TempUnit)
      • Set TempPoint = (Random point in (Playable map area))
      • Set X[CV] = (X of TempPoint)
      • Set Y[CV] = (Y of TempPoint)
      • Unit - Order TempUnit to Move To TempPoint
      • Custom script: call RemoveLocation(udg_TempPoint)
  • Stun
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(the order for stun))
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Set TempUnit = (Triggering unit)
      • Set CV = (Custom value of TempUnit)
      • Set TempPoint = (Point(X[CV], Y[CV]))
      • Unit - Order TempUnit to Move To TempPoint
      • Custom script: call RemoveLocation(udg_TempPoint)
The Custom Value stuff is meant to be used with a Unit Indexer system.
 
That seems to only happen if the unit is owned by Neutral Hostile and if it's beyond it's Guard Distance (gameplay constant) - At least that's what happened when I tested it on version 1.36.

You can adjust the Guard Distance to fix it. That or use triggers.

I believe there's a way to detect when a unit becomes stunned using the "stun order", which you'd have to look up. Combine that with a system for tracking a unit's destination and you can easily update it's orders whenever it gets stunned. Here's an example:
  • Spawn
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Unit - Create 1 Footman for Neutral Hostile at (Center of (Playable map area)) facing Default building facing degrees
      • Set TempUnit = (Last created unit)
      • Set CV = (Custom value of TempUnit)
      • Set TempPoint = (Random point in (Playable map area))
      • Set X[CV] = (X of TempPoint)
      • Set Y[CV] = (Y of TempPoint)
      • Unit - Order TempUnit to Move To TempPoint
      • Custom script: call RemoveLocation(udg_TempPoint)
  • Stun
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(the order for stun))
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Set TempUnit = (Triggering unit)
      • Set CV = (Custom value of TempUnit)
      • Set TempPoint = (Point(X[CV], Y[CV]))
      • Unit - Order TempUnit to Move To TempPoint
      • Custom script: call RemoveLocation(udg_TempPoint)
The Custom Value stuff is meant to be used with a Unit Indexer system.
oh, if it was that simple - just doesn't have to be neutral hostile! Thanks for the detailed trigger though.
 
Top