Yields mod not working

Iconian

Chieftain
Joined
May 16, 2021
Messages
73
I've created a mod that changes the yields of the terrains in the game, including adding happiness to different tiles, and inflicting damage or healing to units depending on the terrain.

Unfortunately, NONE of the changes I've made in the mod are taking effect. ModBuddy doesn't give me any errors, but when I loaded up a game with it, it's as though the mod wasn't loaded at all. I'll include the text of the mod below. I've also begun using logging for my mods, so I can include that text as well, but I'm not exactly sure how to interpret the database.log file, as it has tons of stuff in it even with no mods loaded.

Anyway, can anyone enlighten me on why this mod wouldn't be working at all? I'd appreciate it, thank you in advance :)


Spoiler Mod text :

<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 6/24/2021 11:05:50 PM -->
<GameData>
<Terrains>
<Row>
<Where Type="TERRAIN_GRASS"/>
<Set TurnDamage="-4"/>
</Row>
<Row>
<Where Type="TERRAIN_DESERT"/>
<Set TurnDamage="8"/>
</Row>
<Row>
<Where Type="TERRAIN_TUNDRA"/>
<Set TurnDamage="7"/>
</Row>
<Update>
<Where Type="TERRAIN_SNOW"/>
<Set Movement="2"/>
</Update>
<Row>
<Where Type="TERRAIN_SNOW"/>
<Set TurnDamage="10"/>
</Row>
<Row>
<Where Type="TERRAIN_HILL"/>
<Set TurnDamage="2"/>
</Row>
</Terrains>
<Terrain_Yields>
<Update>
<Where TerrainType="TERRAIN_GRASS"/>
<YieldType>YIELD_FOOD</YieldType>
<Set Yield="10"/>
</Update>
<Row>
<Where TerrainType="TERRAIN_GRASS"/>
<YieldType>YIELD_PRODUCTION</YieldType>
<Set Yield="4"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_GRASS"/>
<YieldType>YIELD_SCIENCE</YieldType>
<Set Yield="1"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_GRASS"/>
<YieldType>YIELD_HAPPINESS</YieldType>
<Set Yield="30"/>
</Row>
<Update>
<Where TerrainType="TERRAIN_PLAINS"/>
<YieldType>YIELD_FOOD</YieldType>
<Set Yield="7"/>
</Update>
<Update>
<Where TerrainType="TERRAIN_PLAINS"/>
<YieldType>YIELD_PRODUCTION</YieldType>
<Set Yield="7"/>
</Update>
<Row>
<Where TerrainType="TERRAIN_PLAINS"/>
<YieldType>YIELD_SCIENCE</YieldType>
<Set Yield="1"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_PLAINS"/>
<YieldType>YIELD_HAPPINESS</YieldType>
<Set Yield="10"/>
</Row>
<Update>
<Where TerrainType="TERRAIN_TUNDRA"/>
<YieldType>YIELD_FOOD</YieldType>
<Set Yield="2"/>
</Update>
. <Row>
<Where TerrainType="TERRAIN_TUNDRA"/>
<YieldType>YIELD_PRODUCTION</YieldType>
<Set Yield="2"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_TUNDRA"/>
<YieldType>YIELD_SCIENCE</YieldType>
<Set Yield="3"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_TUNDRA"/>
<YieldType>YIELD_HAPPINESS</YieldType>
<Set Yield="-70"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_DESERT"/>
<YieldType>YIELD_FOOD</YieldType>
<Set Yield="2"/>
</Row>
. <Row>
<Where TerrainType="TERRAIN_DESERT"/>
<YieldType>YIELD_PRODUCTION</YieldType>
<Set Yield="2"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_DESERT"/>
<YieldType>YIELD_SCIENCE</YieldType>
<Set Yield="3"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_DESERT"/>
<YieldType>YIELD_HAPPINESS</YieldType>
<Set Yield="-80"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_SNOW"/>
<YieldType>YIELD_SCIENCE</YieldType>
<Set Yield="5"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_SNOW"/>
<YieldType>YIELD_HAPPINESS</YieldType>
<Set Yield="-100"/>
</Row>
<Update>
<Where TerrainType="TERRAIN_COAST"/>
<YieldType>YIELD_FOOD</YieldType>
<Set Yield="9"/>
</Update>
<Row>
<Where TerrainType="TERRAIN_COAST"/>
<YieldType>YIELD_PRODUCTION</YieldType>
<Set Yield="4"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_COAST"/>
<YieldType>YIELD_SCIENCE</YieldType>
<Set Yield="2"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_COAST"/>
<YieldType>YIELD_HAPPINESS</YieldType>
<Set Yield="30"/>
</Row>
<Update>
<Where TerrainType="TERRAIN_OCEAN"/>
<YieldType>YIELD_FOOD</YieldType>
<Set Yield="3"/>
</Update>
<Row>
<Where TerrainType="TERRAIN_OCEAN"/>
<YieldType>YIELD_PRODUCTION</YieldType>
<Set Yield="2"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_OCEAN"/>
<YieldType>YIELD_SCIENCE</YieldType>
<Set Yield="3"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_OCEAN"/>
<YieldType>YIELD_HAPPINESS</YieldType>
<Set Yield="-20"/>
</Row>
</Terrain_Yields>
<Terrain_RiverYieldChanges>
<Row>
<Where TerrainType="TERRAIN_GRASS"/>
<YieldType>YIELD_FOOD</YieldType>
<Set Yield="15"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_GRASS"/>
<YieldType>YIELD_PRODUCTION</YieldType>
<Set Yield="4"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_GRASS"/>
<YieldType>YIELD_SCIENCE</YieldType>
<Set Yield="1"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_GRASS"/>
<YieldType>YIELD_HAPPINESS</YieldType>
<Set Yield="50"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_PLAINS"/>
<YieldType>YIELD_FOOD</YieldType>
<Set Yield="10"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_PLAINS"/>
<YieldType>YIELD_PRODUCTION</YieldType>
<Set Yield="3"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_PLAINS"/>
<YieldType>YIELD_SCIENCE</YieldType>
<Set Yield="1"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_PLAINS"/>
<YieldType>YIELD_HAPPINESS</YieldType>
<Set Yield="20"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_TUNDRA"/>
<YieldType>YIELD_FOOD</YieldType>
<Set Yield="8"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_TUNDRA"/>
<YieldType>YIELD_PRODUCTION</YieldType>
<Set Yield="1"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_TUNDRA"/>
<YieldType>YIELD_SCIENCE</YieldType>
<Set Yield="2"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_TUNDRA"/>
<YieldType>YIELD_HAPPINESS</YieldType>
<Set Yield="30"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_SNOW"/>
<YieldType>YIELD_FOOD</YieldType>
<Set Yield="3"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_SNOW"/>
<YieldType>YIELD_PRODUCTION</YieldType>
<Set Yield="1"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_SNOW"/>
<YieldType>YIELD_SCIENCE</YieldType>
<Set Yield="3"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_SNOW"/>
<YieldType>YIELD_HAPPINESS</YieldType>
<Set Yield="30"/>
</Row>
</Terrain_RiverYieldChanges>
<Terrain_HillsYieldChanges>
<Update>
<Where TerrainType="TERRAIN_GRASS"/>
<YieldType>YIELD_FOOD</YieldType>
<Set Yield="-5"/>
</Update>
<Update>
<Where TerrainType="TERRAIN_GRASS"/>
<YieldType>YIELD_PRODUCTION</YieldType>
<Set Yield="5"/>
</Update>
<Row>
<Where TerrainType="TERRAIN_GRASS"/>
<YieldType>YIELD_SCIENCE</YieldType>
<Set Yield="1"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_GRASS"/>
<YieldType>YIELD_HAPPINESS</YieldType>
<Set Yield="10"/>
</Row>
<Update>
<Where TerrainType="TERRAIN_PLAINS"/>
<YieldType>YIELD_FOOD</YieldType>
<Set Yield="-4"/>
</Update>
<Update>
<Where TerrainType="TERRAIN_PLAINS"/>
<YieldType>YIELD_PRODUCTION</YieldType>
<Set Yield="5"/>
</Update>
<Row>
<Where TerrainType="TERRAIN_PLAINS"/>
<YieldType>YIELD_SCIENCE</YieldType>
<Set Yield="1"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_PLAINS"/>
<YieldType>YIELD_HAPPINESS</YieldType>
<Set Yield="1"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_DESERT"/>
<YieldType>YIELD_FOOD</YieldType>
<Set Yield="1"/>
</Row>
<Update>
<Where TerrainType="TERRAIN_DESERT"/>
<YieldType>YIELD_PRODUCTION</YieldType>
<Set Yield="5"/>
</Update>
<Row>
<Where TerrainType="TERRAIN_DESERT"/>
<YieldType>YIELD_SCIENCE</YieldType>
<Set Yield="2"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_DESERT"/>
<YieldType>YIELD_HAPPINESS</YieldType>
<Set Yield="1"/>
</Row>
<Update>
<Where TerrainType="TERRAIN_TUNDRA"/>
<YieldType>YIELD_FOOD</YieldType>
<Set Yield="1"/>
</Update>
<Update>
<Where TerrainType="TERRAIN_TUNDRA"/>
<YieldType>YIELD_PRODUCTION</YieldType>
<Set Yield="5"/>
</Update>
<Row>
<Where TerrainType="TERRAIN_TUNDRA"/>
<YieldType>YIELD_SCIENCE</YieldType>
<Set Yield="2"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_TUNDRA"/>
<YieldType>YIELD_HAPPINESS</YieldType>
<Set Yield="1"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_SNOW"/>
<YieldType>YIELD_PRODUCTION</YieldType>
<Set Yield="4"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_SNOW"/>
<YieldType>YIELD_SCIENCE</YieldType>
<Set Yield="2"/>
</Row>
<Row>
<Where TerrainType="TERRAIN_SNOW"/>
<YieldType>YIELD_HAPPINESS</YieldType>
<Set Yield="2"/>
</Row>
</Terrain_HillsYieldChanges>
<Yields>
<Row>
<ID>6</ID>
<Type>YIELD_HAPPINESS</Type>
<Description>TXT_KEY_YIELD_HAPPINESS</Description>
<IconString>[ICON_HAPPINESS]</IconString>
<MinCity>0</MinCity>
<AIWeightPercent>80</AIWeightPercent>
</Row>
</Yields>
</GameData>
 
