Rough Guide to Units.artdef

Why don't districts work the same way?

If I take a copy of the base Units.artdef file, reduce it to a single unit, e.g. UNIT_APOSTLE, and change the name to my custom unit, e.g. UNIT_HOLY_MAN then my Holy Man looks like an Apostle.

If I do the same with a district my district is invisible.
 
From OP - "It is possible to create a new UnitCulture in the Cultures.artdef and then start to define new cultural variations of units in the Units.artdef."

So say I wanted to have a cultural variation for the Trader Unit for a specific civ.

Would it be this in Cultures.artdef:
Spoiler :
Code:
<AssetObjects..ArtDefSet>
    <m_Version>
        <major>4</major>
        <minor>0</minor>
        <build>314</build>
        <revision>526</revision>
    </m_Version>
    <m_TemplateName text="Cultures"/>
    <m_RootCollections>
        <Element>
            <m_CollectionName text="UnitCulture"/>
            <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
            <Element>
                <m_Fields>
                    <m_Values>
                        <Element class="AssetObjects..CollectionValue">
                            <m_eObjectType>INVALID</m_eObjectType>
                            <m_eValueType>ARTDEF_REF</m_eValueType>
                            <m_Values>
                                <Element class="AssetObjects..ArtDefReferenceValue">
                                    <m_ElementName text="CIVILIZATION_KC20_TES_ELSWEYR"/>
                                    <m_RootCollectionName text="Civilization"/>
                                    <m_ArtDefPath text="Civilizations.artdef"/>
                                    <m_CollectionIsLocked>true</m_CollectionIsLocked>
                                    <m_TemplateName text="Civilizations"/>
                                    <m_ParamName text="Civilizations001"/>
                                </Element>
                            </m_Values>
                            <m_ParamName text="Civilizations"/>
                        </Element>
                    </m_Values>
                </m_Fields>
                <m_ChildCollections/>
                <m_Name text="Khajiit"/>
                <m_AppendMergedParameterCollections>true</m_AppendMergedParameterCollections>
            </Element>
        </Element>
    </m_RootCollections>
</AssetObjects..ArtDefSet>

