My unit does not replace the galley, both are present

AboveFire

Chieftain
Joined
Apr 2, 2017
Messages
10
Hi everyone,

While I am pretty new to civ modding, I am currently working on a mod that add a civilization. While working on adding a new civ I found out that my UNIT_GREAT_CANOE did not replcae the UNIT_GALLEY as intended but that you could build both of them. Can someone help me on the subject?
Here is my unit XML and I have added screenshots that shows both of them side by side.

Code:
<?xml version="1.0" encoding="utf-8"?>
<GameData>
    <Types>
        <Row Type="UNIT_GREAT_CANOE" Kind="KIND_UNIT"/>
    </Types>
    <Units>
        <Row UnitType="UNIT_GREAT_CANOE" BaseMoves="4" Cost="65" AdvisorType="ADVISOR_CONQUEST" BaseSightRange="2" ZoneOfControl="true" Domain="DOMAIN_SEA" FormationClass="FORMATION_CLASS_NAVAL" Name="LOC_UNIT_GREAT_CANOE_NAME" Description="LOC_UNIT_GREAT_CANOE_DESCRIPTION" PurchaseYield="YIELD_GOLD" PseudoYieldType="PSEUDOYIELD_UNIT_NAVAL_COMBAT" PromotionClass="PROMOTION_CLASS_NAVAL_MELEE" Maintenance="1" Combat="20" MandatoryObsoleteTech="TECH_STEAM_POWER" PrereqTech="TECH_SAILING"/>
    </Units>
    <UnitUpgrades>
        <Row Unit="UNIT_GREAT_CANOE" UpgradeUnit="UNIT_CARAVEL"/>
    </UnitUpgrades>
    <UnitReplaces>
        <Row CivUniqueUnitType="UNIT_GREAT_CANOE" ReplacesUnitType="UNIT_GALLEY"/>
    </UnitReplaces>
    <UnitAIInfos>
        <Row UnitType="UNIT_GREAT_CANOE" AiType="UNITAI_COMBAT"/>
        <Row UnitType="UNIT_GREAT_CANOE" AiType="UNITAI_EXPLORE"/>
        <Row UnitType="UNIT_GREAT_CANOE" AiType="UNITTYPE_MELEE"/>
        <Row UnitType="UNIT_GREAT_CANOE" AiType="UNITTYPE_NAVAL"/>
    </UnitAIInfos>
    <TypeTags>
        <Row Type="UNIT_GREAT_CANOE" Tag="CLASS_NAVAL_MELEE"/>
    </TypeTags>
</GameData>
 

Attachments

See from the Units file the data on the Longship:
Code:
<GameInfo>
	<Types>
		<Row Type="UNIT_NORWEGIAN_LONGSHIP" Kind="KIND_UNIT"/>
	</Types>
	<UnitAiInfos>
		<Row UnitType="UNIT_NORWEGIAN_LONGSHIP" AiType="UNITAI_COMBAT"/>
		<Row UnitType="UNIT_NORWEGIAN_LONGSHIP" AiType="UNITAI_EXPLORE"/>
		<Row UnitType="UNIT_NORWEGIAN_LONGSHIP" AiType="UNITTYPE_MELEE"/>
		<Row UnitType="UNIT_NORWEGIAN_LONGSHIP" AiType="UNITTYPE_NAVAL"/>
	</UnitAiInfos>
	<UnitReplaces>
		<Row CivUniqueUnitType="UNIT_NORWEGIAN_LONGSHIP" ReplacesUnitType="UNIT_GALLEY"/>
	</UnitReplaces>
	<TypeTags>
		<Row Type="UNIT_NORWEGIAN_LONGSHIP" Tag="CLASS_NAVAL_RAIDER"/>
		<Row Type="UNIT_NORWEGIAN_LONGSHIP" Tag="CLASS_NAVAL_MELEE"/>
		<Row Type="UNIT_NORWEGIAN_LONGSHIP" Tag="CLASS_LONGSHIP"/>
	</TypeTags>
	<Units>
		<Row UnitType="UNIT_NORWEGIAN_LONGSHIP" BaseMoves="3" Cost="65" AdvisorType="ADVISOR_CONQUEST"
			BaseSightRange="2" ZoneOfControl="true" Domain="DOMAIN_SEA" FormationClass="FORMATION_CLASS_NAVAL"
			Name="LOC_UNIT_NORWEGIAN_LONGSHIP_NAME" Description="LOC_UNIT_NORWEGIAN_LONGSHIP_DESCRIPTION"
			PurchaseYield="YIELD_GOLD" PromotionClass="PROMOTION_CLASS_NAVAL_MELEE" Maintenance="1" Combat="30"
			MandatoryObsoleteTech="TECH_ELECTRICITY"  PrereqTech="TECH_SAILING"
			TraitType="TRAIT_LEADER_UNIT_NORWEGIAN_LONGSHIP"/>
	</Units>
	<UnitUpgrades>
		<Row Unit="UNIT_NORWEGIAN_LONGSHIP" UpgradeUnit="UNIT_CARAVEL"/>
	</UnitUpgrades>
</GameInfo>
You are missing the designation of the TraitType, which makes the unit only availalbe to the Norway Leader.

From the game's Leaders file:
Code:
<GameInfo>
	<Types>
		<Row Type="TRAIT_LEADER_UNIT_NORWEGIAN_LONGSHIP" Kind="KIND_TRAIT"/>
	</Types>
	<AiLists>
		<Row ListType="HaraldWonders" LeaderType="TRAIT_LEADER_UNIT_NORWEGIAN_LONGSHIP" System="Buildings"/>
		<Row ListType="HaraldCivics" LeaderType="TRAIT_LEADER_UNIT_NORWEGIAN_LONGSHIP" System="Civics"/>
		<Row ListType="HaraldTechs" LeaderType="TRAIT_LEADER_UNIT_NORWEGIAN_LONGSHIP" System="Technologies"/>
	</AiLists>
	<LeaderTraits>
		<Row LeaderType="LEADER_HARDRADA" TraitType="TRAIT_LEADER_UNIT_NORWEGIAN_LONGSHIP"/>
	</LeaderTraits>
	<Traits>
		<Row TraitType="TRAIT_LEADER_UNIT_NORWEGIAN_LONGSHIP" Name="LOC_TRAIT_LEADER_TRAIT_LEADER_UNIT_NORWEGIAN_LONGSHIP_NAME"/>
	</Traits>
</GameInfo>
I'm not sure why all that other stuff is tied into the same trait. It doesn't seem to be necessary for the German U-Boat, but that may be because the German U-Boat is tied to the civilization rather than the leader.
Code:
<Row UnitType="UNIT_GERMAN_UBOAT" ...etc... TraitType="TRAIT_CIVILIZATION_UNIT_GERMAN_UBOAT" ...etc...
If you look in the civilizations file for the base game you'll be able to see how the U-Boat is hooked to the Germany Civilization by the trait.
 
Thanks a lot, this solved my problem :P. Now I can concentrate on fixing the artdefs !
 
Back
Top Bottom