How to make new building conditional on NOT terrain?

Salmo

Chieftain
Joined
Oct 24, 2016
Messages
64
I have a new building (a water well) that I want to make available in a city production list but only if the city is NOT built on a river OR does not have a river available within it's production zone AND is not on the coast. How can this be done?
 
I have a new building (a water well) that I want to make available in a city production list but only if the city is NOT built on a river OR does not have a river available within it's production zone AND is not on the coast. How can this be done?
I don't believe there is an XML command that will allow you to do this. What I would do is make the Well mutually exclusive to the Watermill OR create a free building that requires a river in the city center that is mutually exclusive to the well. Just don't give the free building any benefits.
 
The only way I know to currently do all that is with an edit to the production lua to check for it. If you really want to have all those parameters, I would be glad to try to help you with the lua edit.
Be careful with adding checks on the UI part of the code, as the AI could totally ignore it.
gyogen2, did you test this in-game to see whether the AI would still build it? It would be great if we can just code requirements in Lua but for Civ5 it required custom events modded into the dll before we could do this.

What I would like is to have resources as a prerequisite for constructing buildings.
You can check for adjacent resources but not resources in city radius like Forge or Stoneworks in civ5 :(

The hidden dummy building was a tried and trusted way of modding otherwise impossible effects in Civ5 and i expect it to come back to Civ6.
 
Last edited:
Be careful with adding checks on the UI part of the code, as the AI could totally ignore it.
gyogen2, did you test this in-game to see whether the AI would still build it? It would be great if we can just code requirements in Lua but for Civ5 it required custom events modded into the dll before we could do this.


You can check for adjacent resources but not resources in city radius like Forge or Stoneworks in civ5 :(

The hidden dummy building was a tried and trusted way of modding otherwise impossible effects in Civ5 and i expect it to come back to Civ6.
Adjacent resources only works for Wonders right now not buildings. Firaxis put a note in there stating this. Not everything in the buildings table works for buildings.
 
I haven't really tested this out yet, but maybe you could have a look at the <Inverse> command, like this one for example (Improvements.xml):
Code:
  <Row>
   <RequirementId>REQUIRES_PLOT_IS_NOT_OWNER_CAPITAL_CONTINENT</RequirementId>
   <RequirementType>REQUIREMENT_PLOT_IS_OWNER_CAPITAL_CONTINENT</RequirementType>
   <Inverse>true</Inverse>
  </Row>
 
I haven't really tested this out yet, but maybe you could have a look at the <Inverse> command, like this one for example (Improvements.xml):
Code:
  <Row>
   <RequirementId>REQUIRES_PLOT_IS_NOT_OWNER_CAPITAL_CONTINENT</RequirementId>
   <RequirementType>REQUIREMENT_PLOT_IS_OWNER_CAPITAL_CONTINENT</RequirementType>
   <Inverse>true</Inverse>
  </Row>
I don't think buildings use the Requirements table. It looks like they still uses old fixed requirements rather than the new more flexible Requirements and RequirementSets tables.
 
I don't believe there is an XML command that will allow you to do this. What I would do is make the Well mutually exclusive to the Watermill OR create a free building that requires a river in the city center that is mutually exclusive to the well. Just don't give the free building any benefits.

This is spot on. Use 'MODIFIER_SINGLE_CITY_GRANT_BUILDING_IN_CITY_IGNORE' to spawn a free building that is mutually exclusive with the well. Use it on the City Centre (it seems that this modifier must be applied to Districts, not Cities) with the terrain specifications as the requirement's modifier.
 
Back
Top Bottom