• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Group unit Training

Status
Not open for further replies.
Level 6
Joined
Dec 26, 2015
Messages
86
Can someone explain how to setup code (GUI) to make units train in a batch ie training 4 footman in a group rather than single.
 
You can do some very simple trigger like this:

  • Training
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Egal à Footman
    • Actions
      • Unit - Create 3 Footman for (Owner of (Triggering unit)) at (Position of (Trained unit)) facing (Facing of (Trained unit)) degrees
That's just the basics, ideally you'd need to save the point in a variable and clear it so that it doesn't leak. Also, you may want to order your units to move to your rally point, in case it has changed, but you should figure the details by yourself
 
I made a map that should have what you wanted. It's very simple to use.

All you have to do is copy and paste the "Train Units" folder into your map. Then configure the "Setup Train Units" trigger, adding variables for each Unit Type that you plan on using with the system. There's more instructions inside of the triggers.

This uses the latest patch and Bribe's Unit Indexer.

Edit: Added Food Costs. For example, training a batch of Footman costs 4 Food but once created each individual Footman will only cost 1 Food.
 

Attachments

Last edited:
I suppose I mean each unit trained will generate 4 units (that are 1 food each).
Make the trained unit a dummy which takes 4 food. A trigger then responds to it being trained, creates 4 of the intended unit at the location of the trained unit and then removes the trained dummy unit from the game. To prevent upkeep notifications one might need to remove the trained unit first which would require storing its location or using a location based on the training unit to create the 4 actual units.

The dummy unit is needed for easy and correct food calculation. One cannot train the actual unit as the food requirements would be incorrect. It may be possible to train an actual unit and then modify it and 3 others to use less food, but I am not sure.
 
I think the easiest thing you can do as of now is have 2 different versions of each unit.

One unit that costs the total food cost and is trained by the Barracks.
Another unit that is created by triggers and costs a fraction of the total food cost.

So if you wanted to create 4 Footman and have them cost a total of 4 Food then you'd create a Footman version that costs 4 Food and a Footman version that costs 1 Food. Then make your Barracks train the 4 Food version. And then trigger it so that once that unit has finished training you replace it with 4 of the 1 Food Cost versions. This is the method I use in the map I uploaded.
 
Last edited:
Status
Not open for further replies.
Back
Top