[MOD] Creating a Trait that gives faith from specific tiles

Sir AsP

Chieftain
Joined
Nov 25, 2016
Messages
1
I am trying to create a civilization and I want to know how modify the trait so that I can get faith from any specific tile, from water, to horses, sheep etc. I've been able to create a few successful civilizations before but I cannot seem to manage how to do this. The only other thing I can think of is to create a unique building for the civilization and give that to every city, and with that building it will give faith depending on tiles.

Also, I was wondering if there was any resources online that would explain all of the different trait options and what they do (In the trait .xml there are lines that say <!-- Trait_.....) I've tried to look online for explanations of each of these and there are none, so I'm stuck searching though every civ's .xml trait file so that I can get an understanding, and for some reason not all of these Trait_ lines are used in the game.

BTW: I am new to using forums and new to using this forum, please let me know if I posted this thread in the wrong location. Thanks!
 
You posted in the right thread. Like most game modding, modders use what is in the game code. They copy and do some testing to see what works and works. Sadly, unless it wasn't made in the DLL, it wasn't going to work in the first place. (Making a building give faith to Snow? That's only in the belief system, can't manipulate that into a building despite what people usually post "why isnt this working"). So as an alternative, modders who were tired of this "hardcoded" XML system decided to game the game instead through manipulation. Dummy buildings, policies, and units are all examples of this sort of manipulation. What language is this manipulation? Lua. Something people think is hard but is actually easy and simple to learn once you get the hang of it.


Now you're not specific on what tiles should be granting faith so I can't give you any freebie Lua code...
 
No need for lua for most things:
Spoiler :
Code:
<GameData>
	<Traits>
		<Row>
			<Type>TRAIT_HIDDEN</Type>
			<Description>TXT_KEY_TRAIT_HIDDEN</Description>
			<ShortDescription>TXT_KEY_TRAIT_HIDDEN_SHORT</ShortDescription>
			<FreeBuilding>BUILDING_HIDDEN</FreeBuilding>
		</Row>
	</Traits>
	<Leader_Traits>
		<Row>
			<LeaderType>LEADER_X</LeaderType>
			<TraitType>TRAIT_HIDDEN</TraitType>
		</Row>
	</Leader_Traits>
	<Language_en_US>
		<Row Tag="TXT_KEY_TRAIT_HIDDEN">
			<Text>+1 [ICON_PEACE] Faith in Snow Tiles</Text>
		</Row>
		<Row Tag="TXT_KEY_TRAIT_HIDDEN_SHORT">
			<Text>I am Frozen but I believe</Text>
		</Row>
		<Row Tag="TXT_KEY_BUILDING_HIDDEN">
			<Text>Hidden</Text>
		</Row>
	</Language_en_US>
	<Buildings>
		<Row>
			<Type>BUILDING_HIDDEN</Type>
			<BuildingClass>BUILDINGCLASS_HIDDEN</BuildingClass>
			<Cost>-1</Cost>
			<FaithCost>-1</FaithCost>
			<PrereqTech>NULL</PrereqTech>
			<GreatWorkCount>-1</GreatWorkCount>
			<ArtDefineTag>NONE</ArtDefineTag>
			<MinAreaSize>-1</MinAreaSize>
			<NeverCapture>true</NeverCapture>
			<HurryCostModifier>-1</HurryCostModifier>
			<IconAtlas>BW_ATLAS_1</IconAtlas>
			<PortraitIndex>19</PortraitIndex>
			<Description>TXT_KEY_BUILDING_HIDDEN</Description>
		</Row>
	</Buildings>
	<BuildingClasses>
		<Row>
			<Type>BUILDINGCLASS_HIDDEN</Type>
			<DefaultBuilding>BUILDING_HIDDEN</DefaultBuilding>
			<Description>TXT_KEY_BUILDING_HIDDEN</Description>
		</Row>
	</BuildingClasses>
	<Building_TerrainYieldChanges>
		<Row>
			<BuildingType>BUILDING_HIDDEN</BuildingType>
			<TerrainType>TERRAIN_SNOW</TerrainType>
			<YieldType>YIELD_FAITH</YieldType>
			<Yield>1</Yield>
		</Row>
	</Building_TerrainYieldChanges>
</GameData>
There are also tables:
<Building_RiverPlotYieldChanges>
<Building_SeaPlotYieldChanges>
<Building_LakePlotYieldChanges>
<Building_SeaResourceYieldChanges>
<Building_ResourceYieldChanges>
<Building_FeatureYieldChanges>

All of which allow specification of <YieldType>YIELD_FAITH</YieldType>
 
Last edited:
Top Bottom