Unit upgrade paths

DavDarkelf

Chieftain
Joined
Nov 28, 2016
Messages
76
I've had the following

Code:
<UnitReplaces>
  <Row CivUniqueUnitType="UNIT_UKLONGBOWMAN" ReplacesUnitType="UNIT_CROSSBOWMAN"/>
 </UnitReplaces>

Yet when testing in a game I could still build both a crossbowman and a longbowman unit. It turns out that I'd forgotten you need to add a TraitType to the unit definition. If you just copy the normal unit definition from say the crossbowman and change the name of the unit and it's stats it won't work properly.
Code:
<Units>
  <Row UnitType="UNIT_UKLONGBOWMAN" BaseMoves="2" Cost="180" AdvisorType="ADVISOR_CONQUEST" BaseSightRange="2" ZoneOfControl="false" Domain="DOMAIN_LAND" FormationClass="FORMATION_CLASS_LAND_COMBAT" Name="LOC_UNIT_UKLONGBOWMAN_NAME" Description="LOC_UNIT_UKLONGBOWMAN_DESCRIPTION" PurchaseYield="YIELD_GOLD" PromotionClass="PROMOTION_CLASS_RANGED" Maintenance="3" Combat="35" RangedCombat="45" Range="2" PrereqTech="TECH_MACHINERY" MandatoryObsoleteTech="TECH_ADVANCED_BALLISTICS" TraitType="TRAIT_CIVILIZATION_UNIT_UKLONGBOWMAN"/>
 </Units>

The TraitType needs to be defined as part of your Civilization. In my case in my UK_Civilizations.xml file

Code:
    <Traits>
        <Row TraitType="TRAIT_CIVILIZATION_UNIT_UKLONGBOWMAN" Name="LOC_UNIT_UKLONGBOWMAN_NAME" Description="LOC_UNIT_UKLONGBOWMAN_DESCRIPTION"/>
    </Traits>

Thought this might help any new modders trying to figure this out :-)
 
Last edited:
Back
Top Bottom