Adding existing unique improvement to civ

Nibenay78

Chieftain
Joined
Dec 28, 2019
Messages
3
Hi all,

I've just returned to play a bit civ 5 during christmas, and decided to change a bit around on some of the unique parts in the game. I really want to play America on Earth map, but I don't really fancy either of their unique parts.

I've managed to change the leader trait reasonably easy, but I'm trying to add the Terrace Farm feature to their civ also. I'm sure this is a newbie question but I hope a kind soul will asssist me.

So far I've only found a reference to terrace farm under the following files (as I'm not sure which is the right one)
:
Assets\DLC\DLC_02\Gameplay\XML\CIV5Improvements_DLC_02.xml
\Assets\DLC\Expansion2\DLC\DLC_02\Gameplay\XML\CIV5Improvements_DLC_02.xml

I've simply added a row to see if America would get terrace farm. However when I start the game I don't see the farm show under construction in the tech tree.

Code:
-<Row>
<Type>IMPROVEMENT_TERRACE_FARM</Type>
<Description>TXT_KEY_IMPROVEMENT_TERRACE_FARM</Description>
<Civilopedia>TXT_KEY_CIV5_IMPROVEMENTS_TERRACE_FARM_TEXT</Civilopedia>
<Help>TXT_KEY_CIV5_IMPROVEMENTS_TERRACE_FARM_HELP</Help>
<ArtDefineTag>ART_DEF_IMPROVEMENT_TERRACE_FARM</ArtDefineTag>
<SpecificCivRequired>true</SpecificCivRequired>
<CivilizationType>CIVILIZATION_INCA</CivilizationType>
<CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
<HillsMakesValid>true</HillsMakesValid>
<PillageGold>18</PillageGold>
<PortraitIndex>0</PortraitIndex>
<IconAtlas>DLC02_TERRAIN_ATLAS</IconAtlas>
</Row>

Thanks for any assistance. Btw I'm fine with simply adding it as a 3rd unique unit/building to the civ. I understand the only requirement is that a civ has minimum 2 unique features(?)
 