Your code has numerous fatal syntax errors, two of which are in the very top chunk of the code. So the game rejects the entire thing.
Code:
<GameData>
                <Terrains>
                    <Row>
                        <Where Type="TERRAIN_GRASS"/>
                        <Set TurnDamage="-4"/>
                    </Row>
  1. Where and Set never occur within Row instructions. They are only allowed within Update instructions.
  2. Table Terrains has no column called TurnDamage. You cannot borrow this column from table Features and jam it into table Terrains.
The syntax of this Update is incorrect
Code:
<Update>
	<Where TerrainType="TERRAIN_GRASS"/>
	<YieldType>YIELD_FOOD</YieldType>
	<Set Yield="10"/>
</Update>
  1. In XML-code terms this is just dangling illegal syntax
    Code:
    <YieldType>YIELD_FOOD</YieldType>
    It is not part of the Where or Set clauses.
  2. The / character closes the Where clause here
    Code:
    <Where TerrainType="TERRAIN_GRASS"/>
  3. In order to add multiple conditions to a Where clause you need an update to look like this
    Code:
    <Update>
    	<Where TerrainType="TERRAIN_GRASS" YieldType="YIELD_FOOD" />
    	<Set Yield="10"/>
    </Update>
    In such an update however there has to be a pre-existing row within the table wherein the combination of TerrainType="TERRAIN_GRASS" and YieldType="YIELD_FOOD" already exists, or the game will do nothing with the update since in such a case there would be nothing to match the Where conditions to.