and would this be all I would need in Units.artdef:
Spoiler :
Code:
<AssetObjects..ArtDefSet>
    <m_Version>
        <major>4</major>
        <minor>0</minor>
        <build>315</build>
        <revision>805</revision>
    </m_Version>
    <m_TemplateName text="Units"/>
    <m_RootCollections>
        <Element>
            <m_CollectionName text="Units"/>
            <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
        </Element>   
        <Element>
            <m_CollectionName text="UnitMovementTypes"/>
            <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
        </Element>
        <Element>
            <m_CollectionName text="UnitFormationTypes"/>
            <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
        </Element>
        <Element>
            <m_CollectionName text="MemberCombat"/>
            <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
        </Element>
        <Element>
            <m_CollectionName text="UnitCombat"/>
            <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
        </Element>
        <Element>
            <m_CollectionName text="CombatAttack"/>
            <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
        </Element>
        <Element>
            <m_CollectionName text="UnitFormationLayoutTypes"/>
            <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
        </Element>
        <Element>
            <m_CollectionName text="CombatFormation"/>
            <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
        </Element>
        <Element>
            <m_CollectionName text="UnitDomainTypes"/>
            <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
        </Element>
        <Element>
            <m_CollectionName text="UnitAttachmentBins"/>
            <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
        </Element>
        <Element>
            <m_CollectionName text="UnitMemberTypes"/>
            <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
            <Element>
                <m_Fields>
                    <m_Values>
                        <Element class="AssetObjects::ArtDefReferenceValue">
                            <m_ElementName text="Cavalry"/>
                            <m_RootCollectionName text="UnitMovementTypes"/>
                            <m_ArtDefPath text="Units.artdef"/>
                            <m_CollectionIsLocked>true</m_CollectionIsLocked>
                            <m_TemplateName text="Units"/>
                            <m_ParamName text="Movement"/>
                        </Element>
                        <Element class="AssetObjects::ArtDefReferenceValue">
                            <m_ElementName text="NoCombat"/>
                            <m_RootCollectionName text="MemberCombat"/>
                            <m_ArtDefPath text="Units.artdef"/>
                            <m_CollectionIsLocked>true</m_CollectionIsLocked>
                            <m_TemplateName text="Units"/>
                            <m_ParamName text="Combat"/>
                        </Element>
                        <Element class="AssetObjects::ArtDefReferenceValue">
                            <m_ElementName text="MEAT"/>
                            <m_RootCollectionName text="MaterialTypes"/>
                            <m_ArtDefPath text="VFX.artdef"/>
                            <m_CollectionIsLocked>true</m_CollectionIsLocked>
                            <m_TemplateName text=""/>
                            <m_ParamName text="VFXMaterialType"/>
                        </Element>
                        <Element class="AssetObjects::ArtDefReferenceValue">
                            <m_ElementName text="MEAT"/>
                            <m_RootCollectionName text="MaterialTypes"/>
                            <m_ArtDefPath text="VFX.artdef"/>
                            <m_CollectionIsLocked>true</m_CollectionIsLocked>
                            <m_TemplateName text=""/>
                            <m_ParamName text="VFXWeaponImpact"/>
                        </Element>
                        <Element class="AssetObjects::FloatValue">
                            <m_fValue>0.000000</m_fValue>
                            <m_ParamName text="ImpactHeightOverride"/>
                        </Element>
                    </m_Values>
                </m_Fields>
                <m_ChildCollections>
                    <Element>
                        <m_CollectionName text="Cultures"/>
                        <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
                        <Element>
                            <m_Fields>
                                <m_Values/>
                            </m_Fields>
                            <m_ChildCollections>
                                <Element>
                                    <m_CollectionName text="Variations"/>
                                    <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
                                    <Element>
                                        <m_Fields>
                                            <m_Values>
                                                <Element class="AssetObjects::FloatValue">
                                                    <m_fValue>1.0000001</m_fValue>
                                                    <m_ParamName text="Scale"/>
                                                </Element>
                                                <Element class="AssetObjects::BoolValue">
                                                    <m_bValue>false</m_bValue>
                                                    <m_ParamName text="IsAttachment"/>
                                                </Element>
                                            </m_Values>
                                        </m_Fields>
                                        <m_ChildCollections>
                                            <Element>
                                                <m_CollectionName text="Attachments"/>
                                                <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
                                                <Element>
                                                    <m_Fields>
                                                        <m_Values>
                                                            <Element class="AssetObjects::StringValue">
                                                                <m_Value text="Root"/>
                                                                <m_ParamName text="Point"/>
                                                            </Element>
                                                            <Element class="AssetObjects::ArtDefReferenceValue">
                                                                <m_ElementName text=""/>
                                                                <m_RootCollectionName text="UnitTintTypes"/>
                                                                <m_ArtDefPath text=""/>
                                                                <m_CollectionIsLocked>true</m_CollectionIsLocked>
                                                                <m_TemplateName text=""/>
                                                                <m_ParamName text="Tint"/>
                                                            </Element>
                                                        </m_Values>
                                                    </m_Fields>
                                                    <m_ChildCollections>
                                                        <Element>
                                                            <m_CollectionName text="Bins"/>
                                                            <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
                                                            <Element>
                                                                <m_Fields>
                                                                    <m_Values/>
                                                                </m_Fields>
                                                                <m_ChildCollections/>
                                                                <m_Name text="Unit/WhiteTiger"/>
                                                                <m_AppendMergedParameterCollections>false</m_AppendMergedParameterCollections>
                                                            </Element>
                                                        </Element>
                                                    </m_ChildCollections>
                                                    <m_Name text="Body"/>
                                                    <m_AppendMergedParameterCollections>false</m_AppendMergedParameterCollections>
                                                </Element>
                                            </Element>
                                        </m_ChildCollections>
                                        <m_Name text="WhiteTiger"/>
                                        <m_AppendMergedParameterCollections>false</m_AppendMergedParameterCollections>
                                    </Element>
                                </Element>
                            </m_ChildCollections>
                            <m_Name text="Khajiit"/>
                            <m_AppendMergedParameterCollections>false</m_AppendMergedParameterCollections>
                        </Element>
                    </Element>
                </m_ChildCollections>
                <m_Name text="Trader"/>
                <m_AppendMergedParameterCollections>false</m_AppendMergedParameterCollections>
            </Element>
        </Element>
        </Element>
        <Element>
            <m_CollectionName text="UnitGlobals"/>
            <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
        </Element>
    </m_RootCollections>
