1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. 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.

[Solved] Stop treining unit

Discussion in 'Triggers & Scripts' started by Kamulec, May 31, 2013.

  1. Kamulec

    Kamulec

    Joined:
    May 15, 2008
    Messages:
    104
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Is it possible (with a trigger or jass - I prefer the 1st option) to order a unit (building) to stop training another unit?

    //sorry for the typo
     
  2. Nichilus

    Nichilus

    Joined:
    Sep 26, 2009
    Messages:
    1,968
    Resources:
    0
    Resources:
    0
    You could try
    • Unit - Order YourBuilding to Stop

    although I'm not really sure this will work.
    (it's a Unit - Issue Order with no target action)

    If what you want is to limit how many units a player can train, then there is an easier way
    • Player - Limit training of Footman to 1 for Player 1 (Red)

    it's Player - Limit Trianing of Unit type
    That will allow only a number of units you set in here to be trained for selected player

    ---
    Other options you could try could be
    Hiding and immediately unhiding the building
    or
    Remove and immediately create new building with same health in same spot
     
  3. Kamulec

    Kamulec

    Joined:
    May 15, 2008
    Messages:
    104
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Thanks for the will of help but it's not so simple.

    It doesn't. That's why I'm asking.

    I have to do something much more complexed.

    Doesn't work.

    This solution is unacceptable because of too many other triggers referring to the building.
     
    Last edited: May 31, 2013
  4. rulerofiron99

    rulerofiron99

    Joined:
    Jul 10, 2006
    Messages:
    3,129
    Resources:
    14
    Maps:
    4
    Spells:
    9
    Tutorials:
    1
    Resources:
    14
    You'll need a loop.

    Make a unit group variable, let's call it StopTraining

    When you want the unit to stop training, add the barracks to StopTraining.

    Make a new trigger.

    Event: every 0.03 seconds
    Conds: none
    Actions:
    Unit group - pick every unit in StopTraining and do actions:
    Unit group - remove picked unit from StopTraining
    Custom script: call IssueImmediateOrderById( GetTriggerUnit(), 851976 )

    EDIT: You need to use
    • Custom script: call IssueImmediateOrderById( GetTriggerUnit(), 851976 )


    That is the order for cancel.
     
  5. Kamulec

    Kamulec

    Joined:
    May 15, 2008
    Messages:
    104
    Resources:
    1
    Maps:
    1
    Resources:
    1
    It cancels the lattes order, so I have to make a loop and clear the queue but it's still an acceptable solution. Thanks.