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

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?
 
Level 12
Joined
Oct 18, 2008
Messages
1,199
  • 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.
 
Level 7
Joined
Jul 19, 2008
Messages
58
  • 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
 
Level 2
Joined
Nov 5, 2008
Messages
9
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.
Top