Tower Defence Problem

xKxIxNxGx

New Member
Reaction score
3
ok, well i was making a TD, and well im stuck.. im trying to spawn my creeps... but only the first wave comes but, the rest dont..

here is all the triggers i think would matter to this question:

Code:
rounds
    Events
        Game - numberunits becomes Equal to 0.00
    Conditions
    Actions
        Game - Display to Player Group - Player 1 (Red) the text: (Congradulations for completing Level  + (String(level)))
        Player - Add ((level x 5) x 5) to Player 1 (Red) Current gold
        Set level = (level + 1)
        Game - Display to Player Group - Player 1 (Red) the text: The next round will...
        Countdown Timer - Start SpawnTimer as a One-shot timer that will expire in 30.00 seconds
Code:
lvl1
    Events
        Time - SpawnTimer expires
    Conditions
        level Equal to 1
    Actions
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees
        Wait 1.00 seconds
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees
        Wait 1.00 seconds
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees
        Wait 1.00 seconds
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees
        Wait 1.00 seconds
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees
        Wait 1.00 seconds
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees
        Wait 1.00 seconds
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees
        Wait 1.00 seconds
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees
        Wait 1.00 seconds
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees
        Wait 1.00 seconds
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Spider for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees

Code:
lvl2
    Events
        Time - SpawnTimer expires
    Conditions
        level Equal to 2
    Actions
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees
        Wait 1.00 seconds
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees
        Wait 1.00 seconds
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees
        Wait 1.00 seconds
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees
        Wait 1.00 seconds
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees
        Wait 1.00 seconds
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees
        Wait 1.00 seconds
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees
        Wait 1.00 seconds
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees
        Wait 1.00 seconds
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees
        Wait 1.00 seconds
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Timber Wolf for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees

the lvls continue as so... any ideas on how to make it better/fix/or completelly change everything for a much simplier way...
 

Mr Zero

Junior Regular (Got the T-shirt)
Reaction score
64
Try this:
Code:
For each (Integer A) from 1 to [COLOR="Blue"][B]<Your Number Of Waves>[/B][/COLOR], do (Actions)
    Loop - Actions
        Wait 1.00 seconds
        Unit - Create 1 Level_Units[Level] for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
        Unit - Create 1 Level_Units[Level] for Player 2 (Blue) at (Center of Region 012 <gen>) facing Default building facing degrees

Variables used
Level_Units (Array) = Unit Type
Level (Non-Array) = Integer

Level_Units[1] = Footman
Level_Units[2] = Rifleman
Level_Units[3] = Knight
And so on...

When the trigger runs when it will create Level_Units[Level].
So if Level equels to 1 when make Level_Units[1] (Footman)
If Level equels to 2 when make Level_Units[2] (Rifleman)
Etc...

Hope it helps :)
 

Exide

I am amazingly focused right now!
Reaction score
448
You don't have a trigger which checks if all creeps owned by Player 2 (blue) are dead or not?

What I did was to make a trigger which counts number of kills of the Evil Team (the computer). And spawn 60 units per level (30 in each spawn area)
Then check the death_count variable. And if it is equal to 60 then start countdown for level 2.

I dunno if you understood what I meant. But I'll try to make it clearer when I get home. (I can post my triggers then)
Also, You spawn 1 unit per second. Why not cut it down a little and spawn 10 units of *type* for *player*?

Code:
Actions
        Unit - Create 10 Spider for Player 2 (Blue) at (Center of Region 000 <gen>) facing 270       [I](270 if the spawn area is north, and you want creeps to go south. -Doesn't really matter I guess :P)[/I]
        Unit - Create 10 Spider for Player 2 (Blue) at (Center of Region 012 <gen>) facing 270

You should also rename your regions to something easier to associate with spawn areas. (For example; 'Spawn_Area1' and 'Spawn_Area2')

Hope it helped :p

EDIT: I wasn't trying to copy Mr Zero. He simply finished his post before I finished mine :p
 

xKxIxNxGx

New Member
Reaction score
3
ok 1) i did spawn my creeps every second because it reduces lag, if any.. and also it doesnt bunch in alot of creeps at once, because 1 for every lvl there are 2 waves of the same unit.. which is good because if the units go to this one section in the maze the second wave will meet the little of the first wave in a different spot, so you will have to organize your towers in a way it benifets the setup.. not sure if you understand but ya.. i will get going on that array thinger what ever.. i never understood what arrays were ment for, but i hope that will help.. but im going to bed.. its pretty late 1:03 am.... i have to get up in 4 and a half hours
 

Exide

I am amazingly focused right now!
Reaction score
448
It's not wrong to have the spawn trigger such as you do. But I thought it looked like an awful lot of work :p
Anyhow.
Arrays are variables which can store more than one value, I believe?
They are available in TFT only. So I don't know much about them :p
-Basically they help reducing triggers and variables, I think?

Variables are great, btw. I love integer variables :)
I am not 100% sure how they work. But they do :p
I believe they store a certain value. -Which you can set easily through the
'Set variable' action.

For example:

Code:
Events
A unit owned by Player 2 (blue) dies
Conditions
Actions
Set Death_Count to Death_count + 1

-This will increase the variable (an integer variable) by 1 per death of units belonging to Player 2.

I might be wrong in some aspects. But I hope it will help you :p
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top