[Help Request] Building require foreign continent

thecrazyscot

Spiffy
Joined
Dec 27, 2012
Messages
3,110
What I'm trying to create are Colonial Capitals, and in order to do so I need to be able to (a) require that a building be on a foreign continent and (b) limit the building to one per continent.

If I only needed (a) this would be pretty easy to do...and could be done via xml only. The problem is I need both (a) and (b). I suspect this will require some lua coding, which I have no familiarity with.

Would someone who knows some lua be willing to help me with this?
 
I'm still trying to figure out a way to determine how to mod a "one per continent" requirement. Can anyone help?

Some thoughts:
  • Is there anyway to get what continent a city is on in the gameplay context? It's possible in a UI context, because otherwise the game couldn't display continents in the tool tip.

  • Spain's Treasure Fleet ability references a TRAIT_INTERCONTINENTAL_DOMESTIC_FOOD and TRAIT_INTERCONTINENTAL_DOMESTIC_PRODUCTION, but I can't see any requirements for those. Is there something here that could be used?
 
Probably not, tho if you are clever perhaps. The intercontinental bit is handled directly in the modifier arguments
Code:
		<Row>
			<ModifierId>TRAIT_INTERCONTINENTAL_DOMESTIC_FOOD</ModifierId>
			<Name>YieldType</Name>
			<Value>YIELD_FOOD</Value>
		</Row>
		<Row>
			<ModifierId>TRAIT_INTERCONTINENTAL_DOMESTIC_FOOD</ModifierId>
			<Name>Amount</Name>
			<Value>1</Value>
		</Row>
		<Row>
			<ModifierId>TRAIT_INTERCONTINENTAL_DOMESTIC_FOOD</ModifierId>
			<Name>Intercontinental</Name>
			<Value>true</Value>
		</Row>
The modifier type used is defined as
Code:
		<Row>
			<ModifierType>MODIFIER_PLAYER_ADJUST_TRADE_ROUTE_YIELD_FOR_DOMESTIC</ModifierType>
			<CollectionType>COLLECTION_OWNER</CollectionType>
			<EffectType>EFFECT_ADJUST_TRADE_ROUTE_YIELD_FOR_DOMESTIC</EffectType>
		</Row>
 
You may be able to do this by using a "dummy" building that appears in a city when it meets the condition of being on another continent. The tricky part is making it fire only once, the first time a city meets the conditions. The dummy building is a prereq to build your special building.

Altho I've not tried the "unique to one continent" element, the dummy building concept described above is precisely how the "Bedrock" feature of my Quo's Combined Tweaks mod works. It places a dummy "bedrock" building in a city when the city meets certain criteria (builds an Encampment, builds a wonder, aquires X num of deep ocean tiles, etc). The bedrock buildings are prereqs for Ancient Medieval and Ren. walls.

Keep in mind if you go this route you need a little bit of supporting Lua to repair the dummy buildings if the city gets captured. City captures in general are the biggest PITA about working with dummy buildings... you'd need a way to remove the building from a city under certain conditions.
 
Back
Top Bottom