[eINFO] Working with items - ArtDef and GameItemTypeArtDef tags

One of the confusing bits in FE is how items gain their graphics. I will try to explain it a bit here so it makes sense, also so modders can avoid some common mistakes with it.

Below is the Club XML quoted from CoreWeapons.xml:

    <GameItemType InternalName="Club">
        <DisplayName>Club</DisplayName>
        <Description>A gnarled root of pine, ripped from the ground and fashioned into a club.</Description>
        <Type>Weapon</Type>
        <WeaponType>Blunt</WeaponType>
        <CanBeEquipped>1</CanBeEquipped>
        <AdditionalTrainingTurns>5</AdditionalTrainingTurns>
        <ShopValue>15</ShopValue>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_Attack_Blunt</StrVal>
            <Value>5</Value>
        </GameModifier>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_CombatSpeed</StrVal>
            <Value>-4</Value>
        </GameModifier>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_CurrentWeight</StrVal>
            <Value>10</Value>
        </GameModifier>
            <GameModifier>
                <ModType>Unit</ModType>
                <Attribute>AdjustUnitStat</Attribute>
                <StrVal>UnitStat_BashChance</StrVal>
                <Value>100</Value>
                <Provides>Bash- Has a chance equal to the damage done of knocking the victim prone</Provides>
            </GameModifier>
        <IsAvailableForSovereignCustomization>0</IsAvailableForSovereignCustomization>
        <RarityDisplay>Common</RarityDisplay>
        <Prereq>
            <Type>RestrictedAbilityBonusOption</Type>
            <Attribute>GreatHammers</Attribute>
            <Target>Player</Target>
        </Prereq>
        <AIData AIPersonality="AI_General">
            <AIPrefType>AIPrefType_BLUNT</AIPrefType>
            <AIPriority>80</AIPriority>
        </AIData>
        <ArtDef>Club_ArtDef</ArtDef>
        <GameItemTypeArtDef InternalName="Club_ArtDef">
            <GameItemTypeModelPack InternalName="Club_Default">
                <IconFile>W_Club_Icon_01.png</IconFile>
                <TintR>0</TintR>
                <TintG>0</TintG>
                <TintB>0</TintB>
                <AttackSFX>Hit_Club1</AttackSFX>
                <AttackSFX>Hit_Club2</AttackSFX>
                <EquipSFX>Equip_WoodenItem_01</EquipSFX>
                <EquipSFX>Equip_WoodenItem_02</EquipSFX>
                <EquipSFX>Equip_WoodenItem_03</EquipSFX>
                <OnHitParticleName>Club_Attack</OnHitParticleName>
                <GameItemTypeModel>
                    <ModelFile>gfx/hkb/Weapons/K_Club_01.hkb</ModelFile>
                    <Texture_All>K_Weapons_Basic_Texture_01.png</Texture_All>
                    <Attachment>hand_right_Lcf</Attachment>
                </GameItemTypeModel>
            </GameItemTypeModelPack>
        </GameItemTypeArtDef>
    </GameItemType>
End of quote

The first thing you need to realize is that - despite how this appears - GameItemTypeArtDef is NOT a child tag of GameItemType. That means it can appear completely on its own without being inside a GameItemType. It is fully stand-alone. For example this bit below would give identical results to the bit above:

    <GameItemType InternalName="Club">
        <DisplayName>Club</DisplayName>
        <Description>A gnarled root of pine, ripped from the ground and fashioned into a club.</Description>
        <Type>Weapon</Type>
        <WeaponType>Blunt</WeaponType>
        <CanBeEquipped>1</CanBeEquipped>
        <AdditionalTrainingTurns>5</AdditionalTrainingTurns>
        <ShopValue>15</ShopValue>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_Attack_Blunt</StrVal>
            <Value>5</Value>
        </GameModifier>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_CombatSpeed</StrVal>
            <Value>-4</Value>
        </GameModifier>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_CurrentWeight</StrVal>
            <Value>10</Value>
        </GameModifier>
            <GameModifier>
                <ModType>Unit</ModType>
                <Attribute>AdjustUnitStat</Attribute>
                <StrVal>UnitStat_BashChance</StrVal>
                <Value>100</Value>
                <Provides>Bash- Has a chance equal to the damage done of knocking the victim prone</Provides>
            </GameModifier>
        <IsAvailableForSovereignCustomization>0</IsAvailableForSovereignCustomization>
        <RarityDisplay>Common</RarityDisplay>
        <Prereq>
            <Type>RestrictedAbilityBonusOption</Type>
            <Attribute>GreatHammers</Attribute>
            <Target>Player</Target>
        </Prereq>
        <AIData AIPersonality="AI_General">
            <AIPrefType>AIPrefType_BLUNT</AIPrefType>
            <AIPriority>80</AIPriority>
        </AIData>
        <ArtDef>Club_ArtDef</ArtDef>
    </GameItemType>

