Struggling With Civ Change

Casworon

Prince
Joined
Aug 9, 2014
Messages
548
Hello. Im trying to add +1 gold to all luxury resources for America. I've written the code but i must have made a mistake somewhere because its not working in game.

Here is the code i have written in a .xml file

Spoiler :
Code:
<GameData>

	<Language_en_US>
		<Update>
			<Where Tag="TXT_KEY_TRAIT_MANIFEST_DESTINY"/>
			<Set>
				<Text> All land military units have +1 sight. 50% discount when purchasing tiles. +1 [ICON_GOLD] Gold from luxury resources.
				</Text>
			</Set>
		</Update>
	</Language_en_US>


	<Trait_ResourceYieldChanges>
		<Row>
			<TraitType>TRAIT_MANIFEST_DESTINY</TraitType>
			<ResourceType>RESOURCE_LUXURY</ResourceType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Trait_ResourceYieldChanges>
	
</GameData>
 
Are you using the original Firaxis-supplied Civilization America and Washington leader, or a modded version ?

Washington's leader trait as made by Firaxis is TRAIT_RIVER_EXPANSION, not TRAIT_MANIFEST_DESTINY.

Code:
<Leader_Traits>
	<Row>
		<LeaderType>LEADER_WASHINGTON</LeaderType>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
	</Row>
</Leader_Traits>

Code:
<Row>
	<Type>TRAIT_RIVER_EXPANSION</Type>
	<Description>TXT_KEY_TRAIT_RIVER_EXPANSION</Description>
	<ShortDescription>TXT_KEY_TRAIT_RIVER_EXPANSION_SHORT</ShortDescription>
	<PlotBuyCostModifier>-50</PlotBuyCostModifier>
</Row>
 
Cool. Thank you. Where did you find that btw? i have been trying to find the leader traits on http://modiki.civfanatics.com/index.php/Category:Civ5_Types but i can't seem to find them. My new code is below. I changed from +1 gold on luxuries to +1 gold on strategic but i still cant get it to work for some reason

Spoiler :
Code:
<GameData>

	<Language_en_US>
		<Update>
			<Where Tag="TXT_KEY_TRAIT_RIVER_EXPANSION"/>
			<Set>
				<Text> All land military units have +1 sight. 50% discount when purchasing tiles. +1 [ICON_GOLD] Gold from Strategic Resources.
				</Text>
			</Set>
		</Update>
	</Language_en_US>

	<Trait_ResourceYieldChanges>
		<Row>
			<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
			<ResourceType>RESOURCE_HORSES</ResourceType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Trait_ResourceYieldChanges>
	
	<Trait_ResourceYieldChanges>
		<Row>
			<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
			<ResourceType>RESOURCE_IRON</ResourceType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Trait_ResourceYieldChanges>

	<Trait_ResourceYieldChanges>
		<Row>
			<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
			<ResourceType>RESOURCE_ALUMINIUM</ResourceType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Trait_ResourceYieldChanges>

	<Trait_ResourceYieldChanges>
		<Row>
			<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
			<ResourceType>RESOURCE_COAL</ResourceType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Trait_ResourceYieldChanges>

	<Trait_ResourceYieldChanges>
		<Row>
			<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
			<ResourceType>RESOURCE_OIL</ResourceType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Trait_ResourceYieldChanges>

	<Trait_ResourceYieldChanges>
		<Row>
			<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
			<ResourceType>RESOURCE_URANIUM</ResourceType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Trait_ResourceYieldChanges>

</GameData>
 
Nah it doesn't come up when i start a new game. Its weird because i have got it working for other civs. For example my Carthage code works

