Now, add something like this before the "return False" (I'm not sure if it's syntactically correct, but hopefully you get what I'm trying to do)...
Code:
if gc.getUnitInfo(eUnit).getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_SETTLER"):
if (gc.getPlayer(pCity.getOwner()).getNumCities >= 5):
return True
This will make it so that if a player has five cities, then the ability to build settlers will not appear. It will also even cancel production of currently in-production settlers.
However, if the player still has settlers alive when the 5th city is built, this will not stop them from building the 6th city with one of those still-alive settlers. There doesn't appear to be a simple way of preventing this without modifying the SDK, so it's probably best to just eliminate those settlers by killing them or converting them to workers or something. However, the way that is probably best would be modifying the SDK's CvPlayer::canFound() function to disallow making cities if already at maximum capacity.
The most basic way is to go into the unitinfos.xml file and set the Settler's cost to -1, this will make them unbuildable by all players. Next you go into civilizationinfos.xml file and change each civ from starting with 1 settler to how many you want them to start with. And bingo, no one will ever have more cities then those they build with the starting settlers. I play lots of gamew with limited cities and there are other ways to do it, but if all else fails this is a garonteed way to do it.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.