There is no such thing as YIELD_HAPPINESS. This
Code:
                <Yields>
                    <Row>
                        <ID>6</ID>
                        <Type>YIELD_HAPPINESS</Type>
                        <Description>TXT_KEY_YIELD_HAPPINESS</Description>
                        <IconString>[ICON_HAPPINESS]</IconString>
                        <MinCity>0</MinCity>
                        <AIWeightPercent>80</AIWeightPercent>
                    </Row>
                </Yields>
Will not cure that issue. The game will not do anything at all with it.

Since your code is mostly attempts to change (ie, update) existing rows within the game's various tables, you should be using Update instead of Row sytnax except in the specific instances wherein you know the game does not have a pre-existing row in that specific table with that combination of Terrain / YieldType.
 
Yikes! That's a lot. Thank you very much for all that. I've watched some videos and read some guides but I don't remember any of these things point out in them. Where and set really aren't supposed to go inside "Row?" Looks like I have a lot of changes to make . . .

As far as Turndamage, is it possible to get the Terrains file to use it somehow? And is it possible to get terrain to yield happiness/unhappiness? Would I have to use LUA or SQL or something? I'm trying to focus on things I can do just using XML, but maybe in a future version I could do something.
 
As far as Turndamage, is it possible to get the Terrains file to use it somehow?
With XML (or SQL, same thing really as the game engine converts XML to SQL and then applies it against the database), no.
With Lua, possible, but it would be complex and involve scanning the player's (human, AI, CSes and Barbies) units at the end of their turn, checking to see if they were on a terrain that gave damage and applying that damage
With C++ (DLL modding), I've probably already done this (know I added extra damage, can't remember the exact details)

And is it possible to get terrain to yield happiness/unhappiness?
With XML/SQL, no
With Lua, possible, but it would be very complex and involve scanning the player's cities to see what tiles they control and adding/removing fake happiness buildings to the city appropriately. Pretty sure LeeS has utilities that would help with this process.
With C++, again possible, VP may have already done it, but very complex
 
Thank you both for all your input. I originally found the Turndamage in the Features file with the fallout, and figured I could use it with other stuff too. If it's not going to be that simple though then I guess I'll have to wait on it. At any rate, I don't fancy learning how to use LUA, certainly not when there's so many other things I still want to do with the mod.
 
Top Bottom