• Paradox Games has announced today their new game “Millennia”, a semi-historical turn-based 4X game. Find out more here .

[BNW] Improvement_ValidTerrains and ResourceMakesValid talking past each other?

A_Wandering_Man

Chieftain
Joined
Oct 31, 2019
Messages
47
Location
Canada
Hi all,
Been working on adding a new improvement in one of my new mods (the Gorons from LoZ), and it appears to be working as intended, besides the fact that it's supposed to only be buildable on Hills. It is instead buildable on Hills and non-Hill tiles with the resources it is meant to improve.

Is there a way to limit it to only Hill tiles, while still preserving its ability to improve certain resources?

This is all that's in the valid terrains bit right now:
Code:
<Improvement_ValidTerrains>
   <Row>
      <ImprovementType>IMPROVEMENT_NCLJ_BOMB_FLOWER_GARDEN</ImprovementType>
      <TerrainType>TERRAIN_HILL</TerrainType>
   </Row>
 </Improvement_ValidTerrains>
And resource types:
Code:
  <Improvement_ResourceTypes>
     <Row>
         <ImprovementType>IMPROVEMENT_NCLJ_BOMB_FLOWER_GARDEN</ImprovementType>
         <ResourceType>RESOURCE_IRON</ResourceType>
         <ResourceMakesValid>1</ResourceMakesValid>
         <ResourceTrade>1</ResourceTrade>
         <DiscoveryRand>0</DiscoveryRand>
         <QuantityRequirement>0</QuantityRequirement>
     </Row>
     <Row>
         <ImprovementType>IMPROVEMENT_NCLJ_BOMB_FLOWER_GARDEN</ImprovementType>
         <ResourceType>RESOURCE_COAL</ResourceType>
         <ResourceMakesValid>1</ResourceMakesValid>
         <ResourceTrade>1</ResourceTrade>
         <DiscoveryRand>0</DiscoveryRand>
         <QuantityRequirement>0</QuantityRequirement>
     </Row>
     <Row>
         <ImprovementType>IMPROVEMENT_NCLJ_BOMB_FLOWER_GARDEN</ImprovementType>
         <ResourceType>RESOURCE_ALUMINUM</ResourceType>
         <ResourceMakesValid>1</ResourceMakesValid>
         <ResourceTrade>1</ResourceTrade>
         <DiscoveryRand>0</DiscoveryRand>
         <QuantityRequirement>0</QuantityRequirement>
     </Row>
     <Row>
         <ImprovementType>IMPROVEMENT_NCLJ_BOMB_FLOWER_GARDEN</ImprovementType>
         <ResourceType>RESOURCE_URANIUM</ResourceType>
         <ResourceMakesValid>1</ResourceMakesValid>
         <ResourceTrade>1</ResourceTrade>
         <DiscoveryRand>0</DiscoveryRand>
         <QuantityRequirement>0</QuantityRequirement>
     </Row>
     <Row>
         <ImprovementType>IMPROVEMENT_NCLJ_BOMB_FLOWER_GARDEN</ImprovementType>
         <ResourceType>RESOURCE_GEMS</ResourceType>
         <ResourceMakesValid>1</ResourceMakesValid>
         <ResourceTrade>1</ResourceTrade>
         <DiscoveryRand>0</DiscoveryRand>
         <QuantityRequirement>0</QuantityRequirement>
     </Row>
     <Row>
         <ImprovementType>IMPROVEMENT_NCLJ_BOMB_FLOWER_GARDEN</ImprovementType>
         <ResourceType>RESOURCE_GOLD</ResourceType>
         <ResourceMakesValid>1</ResourceMakesValid>
         <ResourceTrade>1</ResourceTrade>
         <DiscoveryRand>0</DiscoveryRand>
         <QuantityRequirement>0</QuantityRequirement>
     </Row>
     <Row>
         <ImprovementType>IMPROVEMENT_NCLJ_BOMB_FLOWER_GARDEN</ImprovementType>
         <ResourceType>RESOURCE_SILVER</ResourceType>
         <ResourceMakesValid>1</ResourceMakesValid>
         <ResourceTrade>1</ResourceTrade>
         <DiscoveryRand>0</DiscoveryRand>
         <QuantityRequirement>0</QuantityRequirement>
     </Row>
     <Row>
         <ImprovementType>IMPROVEMENT_NCLJ_BOMB_FLOWER_GARDEN</ImprovementType>
         <ResourceType>RESOURCE_COPPER</ResourceType>
         <ResourceMakesValid>1</ResourceMakesValid>
         <ResourceTrade>1</ResourceTrade>
         <DiscoveryRand>0</DiscoveryRand>
         <QuantityRequirement>0</QuantityRequirement>
     </Row>
     <Row>
         <ImprovementType>IMPROVEMENT_NCLJ_BOMB_FLOWER_GARDEN</ImprovementType>
         <ResourceType>RESOURCE_SALT</ResourceType>
         <ResourceMakesValid>1</ResourceMakesValid>
         <ResourceTrade>1</ResourceTrade>
         <DiscoveryRand>0</DiscoveryRand>
         <QuantityRequirement>0</QuantityRequirement>
     </Row>
     <Row>
         <ImprovementType>IMPROVEMENT_NCLJ_BOMB_FLOWER_GARDEN</ImprovementType>
         <ResourceType>RESOURCE_MARBLE</ResourceType>
         <ResourceMakesValid>1</ResourceMakesValid>
         <ResourceTrade>1</ResourceTrade>
         <DiscoveryRand>0</DiscoveryRand>
         <QuantityRequirement>0</QuantityRequirement>
     </Row>
     <Row>
         <ImprovementType>IMPROVEMENT_NCLJ_BOMB_FLOWER_GARDEN</ImprovementType>
         <ResourceType>RESOURCE_STONE</ResourceType>
         <ResourceMakesValid>1</ResourceMakesValid>
         <ResourceTrade>1</ResourceTrade>
         <DiscoveryRand>0</DiscoveryRand>
         <QuantityRequirement>0</QuantityRequirement>
     </Row>
  </Improvement_ResourceTypes>
 
