Warcraft III resources & community, 2003–2006 · archived

Need help with a Trigger for my TD!!!! plz help?!

2 posts
#1

Need help with a Trigger for my TD!!!! plz help?!

ok so if anyone can help it would be nice....
heres what i got right now

RedCreepSpawn1 0
Events
Time - Elapsed game time is 10.00 seconds
Conditions
(Player 1 (Red) slot status) Equal to Is playing
Actions
For each (Integer Level[1]) from 1 to 20, do (Actions)
Loop - Actions
Unit - Create 1 (1) Crab for Player 11 (Dark Green) at (Center of RedStart1 <gen>) facing (Position of (Triggering unit))
Wait 0.50 seconds

-Now right at the moment this is a trigger all by itself, obviously... anyways i was wondering for example when all crabs have reaced a certain region i can for example spawn level 2 like this, but in the same trigger. I know how to do it as a seperate trigger but i dont want 1000 triggers. So if anyone could give an example of how to spawn one level then the next up to how many you want in 1 trigger.

Thanks Deso.
#2
first i'd just like to ask why you use
Integer Level[1] in the for loop instead of just the default Integer A

anyways, to answer your question


T:  Intialize Constants
E:  map init
C:
A:  set unittypeSpawned[0] = Crab
    set unittypeSpawned[1] = Horsey
    set unittypeSpawned[2] = Fish...ey
    set etc...
    set unittypeSpawned[49] = Ubernaut

    set regionArea[1] = Center of RedStart1 <gen>
    set regionArea[2] = Center of BlueStart1 <gen>
    set etc...

    set MAXPLAYERS = 8
    set levelcount = 0

EndT

T:  Initiate Creeps
E:  <none> //this trigger is called by another trigger
C:
A:  trigger - turn on <Spawn Creeps>
    wait 10 game seconds
    trigger - turn off <Spawn Creeps>
    set levelcount = levelcount + 1

EndT

T:  Spawn Creeps
E:  Periodic every 0.5 seconds
C:
A:  for loop integer A from 1 to MAXPLAYERS
        if (player(integer A) slot status == is playing)
            unit - create 1 unittypeSpawned[levelcount] at regionArea[integer A]
        else
            DoNothing()
    endloop

EndT

T:  Anything
E:  non descript
C:
A:  etc...
    trigger - run <Initiate Creeps> //<-- this line spawns the next wave (note, if the previous wave isn't complete it will create the old wave's units until the old wave completes itself
    etc...

EndT


of course this isn't the only way, its just what i came up with on the spot after reading your post