• 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.

prevent an unit order

Status
Not open for further replies.
Level 17
Joined
Apr 27, 2008
Messages
2,455
The usual way to prevent a forbidden order is to give the order "stop" when an unit try to do this forbidden order. (and eventually pause the unit before, and unpause after the order "stop")
But there is a better way, give the order "851973" (damn, i remember this number, years after used it ...).
This order is issued when you pause a not already paused/stunned unit (point/target order).

Why it's better ?

1) If the unit had a no target order, it will keep it, such as "holdposition"

2) You can easily filter it, because there is no way that a unit could get this order as no target order, excepted by trigger

Now frankly i've never really expirimented this, so have fun.

Ofc it's far from perfect, my point is that it's still better than use the order "stop", nothing else.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
If you're opting for an arrow movement system, I think that is good, along with a custom attack system, you can remove 'Aatk' too, no more automated behavior.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
Well, as said it's just better to use that order rather than "stop". But it's not something miraculous.
Also pause and unpause an unit without any other stuff won't prevent orders being issued.

Now, about spells, simply giving this order should stop spells which have a target/point, but not the ones without target.
For these ones, you still need to pause the unit, give this order, unpause the unit (or use a Timer(0) instead of the pause/unpause stuff)
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
It actually does matter, since only one call of SetUnitPosition will not be enough (and i guess it must be done over time ...), and anyway it won't totally stop the rotation of the unit, you could fuck its position (colision, pathing,...).
I didn't answered it first, simply because i thought that was a sort of joke but not serious.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Let it slide man, I just got carried away, that's all haha XD.
@on-topic: I tried testing the stop order on windwalk, it doesn't work. Do you guys know how to prevent that order, I tried a lot of things already, couldn't cancel that ability from firing.

My mistake, I was testing on abilities.
 
Last edited:
Level 22
Joined
Sep 24, 2005
Messages
4,821
I was out of place again... I was testing on abilities (ability events), sorry about that. I need to stay away from the lab lol, I'm spreading bullshit again.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
test code:
JASS:
scope s initializer init
    
    globals
        private unit un = null
        private integer inte = 0
    endglobals
    
    private function u takes nothing returns nothing
        call BJDebugMsg(I2S(GetUnitCurrentOrder(un)))
    endfunction
    
    private function f takes nothing returns boolean
        if inte == 0 then
            return false
        endif
        set inte = inte + 1
        call PauseUnit(un, true)
        call IssueImmediateOrderById(un, 851973)
        call PauseUnit(un, false)
        return false
    endfunction
    
    private function init takes nothing returns nothing
        local trigger t = CreateTrigger()
        set un = CreateUnit(Player(0), 'Obla', 0, 0, 0)
        call TimerStart(CreateTimer(), 0.01, true, function u)
        call TriggerRegisterUnitEvent(t, un, EVENT_UNIT_ISSUED_ORDER)
        call TriggerAddCondition(t, Filter(function f))
        set t = null
    endfunction
    
endscope

will always print 0 if you wind walk, so even tho the windwalk effect will start normally, the order id of unit wont change(still prints 0)
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
I guess that instead of the pause/unpause stuff, using a Timer(0) would be much more neat.
Pause an unit generates this point order 851973 and i also suspect that pause and/or unpause an unit is not something instant but delayed a bit.
And it should even be more efficient.
 
Status
Not open for further replies.
Top