Help with custom unit error

scotchandcake

Chieftain
Joined
Jul 12, 2012
Messages
38
Hey folks,

I made a new unit for a mod, which pops up an error in the Databas Log.
I don't know what the error is trying to tell me, I can't find anything wrong in the xml.

Maybe someone recognizes the error, or can point me to the problem, I'd appreciate any help! :worship:

Here the error lines from the Database Log:

Spoiler :
[19671.836] While executing - 'insert into UnitClasses('Type', 'Description', 'DefaultUnit', 'MaxPlayerInstances') values (?, ?, ?, ?);'
[19671.836] In XMLSerializer while inserting row into table insert into UnitClasses('Type', 'Description', 'DefaultUnit', 'MaxPlayerInstances') with values (UNITCLASS_SHAMAN, TXT_KEY_UNITCLASS_SHAMAN, UNIT_SHAMAN, 1, ).
[19671.836] In XMLSerializer while updating table UnitClasses from file xml/Units/Shaman.xml.
[19671.836] column Type is not unique


Here the complete unit xml for reference:

Spoiler :
<GameData>
<UnitClasses>
<Row>
<Type>UNITCLASS_SHAMAN</Type>
<Description>TXT_KEY_UNITCLASS_SHAMAN</Description>
<DefaultUnit>UNIT_SHAMAN</DefaultUnit>
<MaxPlayerInstances>1</MaxPlayerInstances>
</Row>
</UnitClasses>
<Units>
<Row>
<Class>UNITCLASS_SHAMAN</Class>
<Type>UNIT_SHAMAN</Type>
<PrereqTech>TECH_ASTROLOGY</PrereqTech>
<Cost>100</Cost>
<Moves>2</Moves>
<CivilianAttackPriority>CIVILIAN_ATTACK_PRIORITY_HIGH</CivilianAttackPriority>
<Domain>DOMAIN_LAND</Domain>
<DefaultUnitAI>UNITAI_WORKER</DefaultUnitAI>
<Description>TXT_KEY_UNIT_SHAMAN</Description>
<Civilopedia>TXT_KEY_CIV5_UNIT_SHAMAN_TEXT</Civilopedia>
<Strategy>TXT_KEY_UNIT_SHAMAN_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_SHAMAN_HELP</Help>
<AdvancedStartCost>10</AdvancedStartCost>
<WorkRate>100</WorkRate>
<CombatLimit>0</CombatLimit>
<UnitArtInfo>ART_DEF_UNIT_SHAMAN</UnitArtInfo>
<UnitFlagAtlas>FLAG_ATLAS_SUPER</UnitFlagAtlas>
<UnitFlagIconOffset>0</UnitFlagIconOffset>
<IconAtlas>UNIT_ATLAS_SUPER</IconAtlas>
<PortraitIndex>0</PortraitIndex>
<MoveRate>GREAT_PERSON</MoveRate>
</Row>
</Units>
<Unit_AITypes>
<Row>
<UnitType>UNIT_SHAMAN</UnitType>
<UnitAIType>UNITAI_WORKER</UnitAIType>
</Row>
</Unit_AITypes>
<Unit_Flavors>
<Row>
<UnitType>UNIT_SHAMAN</UnitType>
<FlavorType>FLAVOR_TILE_IMPROVEMENT</FlavorType>
<Flavor>5</Flavor>
</Row>
<Row>
<UnitType>UNIT_SHAMAN</UnitType>
<FlavorType>FLAVOR_CULTURE</FlavorType>
<Flavor>3</Flavor>
</Row>
<Row>
<UnitType>UNIT_SHAMAN</UnitType>
<FlavorType>FLAVOR_RELIGION</FlavorType>
<Flavor>3</Flavor>
</Row>
</Unit_Flavors>
<Unit_BuildingClassRequireds>
<Row>
<UnitType>UNIT_SHAMAN</UnitType>
<BuildingClassType>BUILDINGCLASS_TOTEM</BuildingClassType>
</Row>
</Unit_BuildingClassRequireds>
<Unit_FreePromotions>
<Row>
<UnitType>UNIT_SHAMAN</UnitType>
<PromotionType>PROMOTION_SHAMAN_GRAVEYARD</PromotionType>
</Row>
<Row>
<UnitType>UNIT_SHAMAN</UnitType>
<PromotionType>PROMOTION_SHAMAN_VISION_POND</PromotionType>
</Row>
<Row>
<UnitType>UNIT_SHAMAN</UnitType>
<PromotionType>PROMOTION_SHAMAN_INSTINCT</PromotionType>
</Row>
</Unit_FreePromotions>
<UnitPromotions>
<Row>
<Type>PROMOTION_SHAMAN_GRAVEYARD</Type>
<Description>TXT_KEY_PROMOTION_SHAMAN_GRAVEYARD</Description>
<Help>TXT_KEY_PROMOTION_SHAMAN_GRAVEYARD_HELP</Help>
<Sound>AS2D_IF_LEVELUP</Sound>
<CannotBeChosen>true</CannotBeChosen>
<PortraitIndex>42</PortraitIndex>
<IconAtlas>PROMOTION_ATLAS</IconAtlas>
<PediaType>PEDIA_ATTRIBUTES</PediaType>
<PediaEntry>TXT_KEY_PEDIA_PROMOTION_SHAMAN_GRAVEYARD</PediaEntry>
</Row>
<Row>
<Type>PROMOTION_SHAMAN_VISION_POND</Type>
<Description>TXT_KEY_PROMOTION_SHAMAN_VISION_POND</Description>
<Help>TXT_KEY_PROMOTION_SHAMAN_VISION_POND_HELP</Help>
<Sound>AS2D_IF_LEVELUP</Sound>
<CannotBeChosen>true</CannotBeChosen>
<PortraitIndex>37</PortraitIndex>
<IconAtlas>PROMOTION_ATLAS</IconAtlas>
<PediaType>PEDIA_ATTRIBUTES</PediaType>
<PediaEntry>TXT_KEY_PEDIA_PROMOTION_SHAMAN_VISION_POND</PediaEntry>
</Row>
<Row>
<Type>PROMOTION_SHAMAN_INSTINCT</Type>
<Description>TXT_KEY_PROMOTION_SHAMAN_INSTINCT</Description>
<Help>TXT_KEY_PROMOTION_SHAMAN_INSTINCT_HELP</Help>
<Sound>AS2D_IF_LEVELUP</Sound>
<CannotBeChosen>true</CannotBeChosen>
<SeeInvisible>INVISIBLE_SUBMARINE</SeeInvisible>
<PortraitIndex>34</PortraitIndex>
<IconAtlas>PROMOTION_ATLAS</IconAtlas>
<PediaType>PEDIA_ATTRIBUTES</PediaType>
<PediaEntry>TXT_KEY_PEDIA_PROMOTION_SHAMAN_INSTINCT</PediaEntry>
</Row>
</UnitPromotions>
<Language_en_US>
<Row Tag="TXT_KEY_UNITCLASS_SHAMAN">
<Text>Shaman</Text>
</Row>
<Row Tag="TXT_KEY_UNIT_SHAMAN">
<Text>Shaman</Text>
</Row>
<Row Tag="TXT_KEY_UNIT_SHAMAN_HELP">
<Text>May construct the Graveyard (+1 [ICON_CULTURE] Culture) and the Vision Pond (+1 [ICON_PEACE] Faith) Improvements.[NEWLINE][NEWLINE]Can only be built in a City with a Totem Pole.[NEWLINE]You can never have more than one Shaman at the same time.</Text>
</Row>
<Row Tag="TXT_KEY_UNIT_SHAMAN_STRATEGY">
<Text>The Shaman is a powerful Civilian Unit. Use it to construct the Graveyard improvement, which increases the [ICON_CULTURE] Culture and [ICON_PEACE] Faith of your Civilization.</Text>
</Row>
<Row Tag="TXT_KEY_CIV5_UNIT_SHAMAN_TEXT">
<Text>The term "shaman" originates from the Evenk language of North Asia and was introduced to the west by the Russians. Upon learning more about religious traditions across the world, western scholars also used the term "shamanism" in reference to similar magico-religious practices found within the indigenous religions of other parts of Asia, Africa, Australasia and the Americas. Various historians have argued that shamanism also played a role in many of the pre-Christian religions of Europe, and that shamanistic elements may have survived in popular culture right through to the Early Modern period. Various archaeologists and historians of religion have also suggested that shamanism may have been a dominant religious practice for humanity during the Palaeolithic.[NEWLINE][NEWLINE]Mircea Eliade writes, "A first definition of this complex phenomenon, and perhaps the least hazardous, will be: shamanism = "technique of religious ecstasy".[NEWLINE]Shamanism encompasses the belief that shamans are intermediaries or messengers between the human world and the spirit worlds. Shamans are said to treat ailments/illness by mending the soul.[NEWLINE][NEWLINE](Quoted from en.wikipedia.org/wiki/Shamanism)</Text>
</Row>
<Row Tag="TXT_KEY_PROMOTION_SHAMAN_GRAVEYARD">
<Text>Ancestor Spirits</Text>
</Row>
<Row Tag="TXT_KEY_PROMOTION_SHAMAN_GRAVEYARD_HELP">
<Text>May build the Graveyard improvement (+1 [ICON_CULTURE] Culture) on flat Tundra and Plains, which allows communication with the Spirits of the Ancestors.</Text>
</Row>
<Row Tag="TXT_KEY_PEDIA_PROMOTION_SHAMAN_GRAVEYARD">
<Text>May build the Graveyard improvement (+1 [ICON_CULTURE] Culture) on flat Tundra and Plains, which allows communication with the Spirits of the Ancestors.</Text>
</Row>
<Row Tag="TXT_KEY_PROMOTION_SHAMAN_VISION_POND">
<Text>Trance Vision</Text>
</Row>
<Row Tag="TXT_KEY_PROMOTION_SHAMAN_VISION_POND_HELP">
<Text>May build the Vision Pond improvement (+1 [ICON_PEACE] Faith) in Forests and Jungles, which grants Visions through Nature Spirits.</Text>
</Row>
<Row Tag="TXT_KEY_PEDIA_PROMOTION_SHAMAN_VISION_POND">
<Text>May build the Vision Pond improvement (+1 [ICON_PEACE] Faith) in Forests and Jungles, which grants Visions through Nature Spirits.</Text>
</Row>
<Row Tag="TXT_KEY_PROMOTION_SHAMAN_INSTINCT">
<Text>Instinct</Text>
</Row>
<Row Tag="TXT_KEY_PROMOTION_SHAMAN_INSTINCT_HELP">
<Text>A strong bond to kindred spirits grants animal instincts, which allow the detection of invisible units.</Text>
</Row>
<Row Tag="TXT_KEY_PEDIA_PROMOTION_SHAMAN_INSTINCT">
<Text>A strong bond to kindred spirits grants animal instincts, which allow the detection of invisible units.</Text>
</Row>
</Language_en_US>
</GameData>
 
