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

How can I know when an autocast spell is activated/deactivated?

Status
Not open for further replies.
Hello,
Your task is to register issue_order event and respond to it, e.g:
JASS:
globals
    constant integer ORDER_slowoff = 852077
    constant integer ORDER_slowon = 852076
endglobals

struct onAutoCast extends array
    static method onCast takes nothing returns boolean
        local integer o = GetIssuedOrderId()

        if ( o == ORDER_slowon ) then
            // stuff
        elseif ( o == ORDER_slowoff ) then
            // stuff
        endif

        return false
    endmethod

    static method onInit takes nothing returns nothing
        local trigger t = CreateTrigger()

        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_ORDER)
        call TriggerAddCondition(t, Condition(function thistype.onCast))

        set t = null
    endmethod
endstruct
You can find order-ids for every autocast on/off here, on hive.
 
Status
Not open for further replies.
Top