HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Population Check

02-11-2005, 03:20 PM#1
paperclip
Okay, i wanted to know how to make it so that if there are 34 units that a player posesses, then the trigger to make new units instantly will stop so that it won't create anymore units. Also, when less than 34 units are possessed by a player then the creation of other units will be allowed.

If, you are confused this goes along with my other question about making a footman stand in a region and create 17 units from two other regions. So i want a trigger that deactivates the create trigger if the units owned by a player is 34 and when a unit dies or population is under 34 that the unit on the region will create until the population reaches 34 againn. Sorry if this makes no since. Can't think of another way to word it.
02-11-2005, 03:42 PM#2
Aiursrage2k
Make a unit group that checks for the players units, which are alive. Then simply check to see if the unitgroup size is less than 34, if so spawn it, otherwise do not.
02-11-2005, 08:09 PM#3
johnfn
Or you could just set the food amount to 34 ;)

Also, auir, being technical, wouldnt that leak a unit group?
02-11-2005, 08:50 PM#4
ThyFlame
And IF/THEN/ELSE would be the most effective.

Alternatively you could run a periodic check that would turn on/off the spawning trigger, but if you've looped it to run for all players you'd need to use the IF/THEN/ELSE method.
02-11-2005, 08:58 PM#5
Guest
Events -
A unit finishes construction
A unit is created
(put any other event that involves the triggering or normal creation of a unit)

Conditions - Ø

Actions -
If (number of units in (units owned by player(owner of last created unit))) superior to 34, Then remove (last created unit) from the game, Else do nothing
02-12-2005, 01:22 AM#6
paperclip
Well, you see it isn't normal creation of a unit. I guess it would be spawning though so i guess i have to use if/then/else. Well, thanks for the help i'll ask if it doesn't work properly.
02-12-2005, 02:08 AM#7
yuripro84
You mean something like.....

EVENT
every XXX sec
CONDITION
Units owned by player (color) = or less than (number)
ACTION
Create XXX unit at center of XXX region
02-12-2005, 03:04 AM#8
ThyFlame
Basically, you're current trigger will go in the THEN section.

IF
X < 34
THEN
-Current spawn trigger actions-
ELSE
Do nothing
02-12-2005, 02:39 PM#9
paperclip
Quote:
Originally Posted by ThyFlame
Basically, you're current trigger will go in the THEN section.

IF
X < 34
THEN
-Current spawn trigger actions-
ELSE
Do nothing

What does the "X" mean? Would that represent a number less than 34 because i want it to be anything less than 34 to still create.

The "Then" part of the trigger means what. Because i can't find anything like that under actions.
02-12-2005, 05:51 PM#10
paperclip
Okay, here is an example of what i've done so far with what you guys have said. It works, yes, but the way i did it makes it so that it won't loop unless you patrol you guy on the region. So is there a way i can get this to loop?

02-12-2005, 06:55 PM#11
Guest
Your condition seems false to me. It should not be "unit - footman 0030 <gen>" but "unit type - footman"
02-12-2005, 07:20 PM#12
paperclip
Quote:
Originally Posted by BadFurDay
Your condition seems false to me. It should not be "unit - footman 0030 <gen>" but "unit type - footman"

Well, i did the custom unit footman so i could set the food for it to 0 so it doesn't take up any of the food limit. That way only the produced units count.
02-12-2005, 07:36 PM#13
Guest
you could set the events and conditions like so

Event: Time - Every 2.00 seconds of game time
Conditions: ((Region) contains [CustomUnit]) Equal to True

and the rest looks good. i dunno if it would work, but im confident
02-12-2005, 10:43 PM#14
johnfn
Let me just give a side note: you can copy triggers to text just by right clicking the entire thing at the top.
02-13-2005, 05:30 PM#15
paperclip
Nah, duh, but the text to me is insuffecient because i like to see the color and not just boring black and white.