# Limiting unit amount

#### Stretch

##### New Member
Hey guys, What I want is to limit the amount of units a player can have while not including specific types of units such as builders and civilians, The limit I am wanting is 1000 so can't use the food limit as I can only get that to be 300.

if you don't understand what I want just please ask and I will try explain again.

#### Mahrloc

##### New Member
the easiest way i could imagine is to check the amount of units in the map everytime a unit is trained.

Trigger:
• Limit Units
• Events
• Unit - A unit Starts training a unit
• Conditions
• Actions
• Set Unit_Group = (Units owned by (Owner of (Triggering unit)))
• Unit Group - Pick every unit in Unit_Group and do (Actions)
• Loop
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• 'IF'
• (Unit-type of (Picked unit)) Equal to //Unit with food cost 1
• 'THEN'
• Set Counter = (Counter + 1)
• 'ELSE'
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• 'IF'
• (Unit-type of (Picked unit)) Equal to //Unit with food cost 2
• 'THEN'
• Set Counter = (Counter + 2)
• 'ELSE'
• Set Unit_Group2 = (Units of type //food producing building)
• Set Counter2 = (Units in Unit_Group2) * //amount of food they provide )
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• 'IF'
• (Counter / Counter) &gt; 1
• 'THEN'
• Stop training unit(don't know the order for this sry<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite3" alt=":(" title="Frown :(" data-shortname=":(" /> )
• 'ELSE'
• Set Counter = 0
• Set Counter2 = 0
• Custom script: call DestroyGroup(udg_Unit_Group)
• Custom script: call DestroyGroup(udg_Unit_Group2)

you somehow still have to add the food costs of the trained units to Counter but atm i got no clue how to sry^^'

#### Ashlebede

##### New Member
Having 1000 units per player would be... excessively excessive. I really don't suggest it, there is a reason why there is a 300-food limit. 1,000 units per player would mean an unplayable map.

#### Stretch

##### New Member
The reason for 1000 is that my map is a village builder map and having large armies is key, I am wanting to limit it to 1000 because at the moment people are making far more than that and causing graphics glitches causing massive lagg but I don't want to remove the fun of having a massive army, my units are halved from their original size and camera zoomed out to make controlling them possible.

#### Ashlebede

##### New Member
1,000 units will always make the map lag, unless you have an omg wtf imbaaa computer. Especially since you can only control 12 units at a time. And it would screw up their AI. Keep in mind that Warcraft3 units are 3-D models that ain't pre-rendered and that having too many units will make them "slow-minded". Make every unit cost 1 food and set food limit to 300. Make your units stronger if necessary. That is all.

#### Accname

##### 2D-Graphics enthusiast
1000 units will not just make it lag but the game will most definitely not work. since more then 200 units owned by the same player will make the standard ai messy and not work.

General chit-chat
Help Users
• No one is chatting at the moment.
• V-SNES:
Happy Sunday!
+1
• ToshibaNuon:
Happy sunday!
+2
• The Helper:
And its Friday!
• The Helper:
Happy Saturday!
+1
• V-SNES:
Happy Saturday!
• The Helper:
Happy Monday!
• V-SNES:
Happy Friday!
+1
• The Helper:
Happy Friday!
+1
• tom_mai78101:
Starting this upcoming Thursday, I will be in Japan for 10 days.
• tom_mai78101:
Thursday - Friday will be my Japan arrival flight. 9 days later, on a Sunday, will be my return departure flight.
+2
• The Helper:
Hope you have safe travels my friend!
+1
• vypur85:
Wow spring time in Japan is awesome. Enjoy!
• The Helper:
Hopefully it will be more pleasure than work
• vypur85:
Recently tried out ChatGPT about WE triggering. Wow it's capable of giving a somewhat legitimate response.
• The Helper:
I am sure it has read all the info on the forums here
• The Helper:
i think triggering is just scripting and chatgpt is real good at code
• vypur85:
Yeah I suppose so. It's interesting how it can explain in so much detail.
• vypur85:
But yet it won't work.
• The Helper:
it does a bad ass job doing excel vba code it has leveled me up at my job when I deal with excel that is for sure
• vypur85:
Nice! I love Excel coding as well. Has always been using Google to help me. Maybe I'll use ChatGPT next time when I need it.
• The Helper:
yeah whatever it puts out even if it is not perfect I can fix it and the latest version of chatgpt can create websites from pictures it will not be long until it can do that with almost all the tools
+1
• The Helper:
These new Chat AI programs are going to change everything everyone better Buckle the Fuck Up!
• The Helper:
oh and Happy Tuesday Evening!