What's Wrong with this code for a new Settler

duBerry

Chieftain
Joined
Dec 27, 2011
Messages
6
I am trying to create an American Settler with the ability to ignore terrain costs. However when I run the mod playing as the Civilization America the unit doesn't appear in the list of available units to build! :confused:

Can anyone tell me what is missing or wrong with the code below ?
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 1/30/2012 9:09:41 AM -->

<GameData>

<!-- Create new entry in Units table for American Settler Unit-->
<Units>
<Row>
<ID>0</ID>
<Class>UNITCLASS_SETTLER</Class>
<Type>UNIT_AMERICAN_SETTLER</Type>
<Moves>2</Moves>
<Capture>UNITCLASS_WORKER</Capture>
<CivilianAttackPriority>CIVILIAN_ATTACK_PRIORITY_HIGH_EARLY_GAME_ONLY</CivilianAttackPriority>
<HurryCostModifier>20</HurryCostModifier>
<Domain>DOMAIN_LAND</Domain>
<DefaultUnitAI>UNITAI_SETTLE</DefaultUnitAI>
<Description>TXT_KEY_UNIT_SETTLER</Description>
<Civilopedia>TXT_KEY_CIV5_ANTIQUITY_SETTLER_TEXT</Civilopedia>
<Strategy>TXT_KEY_UNIT_SETTLER_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_HELP_SETTLER</Help>
<Requirements>TXT_KEY_NO_ACTION_SETTLER_SIZE_LIMIT_HARDCODED</Requirements>
<Food>true</Food>
<Found>true</Found>
<CombatLimit>0</CombatLimit>
<UnitArtInfo>ART_DEF_UNIT__SETTLER</UnitArtInfo>
<UnitArtInfoCulturalVariation>true</UnitArtInfoCulturalVariation>
<PortraitIndex>0</PortraitIndex>
<IconAtlas>UNIT_ATLAS_1</IconAtlas>
</Row>
</Units>

<!--American Settler can ignore terrain cost-->
<Unit_FreePromotions>
<Row>
<UnitType>UNIT_AMERICAN_SETTLER</UnitType>
<PromotionType>PROMOTION_IGNORE_TERRAIN_COST</PromotionType>
</Row>
</Unit_FreePromotions>

<!-- American Settler is limited to the America Civilization-->
<Civilization_UnitClassOverrides>
<Row>
<CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
<UnitClassType>UNITCLASS_SETTLER</UnitClassType>
<UnitType>UNIT_AMERICAN_SETTLER</UnitType>
</Row>
</Civilization_UnitClassOverrides>
</GameData>
 
I'm not personally familiar with modding but you appear to have superfluous spaces in <CivilianAttackPriority>, <Civilopedia> and <Requirements> along with a superfluous underscore in <UnitArtInfo>. Any or all of that could be the cause but it could equally be something else.
 
filli_noctus is right, also <ID>0</ID> should be removed, it should be used only for the first unit in the game's database, which is the standard Settler.
 
filli_noctus,
The double underscore was a typo in the message and isn't in the MODs XML code. Hopefully your feedback will teach me to be more careful with typing code :blush:

The superfluous spaces are a weird phenomenon, they don't appear in the XML code or in the original posting. I am not sure why but they only appear when the website formats the document.

PawelS,
Thanks for the advice on the <ID>0</ID> statement, removing it has solved the problem :).

Still so much for me to learn! Can you advise where I can find a comprehensive guide to the XML code used in CIV5.
 
Back
Top Bottom