• 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] Unit Train System

Status
Not open for further replies.
onTrainingFinish (when unit finished training)

MaxIndex = MaxIndex + 1
Building[MaxIndex] = TriggeringUnit
UnitType[MaxIndex] = TrainedUnitType
Player[MaxIndex] = TriggeringPlayer
Location[MaxIndex] = PositionOf(TrainedUnit)


PeriodicTrigger (runs periodicly each 20 seconds)

Loop for CurrentIndex to MaxIndex
----
---- If (Building[MaxIndex] is Alive == True) Then
---- ---- Create UnitType[CurrentIndex] for Player[CurrentIndex] at Location[CurrentIndex]
---- Else
---- ---- Deindex or what ever


If you don't want to spawn all units at once but each unit exactly 20 seconds after first spawn then you need to index a counter variable, too.
In loop you increment/decrement your counter[index] periodicly until you create the unit, then you reset the counter.
 
Status
Not open for further replies.
Top