Time-based Creep Spawning Help

HalosNTariff

New Member
Reaction score
13
Hi, I'm making a hero defense/survival style map and so far it's going pretty well, all the heroes are finished as is the terrain and the boss cinematics are coming on nicely. However I've run into something of a problem:

For those who don't know a hero defense consists of a group of heroes facing of against an unending horde of enemy units, all coming from the same point. My problem is that I need a way to spawn different levels of enemy units after periods of time. For example the level one unit is a zombie. My trigger spawns, every three seconds, a zombie for the relevant team and orders it to attack-move to the ending region. Here is the problem, my second unit is a skeleton. I need to make it so that after 60 seconds (and therefore 20 zombies) skeletons should start spawning in the place of the zombies.

My basic problem is that you can't use two events I need to somehow ensure that a trigger fires every three seconds but only after a certain game-time whilst also deactivating the previous trigger. Preferably in a manner which doesn't require excessive numbers of triggers.

Many thanks in advance
 

afisakov

You can change this now in User CP.
Reaction score
37
u can either make one very long trigger based on if/then/else

event
time-periodic every 3 seconds

actions
if
(game time elapsed greater then 60 second) and (game time elapsed less then 120 seconds)
then
spawn 1 skeleton at position __________ ... you know the rest

and have a long list of if/then/else functions in one trigger but I think the better way is to have many triggers that each read

event
time-periodic- every 3 seconds
conditions
none
actions
create (1 or however many) units of type _________ at position _________


and then have a a list of triggers that read

time elapsed: 10 seconds
actions: turn on trigger (spawn 1)

time elapsed 70 seconds
actions
turn on spawn 2
turn off spawn 1


I think you get the idea, where each of ur unit spawning triggers is named from spawn 1 to spawn (ur last wave) and u turn the last one off and the next one on after every wave is supposed to end. it is not as tedious to make as it seems because once u make the first u can copy and paste and then just change the numbers and the unit at the wave.
This way tends to lag less then the one massive trigger with if/then/else actions/conditions.

I hope this is clear enough for u to understand and not too long
 

HalosNTariff

New Member
Reaction score
13
Not too long at all, thank you very much, I assumed that would be the easiest way to do it so thanks.
 

afisakov

You can change this now in User CP.
Reaction score
37
That would explain why so many maps seem to do it that way.
btw, if you haven;t done so already you should read up on preventing leaks, stuff like call RemoveLocation(udg_TargetPoint), otherwise leaks will really slow down ur map towards the end of the game.
btw, if you could send some rep my way it would be really appreciated.
 

Dinowc

don't expect anything, prepare for everything
Reaction score
223
the easiest way would be storing unit types in a array variable

unit_type_array[0] = zombie
unit_type_array[1] = skeleton
unit_type_array[2] = whatever
and so on...

then you can do everything in 1 trigger:

Code:
e: every 3 seconds of game time
c: 
a: set spawn_point = center of "your region"
   create 1 unit_type_array[creep_count] at spawn_point
   call RemoveLocation(udg_spawn_point)
   set integer_count = integer_count + 1
   if then else
      if integer_count greater than or equal to 20
        set integer_count = 0
        set creep_count = creep_count + 1
 
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