Unit mod doesn't appear

Nucleotyde

Chieftain
Joined
Aug 16, 2012
Messages
7
I've been working on a custom civilization mod, and I'm having trouble adding a unique unit. I'm trying to replace the swordsman for my civ with a swordsman that ignores terrain costs, so I made my unit's XML file match the stuff for the swordsman, added the promotion, changed the unit type, and left everything else the same. Then, I set my civilization to use that unit instead of the swordsman.

When I try to play my mod in the game, they lack my unique unit and are unable to build the regular swordsman. I swapped my civ's unique unit for the Legion to see if there was a problem with that code, and I could load the Legion just fine. I'm also able to load the swordsman with my mod active as long as I pick a different civ. I've looked over the code for my unit several times, but I can't find any noticeable problems. What am I missing?

By the way, I don't have G&K, so everything I'm doing right now is in vanilla.
 
Post the file while modifies your unit XML and your civilization's XML. (encase them in
Code:
 tags)

Double check that you have included both files in your mod with UpdateDatabase.
 
Here's the code for my unit.

Code:
<GameData>
	<Units>
		<Row>
			<Class>UNITCLASS_SWORDSMAN</Class>
			<Type>UNIT_PLUMBER</Type>
			<PrereqTech>TECH_IRON_WORKING</PrereqTech>
			<Combat>11</Combat>
			<Cost>75</Cost>
			<Moves>2</Moves>
			<HurryCostModifier>20</HurryCostModifier>
			<CombatClass>UNITCOMBAT_MELEE</CombatClass>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
			<Description>TXT_KEY_UNIT_SWORDSMAN</Description>
			<Civilopedia>TXT_KEY_CIV5_ANTIQUITY_SWORDSMAN_TEXT</Civilopedia>
			<Strategy>TXT_KEY_UNIT_SWORDSMAN_STRATEGY</Strategy>
			<Help>TXT_KEY_UNIT_HELP_SWORDSMAN</Help>
			<MilitarySupport>true</MilitarySupport>
			<MilitaryProduction>true</MilitaryProduction>
			<Pillage>true</Pillage>
			<ObsoleteTech>TECH_GUNPOWDER</ObsoleteTech>
			<GoodyHutUpgradeUnitClass>UNITCLASS_LONGSWORDSMAN</GoodyHutUpgradeUnitClass>
			<AdvancedStartCost>20</AdvancedStartCost>
			<XPValueAttack>3</XPValueAttack>
			<XPValueDefense>3</XPValueDefense>
			<Conscription>1</Conscription>
			<UnitArtInfo>ART_DEF_UNIT_SWORDSMAN</UnitArtInfo>
			<UnitFlagIconOffset>14</UnitFlagIconOffset>
			<IconAtlas>UNIT_ATLAS_1</IconAtlas>
			<PortraitIndex>14</PortraitIndex>
			<MoveRate>HEAVY_BIPED</MoveRate>
		</Row>
	</Units>
	<Unit_AITypes>
		<Row>
			<UnitType>UNIT_PLUMBER</UnitType>
			<UnitType>UNITAI_ATTACK</UnitType>
		</Row>
		<Row>
			<UnitType>UNIT_PLUMBER</UnitType>
			<UnitType>UNITAI_DEFENSE</UnitType>
		</Row>
	</Unit_AITypes>
	<Unit_ClassUpgrades>
		<Row>
			<UnitType>UNIT_PLUMBER</UnitType>
			<UnitClassType>UNITCLASS_LONGSWORDSMAN</UnitClassType>
		</Row>
	</Unit_ClassUpgrades>
	<Unit_Flavors>
		<Row>
			<UnitType>UNIT_PLUMBER</UnitType>
			<FlavorType>FLAVOR_OFFENSE</FlavorType>
			<Flavor>6</Flavor>
		</Row>
		<Row>
			<UnitType>UNIT_PLUMBER</UnitType>
			<FlavorType>FLAVOR_DEFENSE</FlavorType>
			<Flavor>6</Flavor>
		</Row>
	</Unit_Flavors>
	<Unit_FreePromotions>
		<Row>
			<UnitType>UNIT_PLUMBER</UnitType>
			<PromotionType>PROMOTION_IGNORE_TERRAIN_COST</PromotionType>
		</Row>
	</Unit_FreePromotions>
	<Unit_ResourceQuantityRequirements>
		<Row>
			<UnitType>UNIT_PLUMBER</UnitType>
			<ResourceType>RESOURCE_IRON</ResourceType>
		</Row>
	</Unit_ResourceQuantityRequirements>
</GameData>

And here's the code for my civ.