A single row within a table can only contain a column-name once. So this causes a fatal exception error and the game ignores the contents of the entire file:
Code:
<CivilizationType>CIVILIZATION_INCA</CivilizationType>
<CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
You also cannot have two different versions of <Type>IMPROVEMENT_TERRACE_FARM</Type> registered with the game, so you have to create a duplicate of the Terrace Farm and assign it to America, then duplicate everything the original Terrace Farm does. Here's an example from a personal-use mod:
Code:
<GameData>
	<Language_en_US>
		<Row Tag="TXT_KEY_CIV5_IMPROVEMENTS_AMERICAN_TERRACE_FARM_HELP">
			<Text>Only valid on Hill tiles: +2 [ICON_FOOD] and  +1 [ICON_GOLD]. +1 [ICON_PRODUCTION] Production for every adjacent mountain tile. Only America Can Build American Terrace Farms</Text>
		</Row>
		<Row Tag="TXT_KEY_IMPROVEMENT_AMERICAN_TERRACE_FARM">
			<Text>American Terrace Farm</Text>
		</Row>
	</Language_en_US>

	<Improvements>
		<Row>
			<Type>IMPROVEMENT_AMERICAN_TERRACE_FARM</Type>
			<Description>TXT_KEY_IMPROVEMENT_AMERICAN_TERRACE_FARM</Description>
			<Civilopedia>TXT_KEY_CIV5_IMPROVEMENTS_TERRACE_FARM_TEXT</Civilopedia>
			<Help>TXT_KEY_CIV5_IMPROVEMENTS_AMERICAN_TERRACE_FARM_HELP</Help>
			<ArtDefineTag>ART_DEF_IMPROVEMENT_TERRACE_FARM</ArtDefineTag>
			<SpecificCivRequired>true</SpecificCivRequired>
			<CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
			<HillsMakesValid>true</HillsMakesValid>
			<PillageGold>18</PillageGold>
			<PortraitIndex>0</PortraitIndex>
			<IconAtlas>DLC02_TERRAIN_ATLAS</IconAtlas>
		</Row>
	</Improvements>
	<Improvement_Yields>
		<Row>
			<ImprovementType>IMPROVEMENT_AMERICAN_TERRACE_FARM</ImprovementType>
			<YieldType>YIELD_FOOD</YieldType>
			<Yield>2</Yield>
		</Row>
		<Row>
			<ImprovementType>IMPROVEMENT_AMERICAN_TERRACE_FARM</ImprovementType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Improvement_Yields>
	<Improvement_AdjacentMountainYieldChanges>
		<Row>
			<ImprovementType>IMPROVEMENT_AMERICAN_TERRACE_FARM</ImprovementType>
			<YieldType>YIELD_PRODUCTION</YieldType>
			<Yield>1</Yield>
		</Row>
	</Improvement_AdjacentMountainYieldChanges>
	<Improvement_TechNoFreshWaterYieldChanges>
		<Row>
			<ImprovementType>IMPROVEMENT_AMERICAN_TERRACE_FARM</ImprovementType>
			<TechType>TECH_FERTILIZER</TechType>
			<YieldType>YIELD_FOOD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Improvement_TechNoFreshWaterYieldChanges>
	<Improvement_TechFreshWaterYieldChanges>
		<Row>
			<ImprovementType>IMPROVEMENT_AMERICAN_TERRACE_FARM</ImprovementType>
			<TechType>TECH_CIVIL_SERVICE</TechType>
			<YieldType>YIELD_FOOD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Improvement_TechFreshWaterYieldChanges>
	<Improvement_ValidTerrains>
		<Row>
			<ImprovementType>IMPROVEMENT_AMERICAN_TERRACE_FARM</ImprovementType>
			<TerrainType>TERRAIN_HILL</TerrainType>
		</Row>
	</Improvement_ValidTerrains>
	<Unit_Builds>
		<Row>
			<UnitType>UNIT_WORKER</UnitType>
			<BuildType>BUILD_AMERICAN_TERRACE_FARM</BuildType>
		</Row>
	</Unit_Builds>
	<Builds>
		<Row>
			<Type>BUILD_AMERICAN_TERRACE_FARM</Type>
			<PrereqTech>TECH_AGRICULTURE</PrereqTech>
			<Time>600</Time>
			<ImprovementType>IMPROVEMENT_AMERICAN_TERRACE_FARM</ImprovementType>
			<Description>TXT_KEY_BUILD_TERRACE_FARM</Description>
			<Recommendation>TXT_KEY_BUILD_FOOD_REC</Recommendation>
			<EntityEvent>ENTITY_EVENT_IRRIGATE</EntityEvent>
			<HotKey>KB_E</HotKey>
			<OrderPriority>97</OrderPriority>
			<IconIndex>0</IconIndex>
			<IconAtlas>UNIT_ACTION_DLC02_ATLAS</IconAtlas>
		</Row>
	</Builds>
	<BuildFeatures>
		<Row>
			<BuildType>BUILD_AMERICAN_TERRACE_FARM</BuildType>
			<FeatureType>FEATURE_JUNGLE</FeatureType>
			<PrereqTech>TECH_BRONZE_WORKING</PrereqTech>
			<Time>400</Time>
			<Remove>true</Remove>
		</Row>
		<Row>
			<BuildType>BUILD_AMERICAN_TERRACE_FARM</BuildType>
			<FeatureType>FEATURE_FOREST</FeatureType>
			<PrereqTech>TECH_MINING</PrereqTech>
			<Time>400</Time>
			<Production>20</Production>
			<Remove>true</Remove>
		</Row>
	</BuildFeatures>
</GameData>
Note that I went crazy for the funs with the Yield effects of this version of the terrace farm. So you'd need to check the original Terrace Farm's yields against the ones in my example. Tables <Improvement_Yields>, <Improvement_AdjacentMountainYieldChanges>, <Improvement_TechNoFreshWaterYieldChanges>, <Improvement_TechFreshWaterYieldChanges> would be the tables you would need to compare against the original Incan Terrace Farm.

Also the <Time> values in table <BuildFeatures> are probably not the same as for the original Incan Terrace Farm.
 
Hi and thank you for the good answer. I've tried to add in as specified but I only see the minuteman and B17 during setup/loading and nothing on the tech tree either.
I guess I'm mostly confused where to put the data (or made a mistake)

I simply copied everything found in the Inca file and added it behind to make it easy to compare and added the builds/buildfeatures also

Spoiler :