<!-- line space wee -->

        <GameItemTypeArtDef InternalName="Club_ArtDef">
            <GameItemTypeModelPack InternalName="Club_Default">
                <IconFile>W_Club_Icon_01.png</IconFile>
                <TintR>0</TintR>
                <TintG>0</TintG>
                <TintB>0</TintB>
                <AttackSFX>Hit_Club1</AttackSFX>
                <AttackSFX>Hit_Club2</AttackSFX>
                <EquipSFX>Equip_WoodenItem_01</EquipSFX>
                <EquipSFX>Equip_WoodenItem_02</EquipSFX>
                <EquipSFX>Equip_WoodenItem_03</EquipSFX>
                <OnHitParticleName>Club_Attack</OnHitParticleName>
                <GameItemTypeModel>
                    <ModelFile>gfx/hkb/Weapons/K_Club_01.hkb</ModelFile>
                    <Texture_All>K_Weapons_Basic_Texture_01.png</Texture_All>
                    <Attachment>hand_right_Lcf</Attachment>
                </GameItemTypeModel>
            </GameItemTypeModelPack>
        </GameItemTypeArtDef>

End of quote

 

A GameItemType is linked to a particular GameItemTypeArtDef by the <ArtDef> tag in the GameItemType (bolded in the quotes above). This is how you decide what graphics an item has.

When you want to overwrite a GameItemType from the /mods/ folder, you can do so with relatively few pains. Everything just gets deleted when you overwrite the old one, and only your new values get read in. This is not the case for the <GameItemTypeArtDef> and its children. Instead of removing all previous tags when you overwrite it, the game simply adds your new ones to the already existing ones.

Thus, if I want to change the icon for the club above all I would need in the GameItemTypeArtDef is this:

       <GameItemTypeArtDef InternalName="Club_ArtDef">
            <GameItemTypeModelPack InternalName="Club_Default">
                <IconFile>mynewicon.png</IconFile>
            </GameItemTypeModelPack>
        </GameItemTypeArtDef>
End of quote

because all the old values are saved when I add new values.

This means that when you are copying an item from the installation folder, you should not be copying any <GameItemTypeArtDef> unless you intend to create new ones or modify existing ones. If you simply want to make a stronger axe with the same graphics, you should leave out the GameItemTypeArtDef completely because it already exists in the installation directory. The <ArtiDef> in your item will link to the existing values.

 

This is actually important to get right, because I see mods popping up that are copying the whole <GameItemTypeArtDef> inside the items without making any changes. This means that you are inserting new models into an already existing modelpack. If the model is already defined in a <GameItemTypeArtDef> in the installation directory and you copy it, you are creating another one in the game. That means the game now has to render two clubs. There are also other issues such as mounts piling on each other.

 

 

 

7,241 views 1 replies
Reply #1 Top

Below is quoted the XML from CoreArmor.xml

    <GameItemType InternalName="LeatherBoots">
        <DisplayName>Leather Boots</DisplayName>
        <Description>Boots made from molded leather. They provide the barest of foot protection.</Description>
        <Type>Boots</Type>
        <CanBeEquipped>1</CanBeEquipped>
        <AdditionalTrainingTurns>4</AdditionalTrainingTurns>
        <ShopValue>40</ShopValue>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_CurrentWeight</StrVal>
            <Value>2</Value>
        </GameModifier>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_Defense_Blunt</StrVal>
            <Value>1</Value>
        </GameModifier>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_Defense_Cutting</StrVal>
            <Value>1</Value>
        </GameModifier>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_Defense_Pierce</StrVal>
            <Value>1</Value>
        </GameModifier>
        <IsAvailableForSovereignCustomization>0</IsAvailableForSovereignCustomization>
        <Likelihood>400</Likelihood>
        <RarityDisplay>Common</RarityDisplay>
        <Prereq>
            <Type>Tech</Type>
            <Attribute>Leatherworking</Attribute>
        </Prereq>
            <AIData AIPersonality="AI_General">
                <AIPriority>6</AIPriority>
            </AIData>
        <ArtDef>Art_LeatherBoots</ArtDef>
    </GameItemType>
