• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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