Code:
Assets\DLC\Expansion2\DLC\DLC_02\Gameplay\XML\CIV5Improvements_DLC_02.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by Ed Beach (Firaxis Games) -->
<GameData>
    <!-- Table data -->
    <Improvements>
        <Row>
            <Type>IMPROVEMENT_TERRACE_FARM</Type>
            <Description>TXT_KEY_IMPROVEMENT_TERRACE_FARM</Description>
            <Civilopedia>TXT_KEY_CIV5_IMPROVEMENTS_TERRACE_FARM_TEXT</Civilopedia>
            <Help>TXT_KEY_CIV5_IMPROVEMENTS_TERRACE_FARM_HELP</Help>
            <ArtDefineTag>ART_DEF_IMPROVEMENT_TERRACE_FARM</ArtDefineTag>
            <SpecificCivRequired>true</SpecificCivRequired>
            <CivilizationType>CIVILIZATION_INCA</CivilizationType>
            <HillsMakesValid>true</HillsMakesValid>
            <PillageGold>18</PillageGold>
            <PortraitIndex>0</PortraitIndex>
            <IconAtlas>DLC02_TERRAIN_ATLAS</IconAtlas>
        </Row>
        <Row>
            <Type>IMPROVEMENT_AMERICAN_TERRACE_FARM</Type>
            <Description>TXT_KEY_IMPROVEMENT_TERRACE_FARM</Description>
            <Civilopedia>TXT_KEY_CIV5_IMPROVEMENTS_TERRACE_FARM_TEXT</Civilopedia>
            <Help>TXT_KEY_CIV5_IMPROVEMENTS_TERRACE_FARM_HELP</Help>
            <ArtDefineTag>ART_DEF_IMPROVEMENT_TERRACE_FARM</ArtDefineTag>
            <SpecificCivRequired>true</SpecificCivRequired>
            <CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
            <HillsMakesValid>true</HillsMakesValid>
            <PillageGold>18</PillageGold>
            <PortraitIndex>0</PortraitIndex>
            <IconAtlas>DLC02_TERRAIN_ATLAS</IconAtlas>
        </Row>
    </Improvements>
    <Improvement_Yields>
        <Row>
            <ImprovementType>IMPROVEMENT_TERRACE_FARM</ImprovementType>
            <YieldType>YIELD_FOOD</YieldType>
            <Yield>1</Yield>
        </Row>
        <Row>
            <ImprovementType>IMPROVEMENT_AMERICAN_TERRACE_FARM</ImprovementType>
            <YieldType>YIELD_FOOD</YieldType>
            <Yield>1</Yield>
        </Row>
    </Improvement_Yields>
    <Improvement_AdjacentMountainYieldChanges>
        <Row>
            <ImprovementType>IMPROVEMENT_TERRACE_FARM</ImprovementType>
            <YieldType>YIELD_FOOD</YieldType>
            <Yield>1</Yield>
        </Row>
        <Row>
            <ImprovementType>IMPROVEMENT_AMERICAN_TERRACE_FARM</ImprovementType>
            <YieldType>YIELD_FOOD</YieldType>
            <Yield>1</Yield>
        </Row>
    </Improvement_AdjacentMountainYieldChanges>
    <Improvement_TechNoFreshWaterYieldChanges>
        <Row>
            <ImprovementType>IMPROVEMENT_TERRACE_FARM</ImprovementType>
            <TechType>TECH_FERTILIZER</TechType>
            <YieldType>YIELD_FOOD</YieldType>
            <Yield>1</Yield>
        </Row>
        <Row>
            <ImprovementType>IMPROVEMENT_AMERICAN_TERRACE_FARM</ImprovementType>
            <TechType>TECH_FERTILIZER</TechType>
            <YieldType>YIELD_FOOD</YieldType>
            <Yield>1</Yield>
        </Row>
    </Improvement_TechNoFreshWaterYieldChanges>
    <Improvement_TechFreshWaterYieldChanges>
        <Row>
            <ImprovementType>IMPROVEMENT_TERRACE_FARM</ImprovementType>
            <TechType>TECH_CIVIL_SERVICE</TechType>
            <YieldType>YIELD_FOOD</YieldType>
            <Yield>1</Yield>
        </Row>
        <Row>
            <ImprovementType>IMPROVEMENT_AMERICAN_TERRACE_FARM</ImprovementType>
            <TechType>TECH_CIVIL_SERVICE</TechType>
            <YieldType>YIELD_FOOD</YieldType>
            <Yield>1</Yield>
        </Row>
    </Improvement_TechFreshWaterYieldChanges>
    <Improvement_ValidTerrains>
        <Row>
            <ImprovementType>IMPROVEMENT_TERRACE_FARM</ImprovementType>
            <TerrainType>TERRAIN_HILL</TerrainType>
        </Row>
        <Row>
            <ImprovementType>IMPROVEMENT_AMERICAN_TERRACE_FARM</ImprovementType>
            <TerrainType>TERRAIN_HILL</TerrainType>
        </Row>
    </Improvement_ValidTerrains>
    <IconTextureAtlases>
        <Row>
            <Atlas>DLC02_TERRAIN_ATLAS</Atlas>
            <IconSize>256</IconSize>
            <Filename>TerrainIcons256_DLC_02.dds</Filename>
            <IconsPerRow>1</IconsPerRow>
            <IconsPerColumn>1</IconsPerColumn>
        </Row>
        <Row>
            <Atlas>DLC02_TERRAIN_ATLAS</Atlas>
            <IconSize>64</IconSize>
            <Filename>TerrainIcons64_DLC_02.dds</Filename>
            <IconsPerRow>1</IconsPerRow>
            <IconsPerColumn>1</IconsPerColumn>
        </Row>

    </IconTextureAtlases>
    <Unit_Builds>
        <Row>
            <UnitType>UNIT_WORKER</UnitType>
            <BuildType>BUILD_AMERICAN_TERRACE_FARM</BuildType>
        </Row>
    </Unit_Builds>
    <Builds>
        <Row>
            <Type>BUILD_AMERICAN_TERRACE_FARM</Type>
            <PrereqTech>TECH_AGRICULTURE</PrereqTech>
            <Time>600</Time>
            <ImprovementType>IMPROVEMENT_AMERICAN_TERRACE_FARM</ImprovementType>
            <Description>TXT_KEY_BUILD_TERRACE_FARM</Description>
            <Recommendation>TXT_KEY_BUILD_FOOD_REC</Recommendation>
            <EntityEvent>ENTITY_EVENT_IRRIGATE</EntityEvent>
            <HotKey>KB_E</HotKey>
            <OrderPriority>97</OrderPriority>
            <IconIndex>0</IconIndex>
            <IconAtlas>UNIT_ACTION_DLC02_ATLAS</IconAtlas>
        </Row>
    </Builds>
    <BuildFeatures>
        <Row>
            <BuildType>BUILD_AMERICAN_TERRACE_FARM</BuildType>
            <FeatureType>FEATURE_JUNGLE</FeatureType>
            <PrereqTech>TECH_BRONZE_WORKING</PrereqTech>
            <Time>400</Time>
            <Remove>true</Remove>
        </Row>
        <Row>
            <BuildType>BUILD_AMERICAN_TERRACE_FARM</BuildType>
            <FeatureType>FEATURE_FOREST</FeatureType>
            <PrereqTech>TECH_MINING</PrereqTech>
            <Time>400</Time>
            <Production>20</Production>
            <Remove>true</Remove>
        </Row>
    </BuildFeatures>