End of quote

You'll notice that the GameItemTypeArtdef is completely missing from CoreArmor.xml. For most armor it can be found in ArtGameItem.xml.

I'm going to quote the artdef from the file below despite it being rather long. There's a point to it.

   <GameItemTypeArtDef InternalName="Art_LeatherBoots">
        <GameItemTypeModelPack InternalName="Art_LeatherBoots_1">
            <SupportedUnitModelType>AmarianMale</SupportedUnitModelType>
            <SupportedUnitModelType>HenchmanMale</SupportedUnitModelType>
            <SupportedUnitModelType>IroneerMale</SupportedUnitModelType>
            <SupportedUnitModelType>KingdomMale</SupportedUnitModelType>
            <SupportedUnitModelType>MancerMale</SupportedUnitModelType>
            <SupportedUnitModelType>TarthanMale</SupportedUnitModelType>
            <IconFile>Armor_K_LeatherBoots.png</IconFile>
            <TintR>0</TintR>
            <TintG>0</TintG>
            <TintB>0</TintB>
            <GameItemTypeModel>
                <ModelFile>gfx/hkb/Armor/K_Male_Leather_Boots_01.hkb</ModelFile>
                <Texture_All>K_Leather_Boots_Texture_D_01.png</Texture_All>
                <AttachmentType>Skinned</AttachmentType>
            </GameItemTypeModel>
        </GameItemTypeModelPack>
        <GameItemTypeModelPack InternalName="Art_LeatherBoots_2">
            <SupportedUnitModelType>FallenMale</SupportedUnitModelType>
            <SupportedUnitModelType>QuendarMale</SupportedUnitModelType>
            <SupportedUnitModelType>UrxenMale</SupportedUnitModelType>
            <IconFile>Armor_F_LeatherBoots.png</IconFile>
            <TintR>0</TintR>
            <TintG>0</TintG>
            <TintB>0</TintB>
            <GameItemTypeModel>
                <ModelFile>gfx/hkb/Armor/F_Male_Leather_Boots_01.hkb</ModelFile>
                <Texture_All>F_Leather_Boots_Texture_D_01.png</Texture_All>
                <AttachmentType>Skinned</AttachmentType>
            </GameItemTypeModel>
        </GameItemTypeModelPack>
        <GameItemTypeModelPack InternalName="Art_LeatherBoots_3">
            <SupportedUnitModelType>AmarianFemale</SupportedUnitModelType>
            <SupportedUnitModelType>FallenFemale</SupportedUnitModelType>
            <SupportedUnitModelType>IroneerFemale</SupportedUnitModelType>
            <SupportedUnitModelType>KingdomFemale</SupportedUnitModelType>
            <SupportedUnitModelType>MancerFemale</SupportedUnitModelType>
            <SupportedUnitModelType>TarthanFemale</SupportedUnitModelType>
            <IconFile>Armor_K_LeatherBoots.png</IconFile>
            <TintR>0</TintR>
            <TintG>0</TintG>
            <TintB>0</TintB>
            <GameItemTypeModel>
                <ModelFile>gfx/hkb/Armor/K_Female_Leather_Boots_01.hkb</ModelFile>
                <Texture_All>K_Leather_Boots_Texture_D_01.png</Texture_All>
                <AttachmentType>Skinned</AttachmentType>
            </GameItemTypeModel>
        </GameItemTypeModelPack>
        <GameItemTypeModelPack InternalName="Art_LeatherBoots_4">
            <SupportedUnitModelType>EmpireFemale</SupportedUnitModelType>
            <SupportedUnitModelType>QuendarFemale</SupportedUnitModelType>
            <SupportedUnitModelType>UrxenFemale</SupportedUnitModelType>
            <SupportedUnitModelType>WraithFemale</SupportedUnitModelType>
            <IconFile>Armor_F_LeatherBoots.png</IconFile>
            <TintR>0</TintR>
            <TintG>0</TintG>
            <TintB>0</TintB>
            <GameItemTypeModel>
                <ModelFile>gfx/hkb/Armor/K_Female_Leather_Boots_01.hkb</ModelFile>
                <Texture_All>F_Leather_Boots_Texture_D_01.png</Texture_All>
                <AttachmentType>Skinned</AttachmentType>
            </GameItemTypeModel>
        </GameItemTypeModelPack>
        <GameItemTypeModelPack InternalName="Art_LeatherBoots_5">
            <SupportedUnitModelType>EmpireMale</SupportedUnitModelType>
            <SupportedUnitModelType>SlaveMale</SupportedUnitModelType>
            <SupportedUnitModelType>WraithMale</SupportedUnitModelType>
            <IconFile>Armor_K_LeatherBoots.png</IconFile>
            <TintR>0</TintR>
            <TintG>0</TintG>
            <TintB>0</TintB>
            <GameItemTypeModel>
                <ModelFile>gfx/hkb/Armor/K_Male_Leather_Boots_01.hkb</ModelFile>
                <Texture_All>F_Leather_Boots_Texture_D_01.png</Texture_All>
                <AttachmentType>Skinned</AttachmentType>
            </GameItemTypeModel>
        </GameItemTypeModelPack>
    </GameItemTypeArtDef>