</AssetObjects..ArtDefSet>

Then link it to mod.art like this:
Spoiler :
Code:
<AssetObjects..GameArtSpecification>
    <artConsumers>
        <Element>
            <consumerName text="Units"/>
            <relativeArtDefPaths>
                <Element text="Units.artdef"/>
                <Element text="Unit_Bins.artdef"/>
                <Element text="Cultures.artdef"/>
            </relativeArtDefPaths>
            <libraryDependencies>
                <Element text="Unit"/>
                <Element text="VFX"/>
                <Element text="Light"/>
            </libraryDependencies>
            <loadsLibraries>true</loadsLibraries>
        </Element>
        <Element>
            <consumerName text="Civilizations"/>
            <relativeArtDefPaths>
                <Element text="Civilizations.artdef"/>
                <Element text="Cultures.artdef"/>
            </relativeArtDefPaths>
            <libraryDependencies/>
            <loadsLibraries>false</loadsLibraries>
        </Element>
        <Element>
            <consumerName text="Cultures"/>
            <relativeArtDefPaths>
                <Element text="Cultures.artdef"/>
                <Element text="Civilizations.artdef"/>
            </relativeArtDefPaths>
            <libraryDependencies/>
            <loadsLibraries>false</loadsLibraries>
        </Element>
        <Element>
            <consumerName text="WorldView_Translate"/>
            <relativeArtDefPaths>
                <Element text="Civilizations.artdef"/>
                <Element text="Buildings.artdef"/>
                <Element text="Districts.artdef"/>
                <Element text="Cultures.artdef"/>
                <Element text="Landmarks.artdef"/>
            </relativeArtDefPaths>
            <libraryDependencies/>
            <loadsLibraries>false</loadsLibraries>
        </Element>
        <Element>
            <consumerName text="StrategicView_Translate"/>
            <relativeArtDefPaths>
                <Element text="Districts.artdef"/>
                <Element text="Landmarks.artdef"/>
                <Element text="Cultures.artdef"/>
            </relativeArtDefPaths>
            <libraryDependencies/>
            <loadsLibraries>false</loadsLibraries>
        </Element>
        <Element>
            <consumerName text="Audio"/>
            <relativeArtDefPaths>
                <Element text="Civilizations.artdef"/>
                <Element text="Units.artdef"/>
                <Element text="Buildings.artdef"/>
                <Element text="Districts.artdef"/>
                <Element text="Cultures.artdef"/>
            </relativeArtDefPaths>
            <libraryDependencies/>
            <loadsLibraries>false</loadsLibraries>
        </Element>
    </artConsumers>
</AssetObjects..GameArtSpecification>
 
@kingchris20: That looks correct. Just be aware that any UnitMember that doesn't have a Khajiit variant will default to the "Any" UnitCulture.

Ideally there would be something more hierarchical so you could do if "English UnitCulture exists use it, else use NorthernEuropean, else use Any", but this isn't how it works. This means you need to do a lot of cloning UnitMember Culture entries if you want to set up an entire new UnitCulture.
 
@kingchris20: That looks correct. Just be aware that any UnitMember that doesn't have a Khajiit variant will default to the "Any" UnitCulture.

Ideally there would be something more hierarchical so you could do if "English UnitCulture exists use it, else use NorthernEuropean, else use Any", but this isn't how it works. This means you need to do a lot of cloning UnitMember Culture entries if you want to set up an entire new UnitCulture.
Yeah, right now I just want the Trader to have a unique Cultural variance for this civ. However, I've not yet been successful.

If I add an entry under Units, with the Unit_trader tag, I get the white tigers in game and they run along side the actual camel and cart trader, which is fine, but every civ also has this same unit model (even with the Khajiit culture tag)........The result is not unexpected though as I've basically just added another member to the existing trader members.

