Prohibiting Certain City-States from Building and Creating Improvements

Hello,

Same flavors affect both minor and major civs so don't change flavors. There is luckily very easy way: NoMinorCivs column at AICityStrategies and AIEconomicStrategies should mostly do the thing. Just set 1 those sets which contributes to tile improvement and buildings.

joltis
 
Hello,

Same flavors affect both minor and major civs so don't change flavors. There is luckily very easy way: NoMinorCivs column at AICityStrategies and AIEconomicStrategies should mostly do the thing. Just set 1 those sets which contributes to tile improvement and buildings.

joltis

The problem is that I don't want it to happen to all city-states but only some of them. I want to have both normal city-states and "tribes" as minor civilizations, and the latter wouldn't build buildings or make improvements.

In regards to the flavors, I didn't mean changing the flavor settings in the buildings and etc. files, but changing those particular city-state's flavors. Here's one example of how I set them up:

Code:
	<MinorCivilization_Flavors>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_EXPANSION</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_NUKE</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_DEFENSE</FlavorType>
			<Flavor>7</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_OFFENSE</FlavorType>
			<Flavor>7</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_WONDER</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_TILE_IMPROVEMENT</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_NAVAL_TILE_IMPROVEMENT</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_GOLD</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_SCIENCE</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_CULTURE</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_NAVAL_GROWTH</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_GROWTH</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_PRODUCTION</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_WATER_CONNECTION</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_MILITARY_TRAINING</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_CITY_DEFENSE</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_HAPPINESS</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_SPACESHIP</FlavorType>
			<Flavor>0</Flavor>
		</Row>
	</MinorCivilization_Flavors>

EDIT: They are still building granaries and etc. despite setting those flavors to 0, unfortunately.
 
Ok if you want that way. Flavors works as a sum so you sum up flavors at various sources and then multiply them by unit and building flavour values. At that table you want to set flavors the minimum value -1000 and that pretty much quarantine that they are never build. There is high values at other tables which for example causes workers build anyway.

So your code looks like this:
Code:
<MinorCivilization_Flavors>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_EXPANSION</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_NUKE</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_DEFENSE</FlavorType>
			<Flavor>7</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_OFFENSE</FlavorType>
			<Flavor>7</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_WONDER</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_TILE_IMPROVEMENT</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_NAVAL_TILE_IMPROVEMENT</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_GOLD</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_SCIENCE</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_CULTURE</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_NAVAL_GROWTH</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_GROWTH</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_PRODUCTION</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_WATER_CONNECTION</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_MILITARY_TRAINING</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_CITY_DEFENSE</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_HAPPINESS</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_SPACESHIP</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
	</MinorCivilization_Flavors>

As a side note minor civs cannot build wonders, settlers or spaceship parts. These definations are elsewhere.

Joltis
 
I've been trying to figure out how to control city state techs for a while now, sadly to no avail yet.

However, you can control what buildings a civ can build like this:

Code:
function CanConstruct(iPlayer, buildingTypeID)
	local player = Players[iPlayer]
	local building = GameInfo.Buildings[buildingTypeID]

	< add logic here to return false if it is city state and prohibited building >

	return true --need this for everyone else
end
GameEvents.PlayerCanConstruct.Add(CanConstruct)

I assume the above works for city states. I use it all the time for regular civs.

I can't think of a way to limit improvements (since you can't control techs). Well, one indirect and complicated way would be to give them a special kind of worker that is more limited in its Builds.
 
Ok if you want that way. Flavors works as a sum so you sum up flavors at various sources and then multiply them by unit and building flavour values. At that table you want to set flavors the minimum value -1000 and that pretty much quarantine that they are never build. There is high values at other tables which for example causes workers build anyway.

