Defend

Status
Not open for further replies.
Level 7
Joined
Aug 27, 2008
Messages
378
Is there a way to make it so that when a footman uses the defend ability, he will stop using it after 1 second? If there is, how can i do it?
 
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Defend
  • Actions
    • Wait 1.00 seconds
    • Unit - Order (Triggering Unit) to Human Footman - Stop Defend
The trigger should activate when Defend is used, and then 1 second after Defend activates, it should stop Defending.
 
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Defend
  • Actions
    • Wait 1.00 seconds
    • Unit - Order (Triggering Unit) to Human Footman - Stop Defend

I dont think the event works, ive tryed casting, starts the effect, and starts channeling an ability, but none seem to work.. yeah i might be wrong but idk
 
Create a trigger named "Remove Defend." Convert to custom text. Paste this:

JASS:
function Trig_Remove_Defend_Conditions takes nothing returns boolean
    if ( GetIssuedOrderId() == String2OrderIdBJ("defend") ) then
        return true
    endif
    return false
endfunction

function Trig_Remove_Defend_Actions takes nothing returns nothing
    local unit u = GetOrderedUnit()
    call TriggerSleepAction( 1.00 )
    call IssueImmediateOrder( u, "undefend" )
    set u = null
endfunction

function InitTrig_Remove_Defend takes nothing returns nothing
    set gg_trg_Remove_Defend = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Remove_Defend, EVENT_PLAYER_UNIT_ISSUED_ORDER )
    call TriggerAddCondition( gg_trg_Remove_Defend, Condition( function Trig_Remove_Defend_Conditions ) )
    call TriggerAddAction( gg_trg_Remove_Defend, function Trig_Remove_Defend_Actions )
endfunction

You should note that this will cancel any orders the unit currently has when it is given the undefend order. There is no way around this to my knowledge, except for a fairly complex order queue system.
 
Status
Not open for further replies.
Back
Top