End of quote

In the above XML you'll notice that there are several <GameItemTypeModelPack> (the club only had one). This is the system that the game uses to display the same item differently on different characters. Starting at the top we find <GameItemTypeModelPack InternalName="Art_LeatherBoots_1"> which is the first pack. It defines what Leather Boots look like for several UnitModelTypes - AmarianMale, HenchmanMale, IroneerMale, KingdomMale and so on.

<UnitModelType> are defined in UnitTypes (see CoreUnits.xml). They are primarily used in systems that decide looks for units. For example Lord Relias has <UnitModelType>KingdomMale</UnitModelType> - this means his graphics for the leather boots will be those defined in the first modelpack above (bolded). UnitModelType are also used to determine heads, skins, clothing and facial stuff for new units (custom sovereigns and new unit designs). In the case of HenchmanMale and some other they can also be used to restrict traits and item choices for Unit Designs (not for champions).

If I am working on a new race, I may want to add a new unitmodeltype to the game. If I want the new unitmodeltype to have the same graphics for Leather Boots as Fallen Males do for example, all I would need in my mod is this

   <GameItemTypeArtDef InternalName="Art_LeatherBoots">
        <GameItemTypeModelPack InternalName="Art_LeatherBoots_2">
            <SupportedUnitModelType>MyNewModelType</SupportedUnitModelType>
        </GameItemTypeModelPack>
    </GameItemTypeArtDef>
End of quote

Again, note how I do not need to repeat any of the graphics information because it is already stored in the XML above in the installation directory.

 

 

If we go back up again, maybe you noticed that the Club didn't have any <SupportedUnitModelType> at all. You'll find the same phenomenon in shields in CoreArmor.xml. This bit is important - a GameItemTypeModelPack that does not have any <SupportedUnitModelType> can be worn by EVERYONE.

BUT a <GameItemTypeArtDef> that only has GameItemTypeModelPacks with <SupportedUnitModelType> cannot be worn by a unit unless it is explicitly supported. For example, below is an artdef that could only be worn by KingdomMale unitmodeltypes:

   <GameItemTypeArtDef InternalName="Art_ExperimentalItem">
        <GameItemTypeModelPack InternalName="Art_ExperimentalItem_1">
            <SupportedUnitModelType>KingdomMale</SupportedUnitModelType>
            <IconFile>Armor_K_LeatherBoots.png</IconFile>
            <TintR>0</TintR>
            <TintG>0</TintG>
            <TintB>0</TintB>
            <GameItemTypeModel>
                <ModelFile>gfx/hkb/Armor/K_Male_Leather_Boots_01.hkb</ModelFile>
                <Texture_All>K_Leather_Boots_Texture_D_01.png</Texture_All>
                <AttachmentType>Skinned</AttachmentType>
            </GameItemTypeModel>
        </GameItemTypeModelPack>
    </GameItemTypeArtDef>
End of quote

I strongly advise against using this system to restrict items for champions however. It is only really usable for Unit Design. For example you could make a new type of shield that only Fallen Males could use - but don't give it to a champion or you'll run into a lot of issues.

 

+1 Loading…