If you're talking about a footies style map, then use the supply limit already in-game. Make each unit reduce the supply (found in the data editor for each unit) by -1, and have your trigger check to see if the player's 'supply used' is equal to it's 'supply maximum'.
Alternatively, the better way to do this is through the data editor only. Create a behavior that has a periodic create unit effect, and add a validator (disable) to the behavior. The validator will be of type 'Player Compare Food Used', and the value will be whatever you want your supply cap to be (in this case, 100.) This way, your behavior will spawn a unit every (periodic duration, like 1 second) if and only if the supply cap has not been reached.
I suppose other than using the data editor, which can be confusing to new comers, you can simply use a trigger. Since you posted in the trigger section, I am going to assume that is what you are trying to do, through triggers.
First you need a timer of periodic behavior, and all it does is spawn X amount of unit. However, each time it spawns X amount of unit, make sure you have a global variable that keeps track of the total amount of units you have. Finally, you want to add a condition to the trigger. In short:
Variables:
Spawner (Timer, periodic)
Max Unit (Integer)
Current Unit Count (Integer)
Units Per Spawn (Integer)
Trigger:
Event = Spawner expires
Condition = (Current Unit Count + Units Per Spawn) < Max Unit
Action = 1) Create Unit for a player 2) Modify Current Unit Count to + Units Per Spawn
Just change the Events and what unit you want created. The unit group checks to see if the number of units is less then or equal to 100 and if it is so it will spawn another unit.
hi im new to this and im just starting to learn and was wondering how you can limit the amount of units created.
like max 100 will spawn and no more till 1 dies and it will spawn 1 more.
@zISilenced: Go
If you're talking about a footies style map, then use the supply limit already in-game. Make each unit reduce the supply (found in the data editor for each unit) by -1, and have your trigger check to see if the player's 'supply used' is equal to it's 'supply maximum'.
Alternatively, the better way to do this is through the data editor only. Create a behavior that has a periodic create unit effect, and add a validator (disable) to the behavior. The validator will be of type 'Player Compare Food Used', and the value will be whatever you want your supply cap to be (in this case, 100.) This way, your behavior will spawn a unit every (periodic duration, like 1 second) if and only if the supply cap has not been reached.
@zISilenced: Go
I suppose other than using the data editor, which can be confusing to new comers, you can simply use a trigger. Since you posted in the trigger section, I am going to assume that is what you are trying to do, through triggers.
First you need a timer of periodic behavior, and all it does is spawn X amount of unit. However, each time it spawns X amount of unit, make sure you have a global variable that keeps track of the total amount of units you have. Finally, you want to add a condition to the trigger. In short:
Variables:
Trigger:
i just figured out how to create a unit today lol but i cant understand what your saying i should do this is what ive done
3 variables (global) i think i dont know how u make it global. max units 41 units per spawn 1 current unit count 0
trigger
create unit marine
i added a local variable thinking thats what you ment but im guessing it isnt.
thank you in advanced
@zISilenced: Go
I might have described this to you or someone else. Try doing this.
Just change the Events and what unit you want created. The unit group checks to see if the number of units is less then or equal to 100 and if it is so it will spawn another unit.