[JASS/AI] An Unit Immune to Stuns and certain effects, using PauseUnit.

Level 4
Joined
Mar 14, 2021
Messages
14
Well I did not find a similar topic so I post it here, sure that some will know this trick, but hey, it will be more useful with an explanation of its use. I found this trick looking for a way to perform quick attacks, I guess some people may find this trick useful.

Previously, from what I knew in previous versions of War 3, before Blizzard gave the BlzPauseUnitEx feature, units could be immune to certain stuns using morph, mainly this is demonstrated in Dota 1 with the hero Alchemist and his transformation. But was there really just that way to make a unit avoid certain stun effects? This is apparently all due to the command "851973" that is given before sending a stun effect to a unit, so if someone interrupts this effect or the stun counter, it could make the unit unaffected by stuns.

The method

As I said before by interrupting a certain order you can avoid giving this effect of being immune to stuns in general. So in this case we could simply use PauseUnit (your_unit, true), which simply generates before pausing a unit the command "851973", which is given in the event EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER or EVENT_UNIT_ISSUED_POINT_ORDER (a bit strange, no), well if we give it a command to a point or target other than the unit to be paused within the command event ID "851973", a glicht will be given. If you want to know about this error you can see this post made by Eikonium [Trigger] - Pause/Order Bug that with a map shows what happens with this glicht.

The idea is simply to do what Eikonium does but after the PauseUnit function we put a call IssueImmediateOrder (your_unit, "stop") so that it stops doing the last order given within the "851973" event, so we will have our Unstoppable and controllable unit.

JASS:
scope TestUnstoppableUnit initializer Init

    globals
        private unit Test_Unstoppable = null
        private unit Test_AnotherUnit = null
    endglobals

    private function Unstoppable_Order takes nothing returns nothing
        if GetTriggerEventId() == EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER and GetIssuedOrderId() == 851973 then
            if GetOrderedUnit() == Test_Unstoppable then
                call IssuePointOrder(GetOrderedUnit(),"move",GetUnitX(Test_AnotherUnit),GetUnitY(Test_AnotherUnit))
            endif
        endif
    endfunction

    private function Unstoppable_Actions takes nothing returns nothing
        call TriggerSleepAction(4)
        call PauseUnit(Test_Unstoppable,true)
        call IssueImmediateOrder(Test_Unstoppable,"stop")
    endfunction

    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER)
        call TriggerAddAction(t, function Unstoppable_Order)
        set t = null
   
        set Test_Unstoppable = gg_unit_h000_0001
        set Test_AnotherUnit = gg_unit_hgry_0012
        call Unstoppable_Actions.execute()
    endfunction

endscope

As you can see in this code, simply Test_Unstoppable is the unit that will be paused, and it will send the order before that event occurs, within this, Test_Unstoppable will be ordered to move where this other unit is, in this case, Test_AnotherUnit. After performing these events, the unit will be unstoppable, but we must stop the given order in case the previous order is repeated due to pause using the code line IssueImmediateOrder (Test_Unstoppable, "stop") after PauseUnit and that would be everything .

Curiosities

- The unit this fault applies to is actually paused, and with the IsUnitPaused function it can be checked, even though it is paused, the unit can be controlled normally.

- To undo the effect of this state, it is simply to use the false PauseUnit function so that the unit stops being paused as in this example:

JASS:
     private function Unstoppable_Actions takes nothing returns nothing
        call TriggerSleepAction(4)
        call PauseUnit(Test_Unstoppable,true)
        call IssueImmediateOrder(Test_Unstoppable,"stop")
        call TriggerSleepAction(10)
        call PauseUnit(Test_Unstoppable,false)
    endfunction

- Units that are in this state, for some reason will not be able to use non-directed abilities (such as berserk), they will only give orders, this could be good in the case of metamorphosis, they will not be able to activate On and Off of the orders of an ability of automatic launch.

- As you know, since there is no way to stun the unit in this state, nor with XD pause, this method could be used [vJASS] - [Snippet] SuspendUnit made by IcemanBo, which is also applicable to illusions.

- Beware that sometimes when detecting the command "851973" it can be generated by the ability to sleep (or others that I have not seen yet), which will also be taken within the event that captures the order, so it is good to have something that identifies to a unit that is about to enter this state, such as using an ability or variable.

- Also illusions can have this state.

- There are certain situations in which this state cannot be applied to a unit, and they are: If they cannot move, neither attack, nor cast spells.

A Glicht that spawns when a unit has Root.

- If the unit that uses this state and has root with the value to turn in false, this when giving the order to attack a unit will be able to move, even if the movement buttons are hidden, it will be able to follow the unit attacked. This is interesting since "smart" does not work but I find it useful in the field of units like Castle Fight to eliminate this command.

- If the unit is affected by abilities such as Cobweb or Trap, it will attack again without turning, only for the duration of the buff, and will not be able to move.

Credits

- To Eikonium for confirming the existence of this glicht, to Fenix140 for the method of illusions that can use certain abilities.

I attach the test map with what was explained above.
 

Attachments

  • An Unstoppable using Pause.w3x
    60.7 KB · Views: 15
Last edited:
Top