• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

simple trigger not working

Status
Not open for further replies.
Level 9
Joined
Jan 14, 2008
Messages
366
  • normal go order
    • Events
      • Unit - Captain 0025 <gen> Is issued an order targeting a point
    • Conditions
      • (Issued order) Equal to (Order(move))
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Unit - Order (Triggering unit) to Stop
why is this simple trigger not working?
 
Level 8
Joined
Aug 4, 2006
Messages
357
Try change the conditions to this:
  • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • (Issued order) Equal to (Order(move))
        • (Issued order) Equal to (Order(smart))
    • (Owner of (Triggering unit)) Equal to Player 1 (Red)
If it still does not work, you should do some trial and error.
 
Level 10
Joined
Jun 26, 2005
Messages
236
You can't order 2 things at the same time. Try putting a wait in there, it will work; however, because it will be TriggerSleepAction() or PolledWait() it will be very inaccurate. You would have to do something like this in JASS:

JASS:
function Test_Conditions takes nothing returns boolean
    if GetIssuedOrderId()==OrderId("move") then
        return true
    endif
    if GetOwningPlayer(gg_unit_hpea_0000)==Player(0) then
        return true
    endif
    return false
endfunction

function Test_Do takes nothing returns nothing
    local timer t=GetExpiredTimer()
    
    call IssueImmediateOrder(gg_unit_hpea_0000,"stop")
    
    call PauseTimer(t)
    call DestroyTimer(t)
    set t=null
endfunction

function Test_Actions takes nothing returns nothing
    local timer t=CreateTimer()
    
    call TimerStart(t,0.01, false,function Test_Do)
    
    set t=null
endfunction

function InitTrig_Test takes nothing returns nothing
    set gg_trg_Test=CreateTrigger()
    call TriggerRegisterUnitEvent(gg_trg_Test,gg_unit_hpea_0000,EVENT_UNIT_ISSUED_POINT_ORDER)
    call TriggerAddCondition(gg_trg_Test,Condition(function Test_Conditions))
    call TriggerAddAction(gg_trg_Test,function Test_Actions)
endfunction
 
Level 8
Joined
Aug 4, 2006
Messages
357
Okay I just stole EoW's idea, so here's the best solution (tested), and you should understand it since it's GUI:
  • normal go order
    • Events
      • Unit - Archmage 0000 <gen> Is issued an order targeting a point
    • Conditions
      • (Issued order) Equal to (Order(move))
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Countdown Timer - Start orderTimer as a One-shot timer that will expire in 0.00 seconds
  • normal go order part 2
    • Events
      • Time - orderTimer expires
    • Conditions
    • Actions
      • Unit - Order Archmage 0000 <gen> to Stop
You need to make a variable of type Timer called "orderTimer".
 
Status
Not open for further replies.
Top