Assistance Converting Terrain Yield Edit to a Mod

isau

Deity
Joined
Jan 15, 2007
Messages
3,071
Hey guys,

I need some basic pointers on where to look for converting tile yield conversions to a mod. I am well versed in XML from experience with Civ 4, but am having trouble making the leap to the method used in 5/6 where we need to set up XML to overwrite what already exists versus simply replacing it. I was able to edit the XML in my game directly to produce changes in Yields, but how do I do it in a mod? Changed lines are highlighted.

<Terrain_YieldChanges>
<Row TerrainType="TERRAIN_GRASS" YieldType="YIELD_FOOD" YieldChange="2"/>
<Row TerrainType="TERRAIN_GRASS_HILLS" YieldType="YIELD_FOOD" YieldChange="1"/>
<Row TerrainType="TERRAIN_PLAINS" YieldType="YIELD_FOOD" YieldChange="1"/>
<Row TerrainType="TERRAIN_PLAINS_HILLS" YieldType="YIELD_FOOD" YieldChange="0"/>
<Row TerrainType="TERRAIN_TUNDRA" YieldType="YIELD_FOOD" YieldChange="1"/>
<Row TerrainType="TERRAIN_TUNDRA_HILLS" YieldType="YIELD_FOOD" YieldChange="1"/>
<Row TerrainType="TERRAIN_COAST" YieldType="YIELD_FOOD" YieldChange="1"/>
<Row TerrainType="TERRAIN_COAST" YieldType="YIELD_GOLD" YieldChange="2"/>
<Row TerrainType="TERRAIN_OCEAN" YieldType="YIELD_FOOD" YieldChange="1"/>
<Row TerrainType="TERRAIN_GRASS_HILLS" YieldType="YIELD_PRODUCTION" YieldChange="1"/>
<Row TerrainType="TERRAIN_PLAINS" YieldType="YIELD_PRODUCTION" YieldChange="1"/>
<Row TerrainType="TERRAIN_PLAINS_HILLS" YieldType="YIELD_PRODUCTION" YieldChange="2"/>
<Row TerrainType="TERRAIN_TUNDRA" YieldType="YIELD_PRODUCTION" YieldChange="1"/>
<Row TerrainType="TERRAIN_TUNDRA_HILLS" YieldType="YIELD_PRODUCTION" YieldChange="1"/>

<Row TerrainType="TERRAIN_SNOW_HILLS" YieldType="YIELD_PRODUCTION" YieldChange="1"/>
<Row TerrainType="TERRAIN_DESERT" YieldType="YIELD_PRODUCTION" YieldChange="1"/>
<Row TerrainType="TERRAIN_DESERT_HILLS" YieldType="YIELD_PRODUCTION" YieldChange="1"/>

</Terrain_YieldChanges>
 
use SQL like this

UPDATE Terrain_YieldChanges SET YieldChange="1" WHERE TerrainType="TERRAIN_GRASS_HILLS" AND YieldType="YIELD_FOOD"
(when row already exist and you wanna only change some values)

also, you can create row by INSERT and delete by DELETE statement

if you are not used to SQL, here http://www.w3schools.com/sql/
 
Last edited:
First download any mod to see how to make a mod.
Second make XML file with something like that:

<?xml version="1.0" encoding="utf-8"?>
<GameInfo>
<Terrain_YieldChanges>
<Update>
<Where TerrainType="TERRAIN_GRASS_HILLS"/>
<Set YieldChange="1"/>
...
</Update>
</Terrain_YieldChanges>
<GameInfo>
 
Thanks guys. Is there a good example somewhere of how it all needs to be structured? I was pretty good at editing Civ 4 but the technical leap to making the game actually pick up and use the SQL and making sure it's actually working have been really difficult for me.
 
Thanks guys. Is there a good example somewhere of how it all needs to be structured? I was pretty good at editing Civ 4 but the technical leap to making the game actually pick up and use the SQL and making sure it's actually working have been really difficult for me.

Mod Component forums will help you.
there are many simple mods changing only one or two xml values - good examples
 
Back
Top Bottom