City-States yield 2 delegates after being conquered/puppeted

mikeburnfire

Warlord
Joined
Oct 4, 2014
Messages
156
I want City-States to yield 2 WC delegates, even after being puppeted by Venice, annexed by Austria, or just outright conquered. What would be the best way of doing this? Give each MinorCiv a Unique Wonder (ala Forbidden Palace) that nobody else can acquire?

I looked at JFD's Germans as a possibility (their UA is that conquered City-States yield 1 delegate). Unfortunately, it's in SQL, so I wouldn't know how to tweak it to apply to everyone. It looks like this:

Code:
function JFD_CityStateConquests(oldOwnerID, isCapital, cityX, cityY, newOwnerID, pop, isConquest)
	local player = Players[newOwnerID]
	local capturedPlayer = Players[oldOwnerID]
	if player:GetCivilizationType() == civilisationID then
		local city = Map.GetPlot(cityX, cityY):GetPlotCity()
		if city:IsOriginalCapital() and capturedPlayer:IsMinorCiv() then
			if not city:IsHasBuilding(buildingDelegateID) then
				city:SetNumRealBuilding(buildingDelegateID, 1)
			end
		end 
	end
end
 
I want City-States to yield 2 WC delegates, even after being puppeted by Venice, annexed by Austria, or just outright conquered. What would be the best way of doing this? Give each MinorCiv a Unique Wonder (ala Forbidden Palace) that nobody else can acquire?

I looked at JFD's Germans as a possibility (their UA is that conquered City-States yield 1 delegate). Unfortunately, it's in SQL, so I wouldn't know how to tweak it to apply to everyone. It looks like this:

Code:
function JFD_CityStateConquests(oldOwnerID, isCapital, cityX, cityY, newOwnerID, pop, isConquest)
	local player = Players[newOwnerID]
	local capturedPlayer = Players[oldOwnerID]
	if player:GetCivilizationType() == civilisationID then
		local city = Map.GetPlot(cityX, cityY):GetPlotCity()
		if city:IsOriginalCapital() and capturedPlayer:IsMinorCiv() then
			if not city:IsHasBuilding(buildingDelegateID) then
				city:SetNumRealBuilding(buildingDelegateID, 1)
			end
		end 
	end
end
  1. ??? -- This is lua code rather than sql code
  2. To butcher-steal-modify the lua code to make it give the dummy defined as "buildingDelegateID" whenever any major player captures an original city-state capital city:
    Code:
    local buildingDelegateID = GameInfoTypes.BUILDING_SOMETHING_OR_OTHER
    
    function CityStateConquestGiveCongressDelegates(oldOwnerID, isCapital, cityX, cityY, newOwnerID, pop, isConquest)
    	local pCapturingPlayer = Players[newOwnerID]
    	local pCity = Map.GetPlot(cityX, cityY):GetPlotCity()
    	--------------------------------------------------------------------------------------------
    	-- the following line is just insurance, the building should not have survived city-capture
    	--------------------------------------------------------------------------------------------
    	pCity:SetNumRealBuilding(buildingDelegateID, 0)
    	if not pCapturingPlayer:IsMinorCiv() and not pCapturingPlayer:IsBarbarian() then
    		-----------------------------------------------------------------------------
    		--player that captured the city is a major civilization
    		--proceed to determine if buildingDelegateID should be added to the city
    			--check that the city is an original capital city
    			--check that the original city owner was a city-state
    			--check that the city 'capture' was a result of conquest and not buyout or peace treaty
    		-----------------------------------------------------------------------------
    		local iOriginalCityOwner = pCity:GetOriginalOwner()
    		local pOriginalCityOwner = Players[iOriginalCityOwner]
    		if pCity:IsOriginalCapital() and pOriginalCityOwner:IsMinorCiv() and isConquest then
    			pCity:SetNumRealBuilding(buildingDelegateID, 1)
    		end
    	end
    end
    GameEvents.CityCaptureComplete.Add(CityStateConquestGiveCongressDelegates)
  3. Make your building give 2 delegates, like as the Forbidden Palace does, but without all the stuff making it into a National or World Wonder, ie:
    Code:
    <GameData>
    	<Buildings>
    		<Row>
    			<Type>BUILDING_SOMETHING_OR_OTHER</Type>
    			<BuildingClass>BUILDINGCLASS_SOMETHING_OR_OTHER</BuildingClass>
    			<Cost>-1</Cost>
    			<FaithCost>-1</FaithCost>
    			<PrereqTech>NULL</PrereqTech>
    			<GreatWorkCount>-1</GreatWorkCount>
    			<ArtDefineTag>NONE</ArtDefineTag>
    			<MinAreaSize>-1</MinAreaSize>
    			<NeverCapture>true</NeverCapture>
    			<HurryCostModifier>-1</HurryCostModifier>
    			<ExtraLeagueVotes>2</ExtraLeagueVotes>
    			<IconAtlas>BW_ATLAS_1</IconAtlas>
    			<PortraitIndex>19</PortraitIndex>
    			<Description>TXT_KEY_SOMETHING_OR_OTHER</Description>
    			<NukeImmune>true</NukeImmune>
    		</Row>
    	</Buildings>
    	<BuildingClasses>
    		<Row>
    			<Type>BUILDINGCLASS_SOMETHING_OR_OTHER</Type>
    			<DefaultBuilding>BUILDING_SOMETHING_OR_OTHER</DefaultBuilding>
    			<Description>TXT_KEY_SOMETHING_OR_OTHER</Description>
    		</Row>
    	</BuildingClasses>
    	<Language_en_US>
    		<Row Tag="TXT_KEY_SOMETHING_OR_OTHER">
    			<Text>Conquered City-State Delegates</Text>
    		</Row>
    	</Language_en_US>
    </GameData>
    • I've defined the building as a hidden building, which is OK for BNW-only because World Congress and 'Delegates' are BNW-only.
    • The building is unpurchasable and unbuildable based on setting of <Cost> and <FaithCost>. It can only be acquired via the lua-script
  4. Only thing I am not 100% sure of is when 'normal' Barbs capture a city, if this is considered a 'CityCaptureComplete' for purposes of firing the event. Normnal Barbs don't keep the city they capture, they just extract tribute-gold and then the capturing unit goes 'poof'. The code as written is done so to account for mods such as Barbs Evolved where Barbarians can actually capture and keep cities.
 
Back
Top Bottom