HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

trigger help

07-01-2002, 07:32 PM#1
Guest
aight, this is what i wanna do, i have a trigger to create units, and it loops, every 1 second another unit, i want this to stop when it creates 50 units, and when one dies, create another, and so on, any ideas? if i dont set a limit, the game becomes extremely laggy, cuz it creates like 500 units after a while, any help will do, please respond asap ;] really wanna finish this map
07-01-2002, 07:52 PM#2
dataangel
Do something like this:

First trigger:

Event
Periodic event, every 2 seconds
Condition
unit count < 50
Action
set var unitcount = unitcount + 1
create unit whatever in region whatever


Second trigger:
Unit dies
Action
set var unitcount = unitcount - 1

Now, this will work just fine for one player, but if you have this happening for like 12 players, then make unitcount an array of integers instead like so:

Event
Periodic event, every 2 seconds
Condition
unit count < 50
Action

-set var unitcount[player number of triggering player] = unitcount[player number of triggering player] + 1

-create unit whatever in region whatever for triggering player


Second trigger:
Unit dies
Action
set var unitcount[player number of triggering player] = unitcount[player number of triggering player] - 1
07-01-2002, 08:38 PM#3
Guest
aight, set var unitcount = unitcount + 1

i not getting that, how do u do unitcount +1? i not pro with this world editor ;\
07-01-2002, 11:34 PM#4
dataangel
OK, ya know how to get into set variable right? Well when you click what value you want to put in, there are 3 options, a plain old value (you just put in the number), a preset, or a function. You want the arithmatic function. It's like this

value operation value

Set the first value to be unit count, the operation to be + sign, and the second value to be 1.
07-02-2002, 10:24 PM#5
Guest
You just need one trigger

Event
-
Every however seconds

Actions
if for multiple players
- for a = 1 to 12 (or however many players)
-if player (a) is controlld by a human player
- if player(a) controls less then 50 units
- create unit for player(a)
- else do nothing
-else do nothing
for one player just do the same thing without the loop, or the first if statement
07-02-2002, 10:29 PM#6
Guest
aight i figured it out no more need for replies, thanks for all help