<Improvement_ResourceTypes> will over-ride anything in the other "Valid" tables. If the specified resource can appear on a tile not listed as otherwise valid for the improvement, the presence of the resource will make the improvement valid for that plot. For example Iron can appear on flat grassland tiles, so a mine can be constructed on the flat grasslands plot containing the iron resource even though a mine cannot normally be placed on a flat grasslands plot.

I don't know of any case in the Vanilla,, G&K, or BNW code where column "ResourceMakesValid" is set to Boolean false in table "Improvement_ResourceTypes" but you could set this column to false as an experiment to check whether this will cease making the over-ride work for plots that are not otherwise valid for the improvement. [deleted]
 
Last edited:
I have just tested it, and even with the "ResourceMakesValid" set to false (0 -- would writing "false" be different?), I was still able to create the improvement on non-Hill tiles.

EDIT: See below.
 
Last edited:
"false" and "0" in xml files are treated the same.

It would appear that the "ResourceMakesValid" column in table <Improvement_ResourceTypes> has no actual effect, then. It is the listing of the ImprovementType and ResourceType in the table that matters.
 
Just tested a little further after finding this thread where a similar problem was described and realized I was having the same issue (I had "BuildableOnResources" set to true, and could build it on any resource). Setting "ResourceMakesValid" to 0 for a particular resource does stop the improvement being built on that resource in flatland, but also on Hill resources (so it can't be built on that resource at all).

So it does seem like "ResourceMakesValid" straight up overrides "Improvement_ValidTerrains", and the Boolean is just an on/off switch for it (i.e., it does not allow it to be built conditionally if the other validity conditions are met; in this case being on a Hill.)

I am probably just going to limit the number of resources it can be built on (since I am already doing no-two-adjacent) and that should balance it sufficiently...
 
Top Bottom