Creating a new trait - help!

_Hyndo

Chieftain
Joined
Oct 6, 2010
Messages
3
I'm creating a new civ for a mod that I'm creating / learning with, and I've figured out what I want to implement for their trait but I'm having trouble actually making some of those changes happen as a trait - I can make these changes apply to the game in general however.

The idea is that this civ comes from the cold northern regions, and abides in the tundra / snowy areas of the world. Therefore I want them to have certain benefits to be able to live in that terrain quite comfortably, where other civs might struggle.

Accordingly I've changed the movement in tundra and snow tiles so that units can only move one tile at a time, and created a promotion that I can give to units of this new civ to negate that change. This can be given to units by a trait, so that is fine. However I also want to change the food tile yield and worker build modifier of tundra to be the same as grasslands (ie 2 food and no time penalty on building improvements).

Here is what I have so far, which are just general changes to the game:
Spoiler :

Terrain movement cost change
Code:
<Terrains>
	<Update>
		<Set Movement="2" />
		<Where Type="TERRAIN_TUNDRA" />
	</Update>
	<Update>
		<Set Movement="2" />
		<Where Type="TERRAIN_SNOW" />
	</Update>
</Terrains>

The new promotion:
Code:
<UnitPromotions>
	<Row>
		<Type>PROMOTION_WINTER_TRAINING</Type>
		<Description>TXT_KEY_PROMOTION_WINTER_TRAINING</Description>
		<Help>TXT_KEY_PROMOTION_WINTER_TRAINING_HELP</Help>
		<Sound>AS2D_IF_LEVELUP</Sound>
		<CannotBeChosen>true</CannotBeChosen>
		<PortraitIndex>44</PortraitIndex>
		<IconAtlas>PROMOTION_ATLAS</IconAtlas>
		<PediaType>PEDIA_TERRAIN</PediaType>
		<PediaEntry>TXT_KEY_PROMOTION_WINTER_TRAINING</PediaEntry>
	</Row>
</UnitPromotions>
	
<UnitPromotions_Terrains>
	<Row>
		<PromotionType>PROMOTION_WINTER_TRAINING</PromotionType>
		<TerrainType>TERRAIN_TUNDRA</TerrainType>
		<DoubleMove>true</DoubleMove>
	</Row>
	<Row>
		<PromotionType>PROMOTION_WINTER_TRAINING</PromotionType>
		<TerrainType>TERRAIN_SNOW</TerrainType>
		<DoubleMove>true</DoubleMove>
	</Row>
</UnitPromotions_Terrains>

<UnitPromotions_UnitCombats>
	<Row>
		<PromotionType>PROMOTION_WINTER_TRAINING</PromotionType>
		<UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
	</Row>
</UnitPromotions_UnitCombats>

The yield changes and build modifier
Code:
<Terrains>
	<Update>
		<Set BuildModifier="0" />
		<Where TerrainType="TERRAIN_TUNDRA" />
	</Update>
	<Update>
		<Set BuildModifier="0" />
		<Where TerrainType="TERRAIN_SNOW" />
	</Update>
</Terrains>
	
<Terrain_Yields>
	<Update>
		<Set Yield="2" />
		<Where TerrainType="TERRAIN_TUNDRA" YieldType="YIELD_FOOD" />
	</Update>
</Terrain_Yields>
Now what I'm having trouble with is how to implement the change of the tile yield / build modifier as a trait to only this one specific civ.

This is my trait so far, as you can see the promotion is easy to implement:
Spoiler :

Code:
<Traits>
	<Row>
		<Type>TRAIT_THE_FAR_NORTH</Type>
		<Description>TXT_KEY_TRAIT_THE_FAR_NORTH</Description>
		<ShortDescription>TXT_KEY_TRAIT_THE_FAR_NORTH</ShortDescription>
	</Row>
</Traits>
<Trait_FreePromotionUnitCombats>
	<Row>
		<TraitType>TRAIT_THE_FAR_NORTH</TraitType>
		<UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
		<PromotionType>PROMOTION_WINTER_TRAINING</PromotionType>
	</Row>
</Trait_FreePromotionUnitCombats>
Any ideas on how to get this working?
 
Do the following Code: (Tested it already, and it works)

Spoiler :
Code:
<GameData>
	<Terrains>
		<Update>
			<Set BuildModifier="0"/>
			<Where Type="TERRAIN_TUNDRA"/>
		</Update>
	</Terrains>
	<Terrain_Yields>
		<Update>
			<Set Yield="2"/>
			<Where TerrainType="TERRAIN_TUNDRA" YieldType="YIELD_FOOD"/>
		</Update>
	</Terrain_Yields>
</GameData>
 
Wouldn't that modify the tile for all civilizations?
Yes. :sad:

It doesn't look like you can make that kind of civ trait with XML modding alone. You've to work with the parameters used by the other traits for now, I'm afraid. At least until we get access to the C++ code and the inner workings of said parameters.
 
Oh! haha sorry that's what I thought you wanted. Totally misread your request. On the plus side I know how to update values with multiple rows, so go me! XD

Yeah specific terrains are not moddable via any work around for civs that I can tell =/
 
Yes. :sad:

It doesn't look like you can make that kind of civ trait with XML modding alone. You've to work with the parameters used by the other traits for now, I'm afraid. At least until we get access to the C++ code and the inner workings of said parameters.

Thanks for clearing that up for me. I'm trying to make a Civilization right now that has the German trait, but for other players. So right now, I can't do that, if I understand you correctly.
 
Ahh, thats a real shame. I'd have thought that if you could make a change using the xml it would be doable for a trait - guess I was wrong.

On the bright side, now I don't feel like a complete fool for not being able to make it work :P I guess I'll have to wait until we have some more in-depth knowledge of the code behind the scenes.

Thanks all for your responses!
 
I know it's not exactly what you want, but could you create a cheap building with no maint that increases yeild on tundra?

Or is there a way to create a new tile improvement like "cold weather farming" specific to a civ and have that increase the yield?
 
I think you can create a Technology that modifies yields and add it to your civilizations starting techs, then make it impossible for other civs to get.
 
There is no such table as tech_yeild_terrain, so unfortunately using a tech won't work, neither will a building or a policy. the only way to edit this it on a global scale. You could easily make an improvement exclusive to a certain civ though.
 
Thanks for clearing that up for me. I'm trying to make a Civilization right now that has the German trait, but for other players. So right now, I can't do that, if I understand you correctly.
Oh, you can give the German trait to a custom civ, even under another name, but the traits parameters themselves aren't very moddable through XML. In this particular case, the game only lets you modify the chance of conversion after defeating a barbarian land unit. Nothing more. You can't, say, tweak it so that you can convert non-barbarian units, for instance.

Let me give you another example: Russia's trait gives you more production from strategic resources, and doubles the stockpile of some of them. Through modding, you can change the yield bonus and type you get from strategic resources, and strategic resources alone. You can't tweak it to provide bonuses from other types of resources, features or terrains. The stockpile side of the trait is more moddable, allowing you to change the type of strategic resources and how their richness is affected.

So as you can see, these limitations vary from trait to trait. You've got Catherine's on the one hand, and then UAs like Japan's Bushido and Iroquois' War Path, which as far as XML's concerned, are nothing more than a true/false setting of very specific variables (FightWellDamaged and MoveFriendlyWoodsAsRoad, respectively).
 
Back
Top Bottom