TD Level Structure

Status
Not open for further replies.
Level 36
Joined
Mar 15, 2006
Messages
7,941
Okay, so right now i'm doing the part of my TD where I set the variable for each level, but I want to know how to actually spawn the units in the most efficient way. you could always do the spawn 40 of this unit facing this direction yadayada, but I head there was an easier way using variables that would save me a lot of triggering. Explain anyone?
 
Just make an array variable (unittype variable) and put the array number to the amount of waves you are willing to create -1 (since 0 is a number as well)
You create a integer variable to sum up the aray after a wave has passed.
Then you create a new trigger with a melee inits event and appoint the variables, this an example.

  • "your trigger"
    • Events
      • Melee initizialization
    • Conditions
    • Action
      • Variable - "your variable[0] = "The unit type for wave1"
      • Variable - "your variable[1] = "The unit type for wave2"
Once you appointed all variables you can use them in the spawn trigger, for instance if you work with a timer to indicate when the next wave is comming, you could do something like this

  • "your trigger"
    • Events
      • Time - every "your time to next wave"
    • Conditions
      • "your conditions if any"
    • Action
      • Unit - Create "your amount" "Your unittype variable"["your integer variable"] for "player" at ("location") facing "facing angle" degrees
      • Variable - ("your integer variable" = "your integer variable + 1)
Off course you can always use a integer variable for the "your amount" and pre-set that if you like that as well.
 
Status
Not open for further replies.
Back
Top