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

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