Spoiler :
Code:
<GameData>
	<Trait_UnimprovedFeatureYieldChanges>
		<Row>
			<TraitType>TRAIT_PHOENICIAN_HERITAGE</TraitType>
			<FeatureType>FEATURE_ATOLL</FeatureType>
			<YieldType>YIELD_FOOD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Trait_UnimprovedFeatureYieldChanges>

	<Trait_ImprovementYieldChanges>
		<Row>
			<TraitType>TRAIT_PHOENICIAN_HERITAGE</TraitType>
			<ImprovementType>IMPROVEMENT_FISHING_BOATS</ImprovementType>
			<YieldType>YIELD_FOOD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Trait_ImprovementYieldChanges>


	<Language_en_US>
		<Update>
			<Where Tag="TXT_KEY_TRAIT_PHOENICIAN_HERITAGE"/>
			<Set>
				<Text> All coastal Cities get a free Harbor. Units may cross mountains after the first Great General is earned, taking 50 HP damage if they end a turn on a mountain. +1 [ICON_FOOD] Food from atolls and fishing boats.
				</Text>
			</Set>
		</Update>
	</Language_en_US>

</GameData>

But my America code doesn't

Spoiler :
Code:
<GameData>

	<Language_en_US>
		<Update>
			<Where Tag="TXT_KEY_TRAIT_RIVER_EXPANSION"/>
			<Set>
				<Text> All land military units have +1 sight. 50% discount when purchasing tiles. +1 [ICON_GOLD] Gold from Strategic Resources.
				</Text>
			</Set>
		</Update>
	</Language_en_US>

	<Trait_ResourceYieldChanges>
		<Row>
			<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
			<ResourceType>RESOURCE_HORSES</ResourceType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Trait_ResourceYieldChanges>
	
	<Trait_ResourceYieldChanges>
		<Row>
			<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
			<ResourceType>RESOURCE_IRON</ResourceType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Trait_ResourceYieldChanges>

	<Trait_ResourceYieldChanges>
		<Row>
			<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
			<ResourceType>RESOURCE_ALUMINIUM</ResourceType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Trait_ResourceYieldChanges>

	<Trait_ResourceYieldChanges>
		<Row>
			<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
			<ResourceType>RESOURCE_COAL</ResourceType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Trait_ResourceYieldChanges>

	<Trait_ResourceYieldChanges>
		<Row>
			<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
			<ResourceType>RESOURCE_OIL</ResourceType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Trait_ResourceYieldChanges>

	<Trait_ResourceYieldChanges>
		<Row>
			<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
			<ResourceType>RESOURCE_URANIUM</ResourceType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Trait_ResourceYieldChanges>

</GameData>

I have all my file types set up correctly. Ill try and set error logging up. Many thanks
 
1. Code is SO much easier to read when you wrap it in
Code:
 blocks. (i.e. [.CODE] before and [./CODE] after, without the periods)

2. You don't need to open and close the table every time you make a new <Row>.
This:
[SPOILER][CODE]<Trait_ResourceYieldChanges>
	<Row>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
		<ResourceType>RESOURCE_HORSES</ResourceType>
		<YieldType>YIELD_GOLD</YieldType>
		<Yield>1</Yield>
	</Row>
</Trait_ResourceYieldChanges>

<Trait_ResourceYieldChanges>
	<Row>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
		<ResourceType>RESOURCE_IRON</ResourceType>
		<YieldType>YIELD_GOLD</YieldType>
		<Yield>1</Yield>
	</Row>
</Trait_ResourceYieldChanges>

<Trait_ResourceYieldChanges>
	<Row>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
		<ResourceType>RESOURCE_ALUMINIUM</ResourceType>
		<YieldType>YIELD_GOLD</YieldType>
		<Yield>1</Yield>
	</Row>
</Trait_ResourceYieldChanges>

<Trait_ResourceYieldChanges>
	<Row>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
		<ResourceType>RESOURCE_COAL</ResourceType>
		<YieldType>YIELD_GOLD</YieldType>
		<Yield>1</Yield>
	</Row>
</Trait_ResourceYieldChanges>

<Trait_ResourceYieldChanges>
	<Row>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
		<ResourceType>RESOURCE_OIL</ResourceType>
		<YieldType>YIELD_GOLD</YieldType>
		<Yield>1</Yield>
	</Row>
</Trait_ResourceYieldChanges>

