1. The heavens smile on the old faithful. The 16th Techtree Contest has begun.
    Dismiss Notice
  2. The die is cast - the 6th Melee Mapping Contest results have been announced. Onward to the Hive Cup!
    Dismiss Notice
  3. The glory of the 20th Icon Contest is yours for the taking!
    Dismiss Notice
  4. Shoot to thrill, play to kill. Sate your hunger with the 33rd Modeling Contest!
    Dismiss Notice
  5. Do you hear boss music? It's the 17th Mini Mapping Contest!
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

How to cancel training a unit

Discussion in 'Triggers & Scripts' started by maskedpoptart, Oct 18, 2009.

  1. maskedpoptart

    maskedpoptart

    Joined:
    Aug 4, 2006
    Messages:
    351
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Hey guys,

    Quick question: In response to the event "building starts training a unit", how do I cancel training the unit? I can't find a function to do it.
    An answer in any code form (GUI/JASS/vJASS) is welcome, but please, do NOT make up a function name that doesn't exist. Yes I know this question requires you to actually open up your world editor, but I will give rep to whoever solves it.

    Edit: I solved the problem by doing a test in response to the EVENT_PLAYER_UNIT_ISSUED_ORDER event. When I press the cancel button, I print out the issued order id, which turns out to be 0x000d0008. Then I can cancel training a unit by doing the following:
    Code (vJASS):
    call IssueImmediateOrderById( udg_buildingUnit, 0x000d0008 )
     
  2. Lord_Sauron

    Lord_Sauron

    Joined:
    Nov 17, 2004
    Messages:
    273
    Resources:
    9
    Maps:
    9
    Resources:
    9
    Is there a way to cancel units that are later in the build order? Say you want two units to be permitted to train, but due to a condition, the third one in line is canceled.