Help changing yeilds.

Sixdeadwisemen

Chieftain
Joined
Jul 11, 2021
Messages
2
I opened a project in mod buddy.
The project was an empty mod GS version.
I added a existing item to it.
The file was terrains.xml
Inside terrains XML I changed this line

<Row terraintype="TERRAIN_GRASS" YeildType="Yeild_food" YeildChange="2"/>

To

<Row terraintype="TERRAIN_GRASS" YeildType="Yeild_food" YeildChange="4"/>

Then I set in game actions to update database.

Then I added terrains.xlm
Then I saved and built the project.

I enabled the mod in the mods section
I started a quick game
Everything loaded.
The grass tile was only 2 food

Why does the change not apply???
 
Because of the way SQL databases work.

There is already a row within table Terrain_YieldChanges wherein the TerrainType is "TERRAIN_GRASS" and the YieldType is "YIELD_FOOD". So any attempt to add a second such row (which is what your code would be attempting to do) will be rejected because of Unique Constraint rules.

The database is not changed by adding copies of the existing game-files and then activating them by UpdateDatebase actions. The original game file and its data that is added to the game database is not altered or updated within the game database by the changes you make to a copy of the same-named file within a mod by an over-write the original file kind of way.

To alter the existing effect of "TERRAIN_GRASS" for the Terrain_YieldChanges table what you need is an Update command rather than a row command. In order to make the alteration you have specified all that is needed (and desired) within an xml file is
Code:
<GameData>
	<Terrain_YieldChanges>
		<Update>
			<Where TerrainType="TERRAIN_GRASS" YieldType="YIELD_FOOD" />
			<Set YieldChange="4"/>
		</Update>
	</Terrain_YieldChanges>
</GameData>
You alter the specific data you want to change rather than adding an entire over-write of the original file's contents.
 
Do I need to put it in front end or in game.
Should I use update database?

I deleted terrains.xml.
Created a new XML called yields
Added the code snippet.
It's still doing nothing?

Whoops. I had an _ in Yield_Type.
 
Last edited:
It would be an InGame Action and the action-type would UpdateDatabase.

Also, when a mod does not appear to be working, check Database.log for error messages. Database.log is just a text file and can be opened with Notepad, Notepad++, or any other text editor program you might have on your computer. The log will be at
~\Documents\My Games\Sid Meier's Civilization VI\Logs
That's for a windows PC. For Mac and other whatnot systems I am not sure where the error logs (if there are any) are located.
 
Back
Top Bottom