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

[Trigger] Auto-Train Trigger?

Status
Not open for further replies.
Level 5
Joined
Aug 3, 2005
Messages
70
Hello!
I'm working on a map that is basically a "Preschool-Like" map. It requires a system where a producer building (such as a Barracks) will automatically train units (Such as Footmen) without the player needing to click the button to train the Footman manually.

However, anyone who has ever played a Preschool map, knows that it can sometimes be a pain to click "cancel" 8 times rapidly to upgrade a building. My goal is to set up so that when you finish constructing a Barracks, the Barracks immediately begins training 2 Footmen in the queue.

As for the Auto-Train, I was wondering if it was possible to have the structure ordered to train an additional unit as soon as the first Footman was finished training, and not on a set interval.

Example of my original Auto-Train Trigger:
triggeroriginal.jpg


What I have at the moment:
trigger.jpg


What I currently have is an unfinished trigger. I was wondering how I order the building to construct a Marine as soon as the first Marine finishes training. As a result, that would leave a never-ending loop of Marine production until canceled (once canceled, it is canceled until reactivated.)

If anyone could help me out on the Auto-Train portion of this, I'd be extremely grateful :)
 
Level 3
Joined
Apr 4, 2004
Messages
41
Maybe if you created a periodic trigger. Event- Every (amount of time it takes to train 1 marine) seconds
Condition- "Unit variable" is alive equal to true *If the building isnt in existance at the start of the game making process and you cant set the building to a variable, have another trigger that when a unit starts to build that building it sets the variable and when the building finishes construction, turn this trigger on.
Action- Create 1 marine for owner of "unit var" at position of "unit var"

Then make a separate trigger Event: Unit begins an upgrade
Condition: Triggering unit = "unit var"
Action: turn off the trigger above

Then ANOTHER trigger Event: Unit finishes upgrade or unit cancels upgrade
Condition: Triggering unit = "unit var"
Action: Turn on the first trigger
 
Level 8
Joined
Sep 13, 2006
Messages
431
  • Unit - Order (Triggering unit) to train/upgrade to a Footman
That should do it for ya. A couple of side-notes for your triggers, though:

1. In marine finish, if I am not mistaken, the 'pick every...' loop is entirely unnecessary.
2. I think that using 'center of (region)', as at the end of marine finish, causes leaks. It creates a point that needs to be removed if you don't want lag, etc.
 
Level 5
Joined
Jun 23, 2004
Messages
126
  • Retrain
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Footman
      • (Unit-type of (Triggering unit)) Equal to Barracks
    • Actions
      • Unit - Order (Triggering unit) to train/upgrade to a Footman
I think that might do the trick.
 
Level 3
Joined
Jun 14, 2007
Messages
33
No, because you would need a Structure = to true which would be the barracks... Because if you didn't, wouldn't it then have bugs?
 
Last edited:
Status
Not open for further replies.
Top