It just baffles me that the entries I posted in the other post didn't work so that only the Khajiit has white tigers for a trade caravan. I mean it is the exact same way firaxis did with the unique barbarian scout..........the only difference is the white tiger is a completely different model than the camel and cart trader.......whereas the barbarian scout is the same base model with different attachments.
 
Thank you for this guide, i am able to move on after stuck at adding new unit but did not appear correctly in game.
 
I am almost done with copying unique units from other civilization to my own, I only add entries in existing xml files and units.artdef . I manage to get the units & icons to appear correctly, but not the portraits. I have tried many times but seems unable to get the portraits to display correctly. Is there a limitation to use the same portrait more than once?

For example, I am using Korea from expansion1, and wish to copy Brazalian Minas Geraes. I put a _ADD to differentiate them.

Icons_Units.xml
Code:
    <Row Name="ICON_UNIT_BRAZILIAN_MINAS_GERAES"   Atlas="ICON_ATLAS_UNITS" Index="74"/>
    <Row Name="ICON_UNIT_BRAZILIAN_MINAS_GERAES_ADD"   Atlas="ICON_ATLAS_UNITS" Index="74"/>

Icons_UnitPortraits.xml
Code:
    <Row Name="ICON_UNIT_BRAZILIAN_MINAS_GERAES_PORTRAIT"       Atlas="ICON_ATLAS_UNIT_PORTRAITS_2" Index="8"/>
    <Row Name="ICON_UNIT_BRAZILIAN_MINAS_GERAES_ADD_PORTRAIT"    Atlas="ICON_ATLAS_UNIT_PORTRAITS_2" Index="8"/>

The Icon part works, but portrait doesn't.
The exactly same way i did for Nubia Pitati & Indonesia Domrey worked.

What could be the solution? Thanks.

**** [UPDATE] ****
Finally got it, for base unit, the icon and portrait files to be edited is at Expansion1 folder and not base game folder. The units are copied, including the name, I still can't figure out where to rename it. Anyhow the game is playable.
 
Last edited:
OK so after the last update <m_ReplaceMergedCollectionElements>true</m_ReplaceMergedCollectionElements> does not seem to work anymore.

Does anyone know if Firaxis have added a new way to replace existing unit members?
 
OK so after the last update <m_ReplaceMergedCollectionElements>true</m_ReplaceMergedCollectionElements> does not seem to work anymore.

Does anyone know if Firaxis have added a new way to replace existing unit members?

I didn't realise that was broken. Are you sure it's not a Load Order issue? I think even Update Art might need Load Order specified now.
 
I didn't realise that was broken. Are you sure it's not a Load Order issue? I think even Update Art might need Load Order specified now.
Thanks Deliverator. I have done some more testing and it seems to be broken for some civs but not all. So sorry it still works but not for all civs. Germany and China are the main civs that it does not work for and I can't seem to track down why.

I will try and bump up load order to 1000 and see if that helps. Currently it is at 400.
 
OK so I have tried using the new civilization method instead of the old m_ReplaceMergedCollectionElements and the new method works, really well. Down side is because cultural way only works when it feels like it, it going to be a lot more work to do each individual civ.:(
 
OK so I have tried using the new civilization method instead of the old m_ReplaceMergedCollectionElements and the new method works, really well. Down side is because cultural way only works when it feels like it, it going to be a lot more work to do each individual civ.:(

You're aware that all the Unit Cultures have changed with Gathering Storm?

Code:
EastAsian > Asian
Mediterranean
Mughal > Indian
NorthAfrican > MiddleEastern
NorthernEuropean > European
SouthAfrican > African
SouthAmerican
Barbarian

NEW:
Maori
NativeAmerican
SouthEastAsian

These obviously something going on rather than it only working when it feels like it. If you can figure out the issue then you can save some effort.
 
Deliverator you are a genius. Once more you have saved the day. I was still using the old tags. Thank you. I wish Firaxis would release this information so we don't waste our time.

No worries. Find and replace is your friend!
 
Thanks I will give that a try. I do use programmers notepad for some stuff but I find the artdef files too large and need the ability to collapse blocks or I just get lost in a sea of code.
 
Top Bottom