</GameData>

And with the above, nothing changed.

How do I know which of the many locations I need to edit? I'm playing BNV, so I assumed all changes has to be done under \expansion2\. However when I changed Washingtons trait, it was under Assets\DLC\Expansion\Gameplay\XML\Leaders not \expansion2.

On my second try I instead edited in Builds and BuildFeatures into the file:
Assets\DLC\Expansion2\Gameplay\XML\Units\CIV5Builds.xml
and Unit_build into
Assets\DLC\Expansion2\Gameplay\XML\Units\CIV5Units.xml

This completely broke the tech tree, so I guess I'm missing something here
 
The Civ and Leader selection screens will only ever display two uniques unless you are running one of the handful of mods that allows the screens to show more than 2. Units take precedence over everything else.

Did not realize you were directly-editing the game's original files. Civ5 does not care what is contained code-wise within any one given file except that the xml files do load in a preset order which I don't know that anyone has a "cheat-chart" for which files load in what order. So to be safe you'd need to put the Builds and BuildFeatures code in the file "CIV5Builds_DLC_02.xml" located at
C:\Program Files (x86)\Steam\steamapps\common\Sid Meier's Civilization V\Assets\DLC\DLC_02\Gameplay\XML
You would need to put the <Unit_Builds> info into file "CIV5Units_DLC_02.xml" in the same folder. In this way you can be sure the game has already added tables <Builds>, <BuildFeatures>, and <Unit_Builds> into the game when you add info for these tables.

Also, be sure the program you are using to edit the game's original files is not adding hidden characters to the files you edit. Notepad and Notepad++ are safe to use, but most actual word-processing programs including Wordpad tend to add hidden characters to the file if you are not careful when you save your alterations to the file.

These sorts of issues are yet more reasons why we generally don't advise direct-editing of the game's original files. When a mod does this sort of thing we know the game has already created all the needed XML tables, and that if our code or the program we are using to edit our files is/are poop we aren't going to corrupt the original game-files in any way.

Enable error logging if the problems you are encountering persist: whoward69's enable error logging tutorial You will want to look for any errors being reported in database.log related to the base-game files you are editing.
 
Last edited:
Well not too bad! I finally got the terrace farm up and running, although it does show at the same tech level (agriculture) as a regular farm. It'll do for me.

I figured editing directly was just easier for smaller changes, but I see that can be an issue indeed. I assume there are way better methods if one wants to make bigger changes indeed.!
Thanks again for the assistance!
 
Code:
<Builds>
        <Row>
            <Type>BUILD_AMERICAN_TERRACE_FARM</Type>
            <PrereqTech>TECH_AGRICULTURE</PrereqTech>
It's the <Build> that determines where in the tech tree the improvement becomes available, so if you want your version of the Terrace Farm to become available with some other tech than Agriculture, you'd have to change the setting in the <Builds> table.
 
Back
Top Bottom