Code:
<GameData>
	<Civilizations>
		<Row>
			<Type>CIVILIZATION_MUSHROOM</Type>
			<Description>TXT_KEY_CIV_MUSHROOM_DESC</Description>
			<ShortDescription>TXT_KEY_CIV_MUSHROOM_SHORT_DESC</ShortDescription>
			<Adjective>TXT_KEY_CIV_MUSHROOM_ADJECTIVE</Adjective>
			<CivilopediaTag>TXT_KEY_CIV5_MUSHROOM</CivilopediaTag>
			<DefaultPlayerColor>PLAYERCOLOR_RED</DefaultPlayerColor>
			<ArtDefineTag>ART_DEF_CIVILZATION_ENGLAND</ArtDefineTag>
			<ArtStyleType>ARTSTYLE_EUROPEAN</ArtStyleType>
			<ArtStyleSuffix>_EURO</ArtStyleSuffix>
			<ArtStylePrefix>EUROPEAN</ArtStylePrefix>
			<PortraitIndex>6</PortraitIndex>
			<IconAtlas>CIV_COLOR_ATLAS</IconAtlas>
			<AlphaIconAtlas>CIV_ALPHA_ATLAS</AlphaIconAtlas>
			<MapImage>MapEngland512.dds</MapImage>
			<DawnOfManQuote>TXT_KEY_CIV5_DAWN_ENGLAND_TEXT</DawnOfManQuote>
			<DawnOfManImage>DOM_Elizabeth.dds</DawnOfManImage>
			<DawnOfManAudio>AS2D_DOM_SPEECH_ENGLAND</DawnOfManAudio>
		</Row>
	</Civilizations>
	<Civilization_BuildingClassOverrides>
		<Row>
			<CivilizationType>CIVILIZATION_MUSHROOM</CivilizationType>
			<BuildingClassType>BUILDINGCLASS_AQUEDUCT</BuildingClassType>
			<Buildingtype>BUILDING_WARPPIPE</Buildingtype>
		</Row>
		<Row>
			<CivilizationType>CIVILIZATION_MUSHROOM</CivilizationType>
			<BuildingClassType>BUILDINGCLASS_PALACE</BuildingClassType>
			<BuildingType>BUILDING_PEACHCASTLE</BuildingType>
		</Row>
	</Civilization_BuildingClassOverrides>
	<Civilization_CityNames>
		<Row>
			<CivilizationType>CIVILIZATION_MUSHROOM</CivilizationType>
			<CityName>TXT_KEY_CITY_NAME_TOADTOWN</CityName>
		</Row>
		<Row>
			<CivilizationType>CIVILIZATION_MUSHROOM</CivilizationType>
			<CityName>TXT_KEY_CITY_NAME_KOOPAVILLAGE</CityName>
		</Row>
		<Row>
			<CivilizationType>CIVILIZATION_MUSHROOM</CivilizationType>
			<CityName>TXT_KEY_CITY_NAME_GOOMBAVILLAGE</CityName>
		</Row>
		<Row>
			<CivilizationType>CIVILIZATION_MUSHROOM</CivilizationType>
			<CityName>TXT_KEY_CITY_NAME_YOSHISISLAND</CityName>
		</Row>
	</Civilization_CityNames>
	<Civilization_FreeBuildingClasses>
		<Row>
			<CivilizationType>CIVILIZATION_MUSHROOM</CivilizationType>
			<BuildingClassType>BUILDINGCLASS_PALACE</BuildingClassType>
		</Row>
	</Civilization_FreeBuildingClasses>
	<Civilization_FreeTechs>
		<Row>
			<CivilizationType>CIVILIZATION_MUSHROOM</CivilizationType>
			<TechType>TECH_AGRICULTURE</TechType>
		</Row>
	</Civilization_FreeTechs>
	<Civilization_FreeUnits>
		<Row>
			<CivilizationType>CIVILIZATION_MUSHROOM</CivilizationType>
			<UnitClassType>UNITCLASS_SETTLER</UnitClassType>
			<Count>1</Count>
			<UnitAIType>UNITAI_SETTLE</UnitAIType>
		</Row>
	</Civilization_FreeUnits>
	<Civilization_Leaders>
		<Row>
			<CivilizationType>CIVILIZATION_MUSHROOM</CivilizationType>
			<LeaderheadType>LEADER_PEACH</LeaderheadType>
		</Row>
	</Civilization_Leaders>
	<Civilization_UnitClassOverrides>
		<Row>
			<CivilizationType>CIVILIZATION_MUSHROOM</CivilizationType>
			<UnitClassType>UNITCLASS_SWORDSMAN</UnitClassType>
			<UnitType>UNIT_PLUMBER</UnitType>
		</Row>
	</Civilization_UnitClassOverrides>
	<Civilization_Start_Region_Priority>
		<Row>
			<CivilizationType>CIVILIZATION_MUSHROOM</CivilizationType>
			<RegionType>REGION_GRASS</RegionType>
		</Row>
	</Civilization_Start_Region_Priority>
</GameData>

I was kind of hoping that I wouldn't have to post it since it's kind of silly, but that doesn't matter if it gets fixed. Both files are getting updated with UpdateDatabase.
 
Code:
<Unit_AITypes>
		<Row>
			<UnitType>UNIT_PLUMBER</UnitType>
			<[B][U]UnitType[/U][/B]>UNITAI_ATTACK</[B][U]UnitType[/U][/B]>
		</Row>
		<Row>
			<UnitType>UNIT_PLUMBER</UnitType>
			<[B][U]UnitType[/U][/B]>UNITAI_DEFENSE</[B][U]UnitType[/U][/B]>
		</Row>
	</Unit_AITypes>

Change bolded UnitType to UnitAIType
 
It's always good to have an extra pair of eyes with these things. I changed it, and it's working fine. Thanks a lot.
 
No problem mate.
 
Back
Top Bottom