• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Problems with TD Spawns

Status
Not open for further replies.
Level 4
Joined
Jan 14, 2005
Messages
73
Hi i am having trouble getting my Map To Stop Spawning waves. Here is the trigger
Code:
Events
    Time - Every 10.00 seconds of game time
Conditions
    And - All (Conditions) are true
        Conditions
            Number_Of_Units Less than or equal to 0
Actions
    Wait 15.00 seconds
    Unit - Create 50 c[Current_Level] for Player 12 (Brown) at (Center of Spawn 2 <gen>) facing Default building facing degrees
    Unit - Create 50 c[Current_Level] for Player 12 (Brown) at (Center of Spawn 1 <gen>) facing Default building facing degrees
    Set Number_Of_Units = 100
    Set Current_Level = (Current_Level + 1)

My problem is that it keeps spawning my waves as if my condition did not apply. It is getting very anoying and i want to get the spawns to spawn right (oh and the "c" in "Unit - Create 50 c[Current_Level] for Player 12" stands for my unit type) oh and also it seems to advance to the next level fine but it spawns to quick before i can kill my first wave of level 1 enimies it spawns the level 2 enimies and then a few seconds later my level 3 enimies and so on. if u can help me please do
 
Level 22
Joined
Jan 10, 2005
Messages
3,426
thats cuz the variable 'Number_of_Units' stays 0, u think it will go down if creeps die? u will have to do that urself, just make a trigger like this:

Events: unit dies
Conditons: unit = player neutral hostile
Actions: set Number_of_units = (airthematic) Number_of_units - 1

so when u killed 100 creeps it stands on 0 and then the new wave will spawn
 
Level 4
Joined
Jan 14, 2005
Messages
73
i know i did that. my problem is that i cant get the creeps to stop spawning they keep spawning every time the trigger is run. quite anoyying because when i test it it lags after about 30 seconds cause theres 2 many units to load
 
Level 4
Joined
Jan 14, 2005
Messages
73
my problem isnt that they dont spawn its that they spawn to quick before i kill the previous level so lets say i just started as soon as it starts it spawns my first wave (Chickens) but before i can kill the chickens it spawns my second wave (Bunnys) and then when they are both there it spawns my next wave (Deer) And so on so i get 10 waves of creeps in about 20 seconds. so my problem isnt that they wont spawn its that they spawn 2 fast

Edit: how do i host the map on this webpage so that u can see my problem or can i send it 2 ur e-mail
 
Level 6
Joined
Feb 18, 2005
Messages
263
i might suggest another trigger.
(sry i haven't looked into yours, but i know of a way that might be more efficent, even though more complex)

Variables::
  • 'stack_ut' - unittype - array - max size
  • 'stack_am' - integer - array - max size
  • 'stack_len' - integer


TRIGGER 00

Event::
- Every 1 second
Condition:
- integer - Number of units in (playable map area) <= 100 //i use 100 as a value of which i guess it does not lag - adjust to your liking
- integer - stack_len >= 0
Action::
- for each Integer A - 1 to 10 //i create 10 units at once, so even bigger numbers can get spawned quite fast - even though i do check the 100 limit for each of them
- - if
- - - integer - Number of units in (playable map area) <= 100 //i use 100 as a value of which i guess it does not lag - adjust to your liking
- - - integer - stack_len >= 0
- - then
- - - if
- - - - stack_am[stack_len] = 0
- - - then
- - - - set stack_len = stack_len - 1
- - - else
- - - - Create 1 stack_ut[stack_len]
- - - - set stack_am[stack_len] = stack_am[stack_len] - 1

TRIGGER 01

Event::
- //your event to spawn a new wave
Cond::
Action::
- set stack_ut[stack_len+1] = //the unittype of the current wave
- set stack_am[stack_len+1] = //the number of creatures of that type
- set stack_len = stack_len + 1





i know this is quite complex.
And it has 1 bug:
if a wave is not completly spawned, and a new one is to be spawned, the new one has priority. So the remaining ones of the old wave will be spawned after the ones of the current wave are done.

But besides that, this is an easy way to get along with spawning massive waves without any lagg-issue.
(you might even create triggers to adjust the '100 units max on ma' limitation so the player can set it to their liking)

i hope this helps you. If it doesn't tell so and i will take a look at your trigger.

- Raszul[/u]
 
Status
Not open for further replies.
Top