CIV6 - How to give a newly created unit the appearence of an existing unit?

Discussion in 'Mod Creation Help' started by Tomice, Jun 28, 2017.

  1. Tomice

    Tomice Passionate Smart-Ass

    Joined:
    Oct 5, 2009
    Messages:
    2,349
    Location:
    Austria, EU, no kangaroos ;)
    I'm trying to create a new unit (a mounted archer) using the starter project "new unit" in modbuddy.

    The gameplay part seems logical, but the artdef file is HUGE and hard to understand.
    I just want the new unit to look like the scythian horse archer and have the same symbol.
    The "peon" tutorial artdef file only contains the word peon once, somewhere in the middle. How do I tell the game that the new unit should use existing art?

    Where is the connection between gameplay and art data?
    There doesn't seem to be a 3d model reference in the XML that defines unit price, strenghts, movement points,... - just the reference towards the unit icons.
     
    Last edited: Jun 28, 2017
  2. Gedemon

    Gedemon Modder Super Moderator

    Joined:
    Oct 4, 2004
    Messages:
    10,339
    Location:
    France
    You can't.

    That's a design solution I don't understand, but you need an artdefine of the same name of your new unit, even if it's a complete copy (except the name) of another artdefine because the link is hardcoded: the art data and the gameplay data are linked by the common name of the entry.

    If only they had kept SQL for art definition, then it would have been trivial to add new units...
     
  3. Tomice

    Tomice Passionate Smart-Ass

    Joined:
    Oct 5, 2009
    Messages:
    2,349
    Location:
    Austria, EU, no kangaroos ;)
    Thank you for the reply.
    So basically, if I just copied this part and changed "UNIT_SCYTHIAN_HORSE_ARCHER" (see the very end of the code segment) to be the name of my new unit (UNIT_TOMICE_KESHIK or whatever), it would work?

    Code:
                <Element>
                    <m_Fields>
                        <m_Values>
                            <Element class="AssetObjects::ArtDefReferenceValue">
                                <m_ElementName text="Swordsman"/>
                                <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="HorseArcher"/>
                                <m_RootCollectionName text="UnitCombat"/>
                                <m_ArtDefPath text="Units.artdef"/>
                                <m_CollectionIsLocked>true</m_CollectionIsLocked>
                                <m_TemplateName text="Units"/>
                                <m_ParamName text="UnitCombat"/>
                            </Element>
                            <Element class="AssetObjects::ArtDefReferenceValue">
                                <m_ElementName text=""/>
                                <m_RootCollectionName text="UnitFormationTypes"/>
                                <m_ArtDefPath text="Units.artdef"/>
                                <m_CollectionIsLocked>true</m_CollectionIsLocked>
                                <m_TemplateName text=""/>
                                <m_ParamName text="EscortFormation"/>
                            </Element>
                            <Element class="AssetObjects::ArtDefReferenceValue">
                                <m_ElementName text="UNIT_ANCIENTEMBARK"/>
                                <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>0</m_nValue>
                                <m_ParamName text="DisplayLevel"/>
                            </Element>
                        </m_Values>
                    </m_Fields>
                    <m_ChildCollections>
                        <Element>
                            <m_CollectionName text="Members"/>
                            <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="SakaHorseArcher"/>
                                            <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="Members001"/>
                            </Element>
                        </Element>
                        <Element>
                            <m_CollectionName text="Audio"/>
                            <Element>
                                <m_Fields>
                                    <m_Values>
                                        <Element class="AssetObjects::StringValue">
                                            <m_Value text="SakaHorseArcher"/>
                                            <m_ParamName text="XrefName"/>
                                        </Element>
                                    </m_Values>
                                </m_Fields>
                                <m_ChildCollections/>
                                <m_Name text="SAKAHORSEARCHER"/>
                            </Element>
                        </Element>
                    </m_ChildCollections>
                    <m_Name text="UNIT_SCYTHIAN_HORSE_ARCHER"/>
                </Element>
     
    Last edited: Jun 28, 2017
  4. KoubaK

    KoubaK Warlord

    Joined:
    May 8, 2017
    Messages:
    106
    Gender:
    Male
    Location:
    DMV
    In theory, it should.. replace UNIT_SCYTHIAN_HORSE_ARCHER with your UU name and make sure your Mod.Art.xml file is configured to load the Units.artdef
     
  5. JamesRoper1403

    JamesRoper1403 Chieftain

    Joined:
    Mar 7, 2016
    Messages:
    33
    I am trying to add new units to my mod using existing unit models, but they are showing up as warriors. I tried following the advice here, but I haven't had any success yet. Did you manage to get the issue resolved?

    Here's my mod so far:
     

    Attached Files:

  6. JohnCJR

    JohnCJR Chieftain

    Joined:
    Oct 23, 2016
    Messages:
    35
    Gender:
    Male
    Does anyone know how I can make my unit look like the battleship? With help from LeeS the unit is showing up in game but it shows up as a warrior unit.
     
  7. KoubaK

    KoubaK Warlord

    Joined:
    May 8, 2017
    Messages:
    106
    Gender:
    Male
    Location:
    DMV
    Copy the relevant code pertaining to the battleship unit from Units.artdef and use that on your artdef file.
    I find it easier to open both Units.artdef files on Asset Editor and copy from the vanilla one to yours.

    //Edit: looks like I had the code readily available lol
    Code:
                <Element>
                    <m_Fields>
                        <m_Values>
                            <Element class="AssetObjects:ArtDefReferenceValue">
                                <m_ElementName text="Naval"/>
                                <m_RootCollectionName text="UnitFormationTypes"/>
                                <m_ArtDefPath text="Units.artdef"/>
                                <m_CollectionIsLocked>true</m_CollectionIsLocked>
                                <m_TemplateName text=""/>
                                <m_ParamName text="Formation"/>
                            </Element>
                            <Element class="AssetObjects:ArtDefReferenceValue">
                                <m_ElementName text=""/>
                                <m_RootCollectionName text="UnitCombat"/>
                                <m_ArtDefPath text="Units.artdef"/>
                                <m_CollectionIsLocked>true</m_CollectionIsLocked>
                                <m_TemplateName text=""/>
                                <m_ParamName text="UnitCombat"/>
                            </Element>
                            <Element class="AssetObjects:ArtDefReferenceValue">
                                <m_ElementName text=""/>
                                <m_RootCollectionName text="UnitFormationTypes"/>
                                <m_ArtDefPath text="Units.artdef"/>
                                <m_CollectionIsLocked>true</m_CollectionIsLocked>
                                <m_TemplateName text=""/>
                                <m_ParamName text="EscortFormation"/>
                            </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="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="Battleship"/>
                                            <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="Members001"/>
                                <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="Battleship"/>
                                            <m_ParamName text="XrefName"/>
                                        </Element>
                                    </m_Values>
                                </m_Fields>
                                <m_ChildCollections/>
                                <m_Name text="BATTLESHIP"/>
                                <m_AppendMergedParameterCollections>false</m_AppendMergedParameterCollections>
                            </Element>
                        </Element>
                    </m_ChildCollections>
                    <m_Name text="UNIT_BATTLESHIP"/>
                    <m_AppendMergedParameterCollections>false</m_AppendMergedParameterCollections>
                </Element>
    Change UNIT_BATTLESHIP, to whatever your unit name is.
     
  8. JohnCJR

    JohnCJR Chieftain

    Joined:
    Oct 23, 2016
    Messages:
    35
    Gender:
    Male

    Thanks for the help. That did not seem to fix it however. For some reason it is just using the warrior.

    https://www.dropbox.com/s/l660m0koscltry0/Dreadnought.rar?dl=0

    Above is my mod. Here is the contents of my artdef:

    <?xml version="1.0" encoding="UTF-8" ?>
    <AssetObjects::ArtDefSet>
    <m_Version>
    <major>4</major>
    <minor>0</minor>
    <build>253</build>
    <revision>293</revision>
    </m_Version>
    <m_TemplateName text="Units"/>
    <m_RootCollections>
    <Element>
    <m_Fields>
    <m_Values>
    <Element class="AssetObjects:ArtDefReferenceValue">
    <m_ElementName text="Naval"/>
    <m_RootCollectionName text="UnitFormationTypes"/>
    <m_ArtDefPath text="Units.artdef"/>
    <m_CollectionIsLocked>true</m_CollectionIsLocked>
    <m_TemplateName text=""/>
    <m_ParamName text="Formation"/>
    </Element>
    <Element class="AssetObjects:ArtDefReferenceValue">
    <m_ElementName text=""/>
    <m_RootCollectionName text="UnitCombat"/>
    <m_ArtDefPath text="Units.artdef"/>
    <m_CollectionIsLocked>true</m_CollectionIsLocked>
    <m_TemplateName text=""/>
    <m_ParamName text="UnitCombat"/>
    </Element>
    <Element class="AssetObjects:ArtDefReferenceValue">
    <m_ElementName text=""/>
    <m_RootCollectionName text="UnitFormationTypes"/>
    <m_ArtDefPath text="Units.artdef"/>
    <m_CollectionIsLocked>true</m_CollectionIsLocked>
    <m_TemplateName text=""/>
    <m_ParamName text="EscortFormation"/>
    </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="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="Battleship"/>
    <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="Members001"/>
    <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="Battleship"/>
    <m_ParamName text="XrefName"/>
    </Element>
    </m_Values>
    </m_Fields>
    <m_ChildCollections/>
    <m_Name text="BATTLESHIP"/>
    <m_AppendMergedParameterCollections>false</m_AppendMergedParameterCollections>
    </Element>
    </Element>
    </m_ChildCollections>
    <m_Name text="UNIT_ENGLISH_DREADNOUGHT"/>
    <m_AppendMergedParameterCollections>false</m_AppendMergedParameterCollections>
    </Element>
    </m_RootCollections>
    </AssetObjects::ArtDefSet>

    My mod also has a Mod.Art.xml file which was part of the modbuddy template, not sure if that is needed or necessary?
     
  9. KoubaK

    KoubaK Warlord

    Joined:
    May 8, 2017
    Messages:
    106
    Gender:
    Male
    Location:
    DMV
    Could you post the actual ModBuddy files? Makes it easier for me to look at the files and change stuff around and build the mod again
     
  10. JohnCJR

    JohnCJR Chieftain

    Joined:
    Oct 23, 2016
    Messages:
    35
    Gender:
    Male
  11. KoubaK

    KoubaK Warlord

    Joined:
    May 8, 2017
    Messages:
    106
    Gender:
    Male
    Location:
    DMV
  12. JohnCJR

    JohnCJR Chieftain

    Joined:
    Oct 23, 2016
    Messages:
    35
    Gender:
    Male
  13. KoubaK

    KoubaK Warlord

    Joined:
    May 8, 2017
    Messages:
    106
    Gender:
    Male
    Location:
    DMV
    No problems man. So here are the updated files. It works (see screenshot).
    Besides your Units.artdef, you also had Mod.Art.xml under Properties, you should have (Mod Art Dependency File) see screenshot.
     

    Attached Files:

    Riker13 and JohnCJR like this.
  14. JohnCJR

    JohnCJR Chieftain

    Joined:
    Oct 23, 2016
    Messages:
    35
    Gender:
    Male
    Thank you so much. You are awesome. This would not have been possible without you and LeeS, who helped me with the GameData file.
     

Share This Page