1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

[GS] Need some help with duplicating a unit (artdef error?)

Discussion in 'Mod Creation Help' started by Seven05, Mar 24, 2019.

  1. Seven05

    Seven05 Warmonger

    Joined:
    Dec 5, 2005
    Messages:
    2,056
    Gender:
    Male
    Location:
    USA
    I have a mod where I'm trying to slow down early expansion and then make it easier later in the game. So far the method that seems to work the best is to have two settler units, an early one that's more expensive and then another one (I unlocked it with the exploration civic) that is less expensive, and also "resets" the cost increase per copy. I have the mechanics working fine- unit cost and cost progression works as intended, it's an upgrade so it replaces the old settler and so on. However, it's getting a random unit icon and the unit itself always shows up as a warrior.

    Since I've never messed with units or artdefs in Civ6 before I'm going to guess that I'm missing something. I did learn that apparently I can't just point a new unit at an existing unit's icon and artdef, that would have been way too easy (or maybe I can and I just missed something).

    Here is what I have so far:

    Modinfo
    Spoiler :

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <Mod id="f1192e45-6a2d-4ae8-815d-b9de171a9bop">
        <Properties>
            <Name>Balance of Power</Name>
            <Stability>Beta</Stability>
            <Teaser>Game pace and rule update</Teaser>
            <Description>Increased tech costs, re-balanced resource requirements, consumption and polution and more.</Description>
            <Authors>Evil Victor (Seven05)</Authors>
            <SpecialThanks>CivFanatics.com</SpecialThanks>
            <AffectsSavedGames>1</AffectsSavedGames>
            <CompatibleVersions>2.0</CompatibleVersions>
        </Properties>
    
        <ActionCriteria>
            <Criteria id="Expansion2">
                <GameCoreInUse>Expansion2</GameCoreInUse>
            </Criteria>
        </ActionCriteria>
    
        <Files>
            <File>BoP.dep</File>
            <File>Rules.sql</File>
            <File>Units_Update.xml</File>
            <File>Units_Add.xml</File>
        </Files>
    
        <Settings>
            <Custom id="BoP">
                <Items>
                    <Component>BoPComponent</Component>
                </Items>
            </Custom>
        </Settings>
    
        <InGameActions>
            <UpdateDatabase id="BoPComponent">
            <Properties>
                <LoadOrder>300</LoadOrder>
                <Name>Balance of Power</Name>
            </Properties>
                <Items>
                    <File>Rules.sql</File>
                    <File>Units_Update.xml</File>
                    <File>Units_Add.xml</File>
                </Items>
            </UpdateDatabase>
            <ModArt id="BoPArt">
                <Items>
                    <File>BoP.dep</File>
                </Items>
            </ModArt>
        </InGameActions>
    </Mod>
    


    dep file (BoP.dep):
    Spoiler :

    Code:
    <?xml version="1.0" encoding="UTF-8" ?>
    <AssetObjects::GameDependencyData>
        <ID>
            <name text="BalanceOfPower"/>
            <id text="f1192e45-6a2d-4ae8-815d-b9de171a9bop"/>
        </ID>
        <RequiredGameArtIDs/>
        <SystemDependencies>
            <Element>
                    <ConsumerName text="Units"/>
                    <ArtDefDependencyPaths>
                           <Element text="Units.artdef"/>
                    </ArtDefDependencyPaths>
            </Element>
        </SystemDependencies>
    </AssetObjects::GameDependencyData>
    


    Units.artdef (in mod's ArtDefs subfolder):
    Spoiler :

    Code:
    <?xml version="1.0" encoding="UTF-8" ?>
    <AssetObjects::ArtDefSet>
        <m_Version>
            <major>4</major>
            <minor>0</minor>
            <build>238</build>
            <revision>243</revision>
        </m_Version>
        <m_TemplateName text="Units"/>
        <m_RootCollections>
                <Element>
                    <m_Fields>
                        <m_Values>
                            <Element class="AssetObjects..ArtDefReferenceValue">
                                <m_ElementName text="Settler"/>
                                <m_RootCollectionName text="UnitFormationTypes"/>
                                <m_ArtDefPath text="Units.artdef"/>
                                <m_CollectionIsLocked>true</m_CollectionIsLocked>
                                <m_TemplateName text="Units"/>
                                <m_ParamName text="Formation"/>
                            </Element>
                            <Element class="AssetObjects..ArtDefReferenceValue">
                                <m_ElementName text=""/>
                                <m_RootCollectionName text="UnitCombat"/>
                                <m_ArtDefPath text="Units.artdef"/>
                                <m_CollectionIsLocked>false</m_CollectionIsLocked>
                                <m_TemplateName text=""/>
                                <m_ParamName text="UnitCombat"/>
                            </Element>
                            <Element class="AssetObjects..ArtDefReferenceValue">
                                <m_ElementName text="SettlerEscort"/>
                                <m_RootCollectionName text="UnitFormationTypes"/>
                                <m_ArtDefPath text="Units.artdef"/>
                                <m_CollectionIsLocked>true</m_CollectionIsLocked>
                                <m_TemplateName text="Units"/>
                                <m_ParamName text="EscortFormation"/>
                            </Element>
                            <Element class="AssetObjects..ArtDefReferenceValue">
                                <m_ElementName text="UNIT_ANCIENTEMBARK_SETTLER"/>
                                <m_RootCollectionName text="Units"/>
                                <m_ArtDefPath text="Units.artdef"/>
                                <m_CollectionIsLocked>true</m_CollectionIsLocked>
                                <m_TemplateName text="Units"/>
                                <m_ParamName text="EmbarkedUnit"/>
                            </Element>
                            <Element class="AssetObjects..BoolValue">
                                <m_bValue>false</m_bValue>
                                <m_ParamName text="DoNotDisplayCharges"/>
                            </Element>
                            <Element class="AssetObjects..ArtDefReferenceValue">
                                <m_ElementName text=""/>
                                <m_RootCollectionName text="UnitCulture"/>
                                <m_ArtDefPath text="Cultures.artdef"/>
                                <m_CollectionIsLocked>true</m_CollectionIsLocked>
                                <m_TemplateName text=""/>
                                <m_ParamName text="Culture"/>
                            </Element>
                            <Element class="AssetObjects..ArtDefReferenceValue">
                                <m_ElementName text=""/>
                                <m_RootCollectionName text="Era"/>
                                <m_ArtDefPath text="Eras.artdef"/>
                                <m_CollectionIsLocked>true</m_CollectionIsLocked>
                                <m_TemplateName text=""/>
                                <m_ParamName text="Era"/>
                            </Element>
                            <Element class="AssetObjects..ArtDefReferenceValue">
                                <m_ElementName text=""/>
                                <m_RootCollectionName text="Units"/>
                                <m_ArtDefPath text="Units.artdef"/>
                                <m_CollectionIsLocked>true</m_CollectionIsLocked>
                                <m_TemplateName text=""/>
                                <m_ParamName text="ProxyUnit"/>
                            </Element>
                            <Element class="AssetObjects..BoolValue">
                                <m_bValue>false</m_bValue>
                                <m_ParamName text="PlayDeathOnDestroy"/>
                            </Element>
                            <Element class="AssetObjects..IntValue">
                                <m_nValue>-500</m_nValue>
                                <m_ParamName text="DisplayLevel"/>
                            </Element>
                        </m_Values>
                    </m_Fields>
                    <m_ChildCollections>
                        <Element>
                            <m_CollectionName text="Members"/>
                            <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
                            <Element>
                                <m_Fields>
                                    <m_Values>
                                        <Element class="AssetObjects..FloatValue">
                                            <m_fValue>1.000000</m_fValue>
                                            <m_ParamName text="Scale"/>
                                        </Element>
                                        <Element class="AssetObjects..IntValue">
                                            <m_nValue>1</m_nValue>
                                            <m_ParamName text="Count"/>
                                        </Element>
                                        <Element class="AssetObjects..ArtDefReferenceValue">
                                            <m_ElementName text="Settler"/>
                                            <m_RootCollectionName text="UnitMemberTypes"/>
                                            <m_ArtDefPath text="Units.artdef"/>
                                            <m_CollectionIsLocked>false</m_CollectionIsLocked>
                                            <m_TemplateName text=""/>
                                            <m_ParamName text="Type"/>
                                        </Element>
                                    </m_Values>
                                </m_Fields>
                                <m_ChildCollections/>
                                <m_Name text="Settler_Leader"/>
                                <m_AppendMergedParameterCollections>false</m_AppendMergedParameterCollections>
                            </Element>
                            <Element>
                                <m_Fields>
                                    <m_Values>
                                        <Element class="AssetObjects..FloatValue">
                                            <m_fValue>1.000000</m_fValue>
                                            <m_ParamName text="Scale"/>
                                        </Element>
                                        <Element class="AssetObjects..IntValue">
                                            <m_nValue>1</m_nValue>
                                            <m_ParamName text="Count"/>
                                        </Element>
                                        <Element class="AssetObjects..ArtDefReferenceValue">
                                            <m_ElementName text="Donkey"/>
                                            <m_RootCollectionName text="UnitMemberTypes"/>
                                            <m_ArtDefPath text="Units.artdef"/>
                                            <m_CollectionIsLocked>false</m_CollectionIsLocked>
                                            <m_TemplateName text=""/>
                                            <m_ParamName text="Type"/>
                                        </Element>
                                    </m_Values>
                                </m_Fields>
                                <m_ChildCollections/>
                                <m_Name text="Donkey"/>
                                <m_AppendMergedParameterCollections>false</m_AppendMergedParameterCollections>
                            </Element>
                            <Element>
                                <m_Fields>
                                    <m_Values>
                                        <Element class="AssetObjects..FloatValue">
                                            <m_fValue>1.000000</m_fValue>
                                            <m_ParamName text="Scale"/>
                                        </Element>
                                        <Element class="AssetObjects..IntValue">
                                            <m_nValue>2</m_nValue>
                                            <m_ParamName text="Count"/>
                                        </Element>
                                        <Element class="AssetObjects..ArtDefReferenceValue">
                                            <m_ElementName text="SettlerBuilder"/>
                                            <m_RootCollectionName text="UnitMemberTypes"/>
                                            <m_ArtDefPath text="Units.artdef"/>
                                            <m_CollectionIsLocked>true</m_CollectionIsLocked>
                                            <m_TemplateName text="Units"/>
                                            <m_ParamName text="Type"/>
                                        </Element>
                                    </m_Values>
                                </m_Fields>
                                <m_ChildCollections/>
                                <m_Name text="Settlers"/>
                                <m_AppendMergedParameterCollections>false</m_AppendMergedParameterCollections>
                            </Element>
                        </Element>
                        <Element>
                            <m_CollectionName text="Audio"/>
                            <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
                            <Element>
                                <m_Fields>
                                    <m_Values>
                                        <Element class="AssetObjects..StringValue">
                                            <m_Value text=""/>
                                            <m_ParamName text="XrefName"/>
                                        </Element>
                                    </m_Values>
                                </m_Fields>
                                <m_ChildCollections/>
                                <m_Name text=""/>
                                <m_AppendMergedParameterCollections>false</m_AppendMergedParameterCollections>
                            </Element>
                            <Element>
                                <m_Fields>
                                    <m_Values>
                                        <Element class="AssetObjects..StringValue">
                                            <m_Value text="Settler"/>
                                            <m_ParamName text="XrefName"/>
                                        </Element>
                                    </m_Values>
                                </m_Fields>
                                <m_ChildCollections/>
                                <m_Name text="SETTLER"/>
                                <m_AppendMergedParameterCollections>false</m_AppendMergedParameterCollections>
                            </Element>
                        </Element>
                        <Element>
                            <m_CollectionName text="AttachmentVisibility"/>
                            <m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
                        </Element>
                    </m_ChildCollections>
                    <m_Name text="UNIT_SETTLER2"/>
                    <m_AppendMergedParameterCollections>false</m_AppendMergedParameterCollections>
                </Element>
        </m_RootCollections>
    </AssetObjects::ArtDefSet>
    


    And the xml to add the unit:
    Spoiler :

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <GameInfo>
        <Types>
            <Row Type="UNIT_SETTLER2" Kind="KIND_UNIT"/>
        </Types>
        <UnitAiInfos>
            <Row UnitType="UNIT_SETTLER2" AiType="UNITAI_SETTLE"/>
            <Row UnitType="UNIT_SETTLER2" AiType="UNITTYPE_CIVILIAN"/>
        </UnitAiInfos>
        <UnitCaptures>
            <Row CapturedUnitType="UNIT_SETTLER2" BecomesUnitType="UNIT_SETTLER2"/>
        </UnitCaptures>
        <TypeTags>
            <Row Type="UNIT_SETTLER2" Tag="CLASS_LANDCIVILIAN"/>
        </TypeTags>
        <Units>
            <Row UnitType="UNIT_SETTLER2" Cost="240" BaseMoves="2" BaseSightRange="3" ZoneOfControl="false" Domain="DOMAIN_LAND" FormationClass="FORMATION_CLASS_CIVILIAN" FoundCity="true" PopulationCost="1" PrereqPopulation="2" AdvisorType="ADVISOR_GENERIC" Name="LOC_UNIT_SETTLER_NAME" Description="LOC_UNIT_SETTLER_DESCRIPTION" CanCapture="False" CostProgressionModel="COST_PROGRESSION_PREVIOUS_COPIES" CostProgressionParam1="40" PurchaseYield="YIELD_GOLD" PseudoYieldType="PSEUDOYIELD_UNIT_SETTLER" PrereqCivic="CIVIC_EXPLORATION"/>
        </Units>
        <UnitUpgrades>
            <Row Unit="UNIT_SETTLER" UpgradeUnit="UNIT_SETTLER2"/>
        </UnitUpgrades>
        <IconDefinitions>
            <Row Name="ICON_UNIT_SETTLER2" Atlas="ICON_ATLAS_UNITS" Index="0"/>
            <Row Name="ICON_UNIT_SETTLER2_FOW" Atlas="ICON_ATLAS_UNITS_FOW" Index="0"/>
        </IconDefinitions>
    </GameInfo>
    


    Everything is just a copy of the UNIT_SETTLER entries I could find with a "2" added since I really don't need any custom assets or even to change the look from the default settler.

    Thanks :)
     
  2. Seven05

    Seven05 Warmonger

    Joined:
    Dec 5, 2005
    Messages:
    2,056
    Gender:
    Male
    Location:
    USA
    I found the error in the artdef file that was causing the incorrect unit model to show in-game, typical xml oversight (missing one <element> level just before m_fields)

    Still can't get the icon sorted out, probably another xml error so I'll go through it again.
     

Share This Page