• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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