HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Fake Supply System

04-01-2004, 03:20 AM#1
Panto
Greetings.

How would you go about making a fake supply system?

I have a map that spawns units periodically, and I'd like the spawner trigger to not make a unit if the player already has a certain number of those units. Each unit takes 1 supply. In an attempt to keep too many actions from happening on a periodic trigger, I made it so that simply whenever a unit like this is spawned (or summoned, in the case of resurrection), it adds 1 to the appropriate integer variable, and whenever 1 dies, it takes one off. If the integer is equal to or greater than the limit, it doesn't spawn.

This method works almost perfectly, except once in a great while it seems to be willing to allow a player to spawn more than their share of units.

I thought that it would be possible to check to see if a player's currently supply was at a certain amount, but I haven't been able to find that.

Am I missing a better trigger idea? General useful comments or trigger-speak answers are very welcome.
04-01-2004, 04:28 AM#2
Grater
If you could describe the spawn system that could be quite useful to understanding your problem.

Finding the supply used by a player is really easy, it's under player - property, food used.
04-01-2004, 05:51 AM#3
Panto
Great, thanks. I guess I was looking for "supply" and didn't notice "food". Silly me.
04-02-2004, 12:14 AM#4
PEON1577
If all of the units count as one supply then just use the count living units owned by player trigger, if not then just assign a custom number to each unit or keep track of them in varables and then keep checking the current # with the total amount.
04-02-2004, 04:54 AM#5
ThyFlame
And once in a very great while food will still allow an extra unit or two...

Either way, if you check the total # and it's greater than the max, just remove one of the units until its back to the max.
04-02-2004, 05:30 AM#6
Panto
Yea, wc3jass3, the first method is what I mentioned not wanting to do in a periodic event, and the second is what I was doing before I posted this thread. But since Grater pointed out the trigger condition I wanted, I've got the system set up and running.

Thanks, fellows, for all your help.