So your code looks like this:
Code:
<MinorCivilization_Flavors>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_EXPANSION</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_NUKE</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_DEFENSE</FlavorType>
			<Flavor>7</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_OFFENSE</FlavorType>
			<Flavor>7</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_WONDER</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_TILE_IMPROVEMENT</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_NAVAL_TILE_IMPROVEMENT</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_GOLD</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_SCIENCE</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_CULTURE</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_NAVAL_GROWTH</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_GROWTH</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_PRODUCTION</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_WATER_CONNECTION</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_MILITARY_TRAINING</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_CITY_DEFENSE</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_HAPPINESS</FlavorType>
			<Flavor>0</Flavor>
		</Row>
		<Row>
			<MinorCivType>MINOR_CIV_BATAVIANS</MinorCivType>
			<FlavorType>FLAVOR_SPACESHIP</FlavorType>
			<Flavor>-1000</Flavor>
		</Row>
	</MinorCivilization_Flavors>

As a side note minor civs cannot build wonders, settlers or spaceship parts. These definations are elsewhere.

Joltis

Ah! Thanks for the information :)

I've been trying to figure out how to control city state techs for a while now, sadly to no avail yet.

However, you can control what buildings a civ can build like this:

Code:
function CanConstruct(iPlayer, buildingTypeID)
	local player = Players[iPlayer]
	local building = GameInfo.Buildings[buildingTypeID]

	< add logic here to return false if it is city state and prohibited building >

	return true --need this for everyone else
end
GameEvents.PlayerCanConstruct.Add(CanConstruct)

I assume the above works for city states. I use it all the time for regular civs.

I can't think of a way to limit improvements (since you can't control techs). Well, one indirect and complicated way would be to give them a special kind of worker that is more limited in its Builds.

I wanted to do something of the sort with LUA, yes.

I thought about doing something based on how this code for the 1066 Scenario that comes with the Denmark civilization is done:

Code:
---------------------------------------------------------------------
GameEvents.CityCanConstruct.Add(function(iPlayer, iCity, iBuildingType) 
	
	local iEngland = -1;
	local iLondonX = 43;
	local iLondonY = 17;

	for iPlayer = 0, 3, 1 do

		local pPlayer = Players[iPlayer];
		local playerStartPlot = pPlayer:GetStartingPlot();

		-- London?
		if (playerStartPlot:GetX() == iLondonX and playerStartPlot:GetY() == iLondonY) then
			iEngland = iPlayer;


			break;


		end
	end

	local pPlayer = Players[iPlayer];
	local pCity = pPlayer:GetCityByID(iCity);

	-- Shire Courts 
	if (iBuildingType == GameInfo.Buildings["BUILDING_COURTHOUSE"].ID) then

		-- Only 8+ tiles from London
		if (Map.PlotDistance(pCity:GetX(), pCity:GetY(), iLondonX, iLondonY) < 8) then
			return false;
		end

		-- Only in originally Anglo-Saxon cities
		if (pCity:GetOriginalOwner() ~= iEngland)
 then
			return false;

		end

	end

	-- Domesday Book (only in London)
	if (iBuildingType == GameInfo.Buildings["BUILDING_NATIONAL_COLLEGE"].ID) then

		if (pCity:GetX() ~= iLondonX or pCity:GetY() ~= iLondonY) then
			return false;
		end

	end

	return true;


end);

But unfortunately, I can't even get Lua to work in my mod (although it works in other mods, so I've probably done something wrong in modbuddy).

EDIT: I got the Lua working, and basing myself on the code you posted, managed to make specific Minor Civilizations not able to build buildings:

Code:
function CanConstruct(iPlayer, buildingTypeID)
	local player = Players[iPlayer]
	local building = GameInfo.Buildings[buildingTypeID]

	if (player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_BATAVIANS"].ID or player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_SAXONS"].ID or player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_TUPINIQUIM"].ID or player:GetMinorCivType() == GameInfo.MinorCivilizations["MINOR_CIV_UIGHURS"].ID) then
		return false
	end

	return true --need this for everyone else
end
GameEvents.PlayerCanConstruct.Add(CanConstruct)

Thanks very much! :)
 
Top Bottom