• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Unit won't stop

Status
Not open for further replies.
I'm trying to make a unit to Stop when it finishes training, or when it's given a move order, but it's not responding and keeps on moving. I've tried a bunch of things but nothing's working.

JASS:
call PauseUnit(sentinel, true)
call IssueImmediateOrderById(sentinel, 851972) //Stop Order
call PauseUnit(sentinel, false)

This doesn't work. I've tried with Stunned or ordering it to move at it's own location, but no success so far. SetUnitPosition doesn't seem to cancel orders either right after the units is created or given a move order. The only thing that 'works' is to wait something like 0.3 seconds and then ordering the stop, which is... not ideal. At all.

If this is at all relevant, that unit is supposed to start orbiting the building that created it with SetUnitX/Y, so that it can still attack anything that comes close to it.
 

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,239
GUI use TriggerSleepAction(...) I think.

And you can use a timer in a way cleaner way in jass btw.

JASS:
//handwritten, will likely contain errors

library name
    function endTimer takes nothing returns nothing
        //do stuff after timer is done
    endfunction

    function myActions takes nothing returns nothing
        call TimerStart(CreateTimer(), 0, false,  function endTimer)
    endfunction

    function onInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        //register your event
        call TriggerAddAction(t, function myActions)
    endfunction
endlibrary
 
Last edited:
I'm trying to make a unit to Stop when it finishes training

  • Untitled Trigger 002
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Footman
    • Actions
      • Unit Group - Add (Trained unit) to StopGroup
      • Countdown Timer - Start StopTimer as a One-shot timer that will expire in 0.00 seconds
  • Untitled Trigger 003
    • Events
      • Time - StopTimer expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in StopGroup and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Stop
          • Unit Group - Remove (Picked unit) from StopGroup
zibi
 
Oh thank you, ZiBitheWand3r3r! It works nicely +rep

Why not just set its prop window to 0 in JASS?

call SetUnitPropWindow(u, 0)

It acts as a permanent ensnare but you can still move it via SetUnitX/Y

That's a good suggestion all things considered. The units need to be able to move freely once they start attacking, but I could always just turn PropWindow on and off. I'll see if this is better for my purposes, thanks :)
 
Status
Not open for further replies.
Top