• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Canceling the training of a unit

Status
Not open for further replies.
Level 4
Joined
Sep 24, 2004
Messages
49
Kyawr~!
I have this trigger that detects when a certain unit begins training:
JASS:
GetIssuedOrderIdBJ() == String2OrderIdBJ("custom_h001")
It's in a ifthen function and such. My issue is how to do I get the training building to cancel the order? (Its in order to select another unit: Train -> Cancel -> Select Unit)
 
Level 3
Joined
Sep 13, 2008
Messages
63
I don't believe you can cancel it. Why not replace the unit when its built with whatever unit you want.
 
Level 4
Joined
Sep 24, 2004
Messages
49
Like:
JASS:
call IssueImmediateOrder(GetTriggerUnit(), "851796")
?

I tried that, and that didn't work. Am I doing it wrong?

In fact: Whole Trigger -
JASS:
function Trig_Telekinesis_Conditions takes nothing returns boolean
    if ( not ( GetIssuedOrderIdBJ() == String2OrderIdBJ("custom_o000") ) ) then
        return false
    endif
    return true
endfunction

function Trig_Telekinesis_Actions takes nothing returns nothing
    call IssueImmediateOrder(GetTriggerUnit(), "851796") //Cancel Construction
    call SelectUnitForPlayerSingle( UpgradeTK[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))-1], GetOwningPlayer(GetTriggerUnit()) )
endfunction

//===========================================================================
function InitTrig_Telekinesis takes nothing returns nothing
    set gg_trg_Telekinesis = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Telekinesis, EVENT_PLAYER_UNIT_ISSUED_ORDER )
    call TriggerAddCondition( gg_trg_Telekinesis, Condition( function Trig_Telekinesis_Conditions ) )
    call TriggerAddAction( gg_trg_Telekinesis, function Trig_Telekinesis_Actions )
endfunction
 
Level 4
Joined
Sep 24, 2004
Messages
49
Ahh, I need a wait then? I'll try that



======
EDIT
======


JASS:
function Trig_Telekinesis_Conditions takes nothing returns boolean
    if ( not ( GetIssuedOrderIdBJ() == String2OrderIdBJ("custom_o000") ) ) then
        return false
    endif
    return true
endfunction

function Trig_Telekinesis_Actions takes nothing returns nothing
    local unit c = GetTriggerUnit()
    call TriggerSleepAction(0.1)
    call IssueImmediateOrderById(c, 851796)
    call SelectUnitForPlayerSingle( UpgradeTK[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))-1], GetOwningPlayer(GetTriggerUnit()) )
endfunction

//===========================================================================
function InitTrig_Telekinesis takes nothing returns nothing
    set gg_trg_Telekinesis = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Telekinesis, EVENT_PLAYER_UNIT_ISSUED_ORDER )
    call TriggerAddCondition( gg_trg_Telekinesis, Condition( function Trig_Telekinesis_Conditions ) )
    call TriggerAddAction( gg_trg_Telekinesis, function Trig_Telekinesis_Actions )
endfunction

Still doesn't work, I don't know what I'm doing wrong >_<
 
Status
Not open for further replies.
Top