Implenting "Prize Ship" promotion to land units..

EricNgui

CPU of 1980's Planeptune
Joined
Jul 23, 2014
Messages
138
Location
Liverpool, UK
Hello again. Well, i try to implent the "Prize Ship" promotion or some kinda like that.. (from the Ottomans) to my new civ land units. I wanted to create new trait that enable my civ to capture units from enemies and barbarians. Is this possible? If this possible do i need to do LUA file for this? :)
 
This is promotion code for a promotion I called "Capture" that allowed land units to capture defeated enemies. I made the promotion be given when a player completed a National Wonder I added to the game and called "Advanced War College". I never released any of this as a mod on the forum or on Steam because I ended in deciding it was way too balance-breaking, and there were already an assortment of similar National Wonders out there in the wild with names like "Advanced War Colllege".

It worked just fine so far as allowing land units to capture defeated enemies. There was one issue I was never able to find the cure to, but JFD showed me how to do that recently on another thread, and the lines for that are shown in blue. I couldn't figure out which darn language Tag="TXT_KEY_SOMETHING" controlled the mouse-over display when a player mouses over an enemy unit prior to attacking them. It was always talking about "sinking" the opposing land unit. JFD's lines should fix that so it refers to "Defeating" an enemy regardless of whether the battle is a land battle or a sea battle.

Note that I did not allow Ranged or Siege units to have the promotion. I am not sure whether giving the promotion to Ranged and Siege units will work correctly or not.
Spoiler :
Code:
<GameData>
	
	<UnitPromotions>

		<!-- PROMOTION_CAPTURE -->
		<!-- given by Advanced War College -->

		<Row>
			<Type>PROMOTION_CAPTURE</Type>
			<Description>TXT_KEY_PROMOTION_CAPTURE</Description>
			<Help>TXT_KEY_PROMOTION_CAPTURE_HELP</Help>
			<Sound>AS2D_IF_LEVELUP</Sound>
			<CannotBeChosen>true</CannotBeChosen>
			<CaptureDefeatedEnemy>true</CaptureDefeatedEnemy>
			<PortraitIndex>6</PortraitIndex>
			<IconAtlas>KRIS_SWORDSMAN_PROMOTION_ATLAS</IconAtlas>
			<PediaType>PEDIA_ATTRIBUTE</PediaType>
			<PediaEntry>TXT_KEY_PROMOTION_CAPTURE</PediaEntry>
		</Row>

	</UnitPromotions>

	<UnitPromotions_UnitCombats>

		<!-- PROMOTION_CAPTURE -->

		<Row>
			<PromotionType>PROMOTION_CAPTURE</PromotionType>
			<UnitCombatType>UNITCOMBAT_MOUNTED</UnitCombatType>
		</Row>
		<Row>
			<PromotionType>PROMOTION_CAPTURE</PromotionType>
			<UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
		</Row>
		<Row>
			<PromotionType>PROMOTION_CAPTURE</PromotionType>
			<UnitCombatType>UNITCOMBAT_GUN</UnitCombatType>
		</Row>
		<Row>
			<PromotionType>PROMOTION_CAPTURE</PromotionType>
			<UnitCombatType>UNITCOMBAT_RECON</UnitCombatType>
		</Row>
		<Row>
			<PromotionType>PROMOTION_CAPTURE</PromotionType>
			<UnitCombatType>UNITCOMBAT_ARMOR</UnitCombatType>
		</Row>

	</UnitPromotions_UnitCombats>

	<Language_en_US>

		<!-- PROMOTION_CAPTURE -->

		<Row Tag="TXT_KEY_PROMOTION_CAPTURE">
			<Text>Capture</Text>
		</Row>
		<Row Tag="TXT_KEY_PROMOTION_CAPTURE_HELP">
			<Text>Defeated enemy units join your side</Text>
		</Row>

		[COLOR="Blue"]<Update>
			<Where Tag="TXT_KEY_EUPANEL_CAPTURE_CHANCE" />
			<Set Text="[COLOR_CYAN]Capture Chance if Defeated: {1_Percent}%[ENDCOLOR]" />
		</Update>[/COLOR]

	</Language_en_US>

</GameData>
Feel free to use the code, but I'd appreciate if you would change all the places where the code has PROMOTION_CAPTURE to something slightly different.

Although I gave the promotion via a building, you can do so via a leader trait. Here's how Washington gives the Sentry promotion to all his units:
Spoiler :
Code:
<Trait_FreePromotionUnitCombats>
	<Row>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
		<UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
		<PromotionType>PROMOTION_SENTRY</PromotionType>
	</Row>
	<Row>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
		<UnitCombatType>UNITCOMBAT_ARCHER</UnitCombatType>
		<PromotionType>PROMOTION_SENTRY</PromotionType>
	</Row>
	<Row>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
		<UnitCombatType>UNITCOMBAT_RECON</UnitCombatType>
		<PromotionType>PROMOTION_SENTRY</PromotionType>
	</Row>
	<Row>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
		<UnitCombatType>UNITCOMBAT_MOUNTED</UnitCombatType>
		<PromotionType>PROMOTION_SENTRY</PromotionType>
	</Row>
	<Row>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
		<UnitCombatType>UNITCOMBAT_SIEGE</UnitCombatType>
		<PromotionType>PROMOTION_SENTRY</PromotionType>
	</Row>
	<Row>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
		<UnitCombatType>UNITCOMBAT_GUN</UnitCombatType>
		<PromotionType>PROMOTION_SENTRY</PromotionType>
	</Row>
	<Row>
		<TraitType>TRAIT_RIVER_EXPANSION</TraitType>
		<UnitCombatType>UNITCOMBAT_ARMOR</UnitCombatType>
		<PromotionType>PROMOTION_SENTRY</PromotionType>
	</Row>
</Trait_FreePromotionUnitCombats>
All you would have to do is replace TRAIT_RIVER_EXPANSION with the trait name your leader has, replace PROMOTION_SENTRY with your version of PROMOTION_CAPTURE, and remove the rows for UnitCombatType that don't apply (Archer and Siege).

PS: note that land Ranged units are actually referenced in the XML as UNITCOMBAT_ARCHER.
 
@LeeS How to apply it for single unit only, for example rifleman?
Code:
<Unit_FreePromotions>
	<Row>
		<UnitType>UNIT_RIFLEMAN</UnitType>
		<PromotionType>PROMOTION_CAPTURE</PromotionType>
	</Row>
</Unit_FreePromotions>
This would give the promotion to everyone's Rifleman units, though. Otherwise you'd have to use some lua, I think, or have a unique version of the Rifleman, if you want only one civ to get the promotion for the Rifleman unit.
 
Code:
<Unit_FreePromotions>
	<Row>
		<UnitType>UNIT_RIFLEMAN</UnitType>
		<PromotionType>PROMOTION_CAPTURE</PromotionType>
	</Row>
</Unit_FreePromotions>
This would give the promotion to everyone's Rifleman units, though. Otherwise you'd have to use some lua, I think, or have a unique version of the Rifleman, if you want only one civ to get the promotion for the Rifleman unit.

Oh, i have to do LUA if i want it for my own civ only?:cringe:
 
Top Bottom