<Trait_ResourceYieldChanges>
	<Row>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
		<ResourceType>RESOURCE_URANIUM</ResourceType>
		<YieldType>YIELD_GOLD</YieldType>
		<Yield>1</Yield>
	</Row>
</Trait_ResourceYieldChanges>
[/SPOILER]
Works just as well as this, which takes up less space:
Spoiler :
Code:
<Trait_ResourceYieldChanges>
	<Row>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
		<ResourceType>RESOURCE_HORSES</ResourceType>
		<YieldType>YIELD_GOLD</YieldType>
		<Yield>1</Yield>
	</Row>-<Row>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
		<ResourceType>RESOURCE_IRON</ResourceType>
		<YieldType>YIELD_GOLD</YieldType>
		<Yield>1</Yield>
	</Row>-<Row>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
		<ResourceType>RESOURCE_ALUMINIUM</ResourceType>
		<YieldType>YIELD_GOLD</YieldType>
		<Yield>1</Yield>
	</Row>-<Row>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
		<ResourceType>RESOURCE_COAL</ResourceType>
		<YieldType>YIELD_GOLD</YieldType>
		<Yield>1</Yield>
	</Row>-<Row>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
		<ResourceType>RESOURCE_OIL</ResourceType>
		<YieldType>YIELD_GOLD</YieldType>
		<Yield>1</Yield>
	</Row>-<Row>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
		<ResourceType>RESOURCE_URANIUM</ResourceType>
		<YieldType>YIELD_GOLD</YieldType>
		<Yield>1</Yield>
	</Row>
</Trait_ResourceYieldChanges>
But of course this doesn't work if the code includes multiple tables, but the code in question doesn't...

3. It's RESOURCE_HORSE, not RESOURCE_HORSES. Always refer to the base game XML files for reference if you're unsure of the exact names.
That error will prevent the entire file from taking effect.
 
Many Thanks, Ill make those changes. In the logs i got

[91391.171] no such table: Trait_ResourceYieldChanges
[91391.171] In Query - insert into Trait_ResourceYieldChanges('TraitType', 'ResourceType', 'YieldType', 'Yield') values (?, ?, ?, ?);
[91391.171] In XMLSerializer while updating table Trait_ResourceYieldChanges from file Civ Balance/America/America Changes.xml.

so i guess im using the wrong command to add yields to resources?

Also where would i find the base games XML files? Sorry I'm a bit new with all this

Edit: found them, think ive found the right command now
 
I had a faint suspicion that there was no such table as Trait_ResourceYieldChanges, but I wasn't sure.

Yeah, there is no such table and no table that will accomplish the same thing. The work around is to make a "fake" building that uses Building_ResourceYieldChanges and make your trait give it to each city using the <FreeBuilding> tag in Traits, like Carthage does with harbors.
 
I got it working in the end. I managed to find the coding that Russia uses to add +1 production to every strategic resource and modified that. In the end the code was

Spoiler :
Code:
 <GameData>

	<Language_en_US>
		<Update>
			<Where Tag="TXT_KEY_TRAIT_RIVER_EXPANSION"/>
			<Set>
				<Text>
					All land military units have +1 sight. 50% discount when purchasing tiles. +1 [ICON_GOLD] Gold from Strategic Resources.
				</Text>
			</Set>
		</Update>
	</Language_en_US>

	<Trait_YieldChangesStrategicResources>
		<Row>
			<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Trait_YieldChangesStrategicResources>

</GameData>

Thanks for all the help! :)
I'm totally new to modding but it is already a lot of fun
Now on to changing my next civ :)
 
You did find where the game XML files are, though ? I was going to add a note about the file-path to find them, but I forgot. Sorry.

And I also overlooked the fact that you were using a wrong table, and that you had _HORSES. Either one of those errors by itself would cause the game to discard the entire file where the error occured.

If you run into troubles on future mods, always better to attach the mod, even if it isn't working, as shown how here: whoward69's zip your mods and attach tutorial
 
Yeah i found the xml files :). Its a lot easier to change things once you know what they where originally :lol:

Cool, thanks for the whowards69 tip. Ill do that next time
 
Top Bottom