column Type is not unique

The XML file itself looks OK, but I believe that error is telling you that you have another file in this mod or another active mod that also adds a Type UNITCLASS_SHAMAN to the UnitClasses table.

EDIT: You may have two versions of your mod in your MODS folder. Delete the old one.

And FYI, unless you've got them in another file, it looks like you're also going to need some art defines for ART_DEF_UNIT_SHAMAN (in tables ArtDefine_UnitInfos, ArtDefine_UnitInfoMemberInfos, ArtDefine_UnitMemberCombats, ArtDefine_UnitMemberCombatWeapons, and ArtDefine_UnitMemberInfos).
 
I checked, I didn't have another version of the mod active.
I'll have to look through other mods to see if there is some shaman unit...
Maybe this should tell me to use more exclusive tags, like UNIT_MYMOD_SHAMAN or something, to make sure there is no interference possible anywhere...

The ArtDefine is settled, its in a separate sql ;)

The unit itself works fine, I don't have any issues in-game.
I just wanted to make sure to avoid any problems, which might pop up for users in a situation I just didn't come across when testing...

Thanks for the help :)
 
If that is a direct cut/paste of your XML then you have a space in the following entry that might cause issues (but probably not the one you mention):

<CivilianAttackPriority>CIVILIAN_ATTACK_PRIORITY_H IGH</CivilianAttackPriority>

Another thing, is this the only time you use this unit class or are there subsequent units using the same class type (i.e. UU entries)? Because you only need to run <Rows> only once for the unit class entry.

I ask as you might be using the same XML file as a template for others units and thus duplicating keys. You only get this message on fields defined as keys on the table as they have to be unique.
 
Top Bottom