• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Auto train unit

Status
Not open for further replies.
It's pretty easy. The event is 'Every x seconds', the conditions are whatever you lie, and there are Actions (under Unit) that allow you to add a unit to the training que.

If you want them to be trained at specific moments, you can use the Conditions or If/Then/Else triggers.
 
Or you make 2 triggers:
1st one detects when a building is finished, then let the building train the specified unit (via if's)
2nd one is, when a building finishes training a unit, order the building to train another.

The upper function works, too and is easier i think.
 
There you go
  • Unit creating
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Barracks) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to train/upgrade to a Footman
 
bj_destroy_group cause trigger malfunction in most events of type every X seconds and i think pick every unit doesn't cause leak becouse technical it's imposible to select 1 unit more than 1 time. Btw you always can use the GUI trigger unit remove last picked unit from last created unit group if you think there is leaks
 
Or you make 2 triggers:
1st one detects when a building is finished, then let the building train the specified unit (via if's)
2nd one is, when a building finishes training a unit, order the building to train another.

The upper function works, too and is easier i think.

this is the better way although more complicated
 
bj_destroy_group cause trigger malfunction in most events of type every X seconds and i think pick every unit doesn't cause leak becouse technical it's imposible to select 1 unit more than 1 time. Btw you always can use the GUI trigger unit remove last picked unit from last created unit group if you think there is leaks
No, it doesn't.
And yes, it leaves a leak if you don't destroy the group you've set up
 
Or you make 2 triggers:
1st one detects when a building is finished, then let the building train the specified unit (via if's)
2nd one is, when a building finishes training a unit, order the building to train another.

The upper function works, too and is easier i think.


This one works perfectly :D
 
Or you can use a skill called Factory, and another one called Rally. This does not produce the load bar, but saves a ton of work.

You also need to add in something in to stop the player cancelling the construction. Make a third trigger with the event for when a unit is cancelled.
 
A problem has occured... The auto-training unit is working fine but the problem is that after i cancel the training i'm not able to upgrade my building =.=

  • dfgdsfgdfg
    • Events
      • Unit - A unit Finishes construction
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Constructed structure)) Equal to Dog Training School 8
        • Then - Actions
          • Unit - Order (Constructed structure) to train/upgrade to a Puppy
        • Else - Actions
  • sdfsdfsd
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • Unit - Order (Triggering unit) to train/upgrade to a (Unit-type of (Trained unit))
 
Status
Not open for further replies.
Back
Top