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

Disabling Autocast

Status
Not open for further replies.
Level 19
Joined
Aug 8, 2007
Messages
2,765
Again.


E/ The specific ability is Cold Arrow and i want to disable autocast because it has a cooldown
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
You can catch the order for turning on auto-cast, then disable it again. Frost/Ice Arrows do not have it written in object editor, so maybe they do not possess an order string but only the numeric id. Check it via

Code:
    Events
        Unit - <unit> Receives an order targeting an object
        Unit - <unit> Receives an order targeting a point
        Unit - <unit> Receives an order without target
    Actions
        Custom script:   call BJDebugMsg(I2S(GetIssuedOrderId()))
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
What I understand:
1. A unit activates auto-cast ability (Frost Arrow).
2. The unit attacks an enemy unit (fires the Frost Arrow).
3. Cooldown went in and also, the auto-cast is disabled immediately

Is that all ?

So you want to make like if you activate the auto-cast of Frost arrow while in cooldown mode, it will instantly be de-activated ?
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
You can catch the order for turning on auto-cast, then disable it again. Frost/Ice Arrows do not have it written in object editor, so maybe they do not possess an order string but only the numeric id. Check it via

Code:
    Events
        Unit - <unit> Receives an order targeting an object
        Unit - <unit> Receives an order targeting a point
        Unit - <unit> Receives an order without target
    Actions
        Custom script:   call BJDebugMsg(I2S(GetIssuedOrderId()))
I believe ive already tried this

JASS:
function Trig_No_Autocast_Fierce_Blow_Conditions takes nothing returns boolean
    if ( not ( GetIssuedOrderId() == OrderId("coldarrows") ) ) then
        call print(I2S(GetIssuedOrderId()))
        call print(OrderId2String(GetIssuedOrderId()))
        call print("2")     
        return false
    endif
    call print("3")
    return true
endfunction

function Trig_No_Autocast_Fierce_Blow_Actions takes nothing returns nothing
    call IssueImmediateOrder( GetTriggerUnit(), "uncoldarrows" )
    call print("1")
endfunction

//===========================================================================
function InitTrig_No_Autocast_Fierce_Blow takes nothing returns nothing
    set gg_trg_No_Autocast_Fierce_Blow = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_No_Autocast_Fierce_Blow, EVENT_PLAYER_UNIT_ISSUED_ORDER )
    call TriggerAddCondition( gg_trg_No_Autocast_Fierce_Blow, Condition( function Trig_No_Autocast_Fierce_Blow_Conditions ) )
    call TriggerAddAction( gg_trg_No_Autocast_Fierce_Blow, function Trig_No_Autocast_Fierce_Blow_Actions )
endfunction

and it printed 3 1 but the autocast remained
~Moved to the WEHZ

Move it back, please, this can only be done via code

What I understand:
1. A unit activates auto-cast ability (Frost Arrow).
2. The unit attacks an enemy unit (fires the Frost Arrow).
3. Cooldown went in and also, the auto-cast is disabled immediately

Is that all ?

So you want to make like if you activate the auto-cast of Frost arrow while in cooldown mode, it will instantly be de-activated ?

If you hit stop than let the hero automatically attack a unit with frost arrow on cooldown, frost arrow will activate but the cooldown wont. Test it.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
JASS:
function Trig_No_Autocast_Fierce_Blow_Conditions takes nothing returns boolean
    if ( not ( GetIssuedOrderId() == OrderId("coldarrows") ) ) then
        call print(I2S(GetIssuedOrderId()))
        call print(OrderId2String(GetIssuedOrderId()))
        call print("2")     
        return false
    endif
    call print("3")
    return true
endfunction

function Trig_No_Autocast_Fierce_Blow_Actions takes nothing returns nothing
    call IssueImmediateOrder( GetTriggerUnit(), "uncoldarrows" )
    call print("1")
endfunction

//===========================================================================
function InitTrig_No_Autocast_Fierce_Blow takes nothing returns nothing
    set gg_trg_No_Autocast_Fierce_Blow = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_No_Autocast_Fierce_Blow, EVENT_PLAYER_UNIT_ISSUED_ORDER )
    call TriggerAddCondition( gg_trg_No_Autocast_Fierce_Blow, Condition( function Trig_No_Autocast_Fierce_Blow_Conditions ) )
    call TriggerAddAction( gg_trg_No_Autocast_Fierce_Blow, function Trig_No_Autocast_Fierce_Blow_Actions )
endfunction

and it printed 3 1 but the autocast remained

Add a short wait. The event is a borderline one. The unit cannot yet deactivate the ability again.

Move it back, please, this can only be done via code

Triggers & Scripts is not about getting started with a trigger. You would have to present the trigger so we can tell you its weaknesses.
 
Status
Not open for further replies.
Top