Anyone know where to do this in the editor? Found a post on the forum but the editor has since changed, and the way to do it is no longer relevant.
for i, player in Player do
_GetEntities()
–filter out and count tc’s each player has currently
local varnam = _GetCount() - or something like that
if varname >= --new tc limit-- then
Player_SetConstructionMenuAvailability( PlayerID player, String menuname, Integer availability )
Sets the availability of a construction menu. Availability can be either ITEM_LOCKED, ITEM_UNLOCKED, ITEM_REMOVED or ITEM_DEFAULT
Source: [E:\cardinal_BuildSystem_staging\engine\assets\engine\scar\player.scar] (1039)
or
Player_SetEntityProductionAvailability( PlayerID player, Integer bp, Integer availability )
Sets the availability of an entity production item. Availability can be either ITEM_LOCKED, ITEM_UNLOCKED, ITEM_REMOVED or ITEM_DEFAULT
Source: [E:\cardinal_BuildSystem_staging\engine\assets\engine\scar\player.scar] (1027)
make sure to set a rule that re-enables tc building if count drops below limit (ie they get 1 or more tc’s destroyed)
with a Rule_OnEvent(GE_*)
You could also do it like suggested here > Limit certain units or buildings? - #3 by MomentoTR89