[BNW] How to create unique promotions?

Mathy

Chieftain
Joined
Apr 23, 2020
Messages
3
Background: Hi, I'm new to modding in civ 5. I'm trying to add custom promotions, which I'm having some difficulty with. My background in coding is that I've completed AP computer science, which covers java up to inheritance. My ideas are:

Add a promotion to Great War Infantry that gives them a bonus in forts.
Create a promotion that gives a negative modifier that increases with war duration.
Add the janissary promotion to other units.

How can I do this?
 
#1 and #2 are not possible with the game SQL/XML UnitPromotions Schema. You would have to create a promotion that gives the desired direct effect on the unit and then add or remove this promotion from the units as conditions change from an lua script. Such a script would be somewhat complicated but still doable for the most part. The problem with this sort of real-time execution of lua scripts that would be needed for the Great War Infantry effect is that they are processing-heavy as a general rule and tend to cause lag and "stutter" of the game that is quite noticeable to the user. By direct effect I mean such things as a 10% increase or decrease in combat strength.

Your other option is to learn how to mod the game's DLL code and implement the new desired effects from an altered DLL. The downsides of this are: (a) DLL only applies to Windows users, and (b) there can only be one DLL mod active for a given user at the same time, so your mod would be incompatible with any other mod that also alters the game's DLL.

For #3 do you mean PROMOTION_HEAL_IF_DESTROY_ENEMY ? Because the Janissary gets two inherent promotions.
 
Thanks for the response!

Alternatively to making a new promotion, in the Fall of Rome Scenario, The Eastern Roman Empire receives a 10% bonus within 2 tiles of any forts. Would it be possible to take this unique ability and apply it to another civilization? If so, could I increase this bonus to something like 30%, while reducing the range to 1 tile?

Also, I am referring to the heal if destroy enemy. Can the amount of HP healed be reduced?
 
Code:
<GameData>
	<Traits>
		<Row>
			<Type>TRAIT_THEODOSIAN_WALLS</Type>
			
			<NearbyImprovementCombatBonus>10</NearbyImprovementCombatBonus>
			<NearbyImprovementBonusRange>2</NearbyImprovementBonusRange>
			<CombatBonusImprovement>IMPROVEMENT_FORT</CombatBonusImprovement>
			
		</Row>
	</Traits>
</GameData>
The effect is done within table <Traits> which by definition means it is unique to the Leader that is assigned that Trait.

As for the Promotion
Code:
		<Row>
			<Type>PROMOTION_HEAL_IF_DESTROY_ENEMY</Type>
			<Description>TXT_KEY_PROMOTION_HEAL_IF_DESTROY_ENEMY</Description>
			<Help>TXT_KEY_PROMOTION_HEAL_IF_DESTROY_ENEMY_HELP</Help>
			<Sound>AS2D_IF_LEVELUP</Sound>
			<HPHealedIfDestroyEnemy>50</HPHealedIfDestroyEnemy>
			<HealIfDestroyExcludesBarbarians>true</HealIfDestroyExcludesBarbarians>
			<PortraitIndex>59</PortraitIndex>
			<IconAtlas>ABILITY_ATLAS</IconAtlas>
			<PediaType>PEDIA_ATTRIBUTES</PediaType>
			<PediaEntry>TXT_KEY_PEDIA_PROMOTION_HEAL_IF_DESTROY_ENEMY</PediaEntry>
		</Row>
The 50% amount is right there in the definition of the promotion. But if you alter this exact promotion's definition and then apply the promotion to other units, the result would be a bit of a nerf of the Janissary unit.

If it were me I would make a new promotion and call it something like "PROMOTION_HEAL_IF_DESTROY_ENEMY_LRS" and then alter as like below
Code:
		<Row>
			<Type>PROMOTION_HEAL_IF_DESTROY_ENEMY_LRS</Type>
			<Description>TXT_KEY_PROMOTION_HEAL_IF_DESTROY_ENEMY_LRS</Description>
			<Help>TXT_KEY_PROMOTION_HEAL_IF_DESTROY_ENEMY_LRS_HELP</Help>
			<Sound>AS2D_IF_LEVELUP</Sound>
			<HPHealedIfDestroyEnemy>30</HPHealedIfDestroyEnemy>
			<HealIfDestroyExcludesBarbarians>true</HealIfDestroyExcludesBarbarians>
			<PortraitIndex>59</PortraitIndex>
			<IconAtlas>ABILITY_ATLAS</IconAtlas>
			<PediaType>PEDIA_ATTRIBUTES</PediaType>
			<PediaEntry>TXT_KEY_PEDIA_PROMOTION_HEAL_IF_DESTROY_ENEMY_LRS</PediaEntry>
		</Row>
You would also need to follow through and define the new TXT_KEY tags in table <Language_en_US> so the game would know what text to display in the civilopedia, etc.

To apply the promotion to a type of unit as an inherent attribute of the unit
Code:
<GameData>
	<Unit_FreePromotions>
		<Row>
			<UnitType>UNIT_AZTEC_JAGUAR</UnitType>
			<PromotionType>PROMOTION_HEAL_IF_DESTROY_ENEMY_LRS</PromotionType>
		</Row>
	</Unit_FreePromotions>
</GamneData>
You would need to add a row to the table for every type of unit you want the promotion applied to.
 
Top Bottom