Modbuddy new unit help

Discussion in 'Mod Creation Help' started by JohnCJR, Jul 21, 2017.

  1. JohnCJR

    JohnCJR Chieftain

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

    I am presently trying to add a new unit to the game using the modbuddy new unit template and looking at the files of others who have managed to figure this out. I am unable to get my unit to work. I load the game, it recognizes my mod on the additional content screen, I then try and start a game and it says loading. The word "start" then appears in the center of a black screen, then it goes back to the main game menu. If anyone has the time to take a look and see what I am doing wrong, I would greatly appreciate it.

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

    https://www.dropbox.com/s/latn5ez5ewcmd0x/Dreadnought.rar?dl=0
     
  2. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    7,241
    Location:
    Illinois, USA
    1. Database.log
      • On windows machines this can be found at folder ~\Documents\My Games\Sid Meier's Civilization VI\Logs
    2. Errors in the database log file coming from your mod:
      1. Unique Constraint Error:
        Code:
        [1710427.791] [Gameplay] ERROR: UNIQUE constraint failed: Vocabularies.Vocabulary
        [1710427.791] [Gameplay]: While executing - 'insert into Vocabularies('Vocabulary') values (?);'
        [1710427.791] [Gameplay]: In XMLSerializer while inserting row into table insert into Vocabularies('Vocabulary') with  values (ABILITY_CLASS, ).
        [1710427.791] [Gameplay]: In XMLSerializer while updating table Vocabularies from file NewUnit_Gameplay.xml.
        • You are attempting to repeat information the game already has. There is already a thing called "ABILITY_CLASS" in game-table Vocabularies
        • This error causes the game to cease reading and adding-in anything further from file NewUnit_Gameplay.xml
        • Because the game ceases to read anything further, you get additional errors later because "UNIT_ENGLISH_DREADNOUGHT" is never read into the game's code: "UNIT_ENGLISH_DREADNOUGHT"s definition in table Units occurs after the fatal error in the same file in table Vocabularies.
        • Once you fix this error this allows the game to read further into the file and this may expose additional errors in the Database.log that were not reported earlier because the game did not see them previously.
        • You don't need this because the game already has them defined
          Code:
          	<Vocabularies>
          		<Row Vocabulary="ABILITY_CLASS"/>
          	</Vocabularies>
          	<Tags>
          		<Row Tag="CLASS_NAVAL_RANGED" Vocabulary="ABILITY_CLASS"/>
          		<Row Tag="CLASS_ANTI_AIR" Vocabulary="ABILITY_CLASS"/>
          	</Tags>
          Anything you need for your mod that the game has already defined you can just use without pre-defining it, so all you need in this part of your file
          Code:
          	<Vocabularies>
          		<Row Vocabulary="ABILITY_CLASS"/>
          	</Vocabularies>
          	<Tags>
          		<Row Tag="CLASS_NAVAL_RANGED" Vocabulary="ABILITY_CLASS"/>
          		<Row Tag="CLASS_ANTI_AIR" Vocabulary="ABILITY_CLASS"/>
          	</Tags>
          	<TypeTags>
          	<Row Type="UNIT_ENGLISH_DREADNOUGHT" Tag="CLASS_NAVAL_RANGED"/>
          	<Row Type="UNIT_ENGLISH_DREADNOUGHT" Tag="CLASS_ANTI_AIR"/>
          	</TypeTags>
          is this:
          Code:
          	<TypeTags>
          	<Row Type="UNIT_ENGLISH_DREADNOUGHT" Tag="CLASS_NAVAL_RANGED"/>
          	<Row Type="UNIT_ENGLISH_DREADNOUGHT" Tag="CLASS_ANTI_AIR"/>
          	</TypeTags>
      2. These are the errors in the log caused by the fatal error in file NewUnit_Gameplay.xml
        Code:
        [1710427.812] [Gameplay] ERROR: Invalid Reference on UnitAiInfos.UnitType - "UNIT_ENGLISH_DREADNOUGHT" does not exist in Units
        [1710427.812] [Gameplay] ERROR: Invalid Reference on UnitAiInfos.UnitType - "UNIT_ENGLISH_DREADNOUGHT" does not exist in Units
        [1710427.812] [Gameplay] ERROR: Invalid Reference on UnitAiInfos.UnitType - "UNIT_ENGLISH_DREADNOUGHT" does not exist in Units
        [1710427.812] [Gameplay] ERROR: Invalid Reference on UnitReplaces.CivUniqueUnitType - "UNIT_ENGLISH_DREADNOUGHT" does not exist in Units
        These types of errors always cause the game to escape back to the main menu after displaying "Start Game" for a couple of seconds
      3. This error is caused because there is no definition of this trait anywhere, even accounting for the fatal error in file NewUnit_Gameplay.xml
        Code:
        [1710427.796] [Gameplay] ERROR: Invalid Reference on CivilizationTraits.TraitType - "TRAIT_CIVILIZATION_UNIT_ENGLISH_DREADNOUGHT" does not exist in Traits
        Since it is the same "type" of error (Invalid Reference) it in and of itself will always cause return to the main menu.
      4. Another Unique Constraint Error:
        Code:
        [1710428.780] [Database] ERROR: UNIQUE constraint failed: AtlasIcons.Name, AtlasIcons.Atlas
        [1710428.780] [Database]: While executing - 'insert into IconDefinitions('Name', 'Atlas', 'Index') values (?, ?, ?);'
        [1710428.780] [Database]: In XMLSerializer while inserting row into table insert into IconDefinitions('Name', 'Atlas', 'Index') with  values (ICON_UNIT_BATTLESHIP, ICON_ATLAS_UNITS, 73, ).
        [1710428.780] [Database]: In XMLSerializer while updating table IconDefinitions from file C:/Users/UserName/Documents/My Games/Sid Meier's Civilization VI/Mods/Dreadnought/NewUnit_Icons.xml.
        [1710428.781] [Database] ERROR: UNIQUE constraint failed: AtlasIcons.Name, AtlasIcons.Atlas
        You've got "ICON_UNIT_BATTLESHIP" instead of "ICON_UNIT_ENGLISH_DREADNOUGHT" and since there is already an IconDefinition for "ICON_UNIT_BATTLESHIP" you get the Unique Constraint Error and refusal of the game to read anything further from that file.
     
    Hemmelfort likes this.
  3. JohnCJR

    JohnCJR Chieftain

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

    Thank you so much for the fast reply and your help with this. I took a look at what you pointed out and I think I managed to fix it. Now the game doesn't crash back to the main menu it actually loads the map.

    The problem I am having now is that my unit and changes are not showing in the game. The Steam Power tech still has the Iron Clad unit instead of my Dreadnought. I am not sure what I am missing? Here are the updated files:

    https://www.dropbox.com/s/zxzp21bje61uver/Dreadnought.rar?dl=0
     
  4. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    7,241
    Location:
    Illinois, USA
    What does your database.log file say?

    You still have at least two errors in file NewUnit_Gameplay.xml that will need to be fixed.

    One is a syntax error in table <Units> and the other is an omission from table <Types>
     
    Last edited: Jul 21, 2017
  5. JohnCJR

    JohnCJR Chieftain

    Joined:
    Oct 23, 2016
    Messages:
    35
    Gender:
    Male
    Hi. My log file says the following:

    [Gameplay]: In XMLSerializer while updating table Units from file NewUnit_Gameplay.xml.
    [1734702.125]

    I found the syntax error. I for the life of me can't figure out what I am doing with the Gameplay file. This sort of thing isn't my forte, I got this far by copying and pasting from people who actually know what they are doing, and reading these forums. Here is the file as on 7.18pm:

    https://www.dropbox.com/s/vrev5c9cof33kaa/NewUnit_Gameplay.xml?dl=0

    I think it might be time for me to accept my limitations and accept that this is beyond my skills. If only the developers had released detailed instructions, step by step, on how to use these tools for people like myself who are not as familiar with modding. Oh well. Thanks for your help LeeS, it was much appreciated.
     
  6. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    7,241
    Location:
    Illinois, USA
    Code:
    <GameData>
    	<Types>
    		<Row Type="UNIT_ENGLISH_DREADNOUGHT" Kind="KIND_UNIT"/>
    		<Row Type="TRAIT_CIVILIZATION_UNIT_ENGLISH_DREADNOUGHT" Kind="KIND_TRAIT" />
    	</Types>
    	<Units>
    		<Row UnitType="UNIT_ENGLISH_DREADNOUGHT" BaseMoves="5" Cost="430" AdvisorType="ADVISOR_CONQUEST"
    			BaseSightRange="5" ZoneOfControl="true" Domain="DOMAIN_SEA" FormationClass="FORMATION_CLASS_NAVAL"
    			Name="LOC_UNIT_ENGLISH_DREADNOUGHT_NAME" Description="LOC_UNIT_ENGLISH_DREADNOUGHT_DESCRIPTION"
    			PurchaseYield="YIELD_GOLD" PseudoYieldType="PSEUDOYIELD_UNIT_NAVAL_COMBAT"
    			PromotionClass="PROMOTION_CLASS_NAVAL_RANGED" Maintenance="6" Combat="100" RangedCombat="150"
    			Range="5" PrereqTech="TECH_STEAM_POWER" TraitType="TRAIT_CIVILIZATION_UNIT_ENGLISH_DREADNOUGHT"
    			AntiAirCombat="80"/>
    	</Units>
    	<UnitReplaces>
    		<Row CivUniqueUnitType="UNIT_ENGLISH_DREADNOUGHT" ReplacesUnitType="UNIT_IRONCLAD"/>
    	</UnitReplaces>
    	<UnitAiInfos>
    		<Row UnitType="UNIT_ENGLISH_DREADNOUGHT" AiType="UNITAI_COMBAT"/>
    		<Row UnitType="UNIT_ENGLISH_DREADNOUGHT" AiType="UNITTYPE_RANGED"/>
    		<Row UnitType="UNIT_ENGLISH_DREADNOUGHT" AiType="UNITTYPE_NAVAL"/>
    	</UnitAiInfos>
    	<CivilizationTraits>
    		<Row CivilizationType="CIVILIZATION_ENGLAND" TraitType="TRAIT_CIVILIZATION_UNIT_ENGLISH_DREADNOUGHT"/>
    	</CivilizationTraits>
    	<Traits>
    		<Row TraitType="TRAIT_CIVILIZATION_UNIT_ENGLISH_DREADNOUGHT" Name="LOC_UNIT_ENGLISH_DREADNOUGHT_NAME"/>
    	</Traits>
    	<TypeTags>
    		<Row Type="UNIT_ENGLISH_DREADNOUGHT" Tag="CLASS_NAVAL_RANGED"/>
    		<Row Type="UNIT_ENGLISH_DREADNOUGHT" Tag="CLASS_ANTI_AIR"/>
    	</TypeTags>
    </GameData>
    You have to look at all the lines that start with a similar time-stamp to determine the error in your code. See in post #2 where the first set of errors I quoted all have the same opening time-stamp ([1710427.791]). You have to look at all the lines in Database.log that have a same time-stamp in order to determine which messages go together and therefore what the problem is.

    ----------------------------------------------------------

    In addition to the syntax error in table Units you were also missing this in table <Types>
    Code:
    <Row Type="TRAIT_CIVILIZATION_UNIT_ENGLISH_DREADNOUGHT" Kind="KIND_TRAIT" />
    The changes shown make the unit appear properly everywhere except the civilization/leader selection screen and it only does not show there because your mod has no code to make it appear there.

    Whether or not the proper animation shows is a different issue. I did not test for that, and I don't have the expertise to fix issues with unit-animations anyway.
     
    JohnCJR likes this.
  7. JohnCJR

    JohnCJR Chieftain

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

    Thank you for fixing that for me. It now works and shows up in the game. Now I can build the unit but unfortunately it is showing up as a warrior unit and not a Battleship. I did try and copy and past the battleship entry from artdef in the original game files and then change it at the end to my unit name ( ENGLISH_DREADNOUGHT) but I still get a warrior animation. Another user on another thread even gave me a copy of the battleship artdef code to make sure it is correct but no luck. Here is my artdef file contents:

    <?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>
     
  8. JamesRoper1403

    JamesRoper1403 Chieftain

    Joined:
    Mar 7, 2016
    Messages:
    33
    I've been stuck at the same point with my mod for a while too... I'd love to know what we're doing wrong with the artdef entry.
     
  9. KoubaK

    KoubaK Warlord

    Joined:
    May 8, 2017
    Messages:
    106
    Gender:
    Male
    Location:
    DMV
    Grab your files from "\Documents\Firaxis ModBuddy\Civilization VI\" and post them here. I will go through them.
     
  10. JamesRoper1403

    JamesRoper1403 Chieftain

    Joined:
    Mar 7, 2016
    Messages:
    33
    Thanks, man! You're awesome! I'm going to work on finishing off the changes I was making on my mod today, but here's a link to the file I uploaded last week on here...
     

    Attached Files:

  11. JohnCJR

    JohnCJR Chieftain

    Joined:
    Oct 23, 2016
    Messages:
    35
    Gender:
    Male
    Thank you for all of your help with that file, you are awesome. It is now working thanks to yourself and to KoubaK, who fixed my artdef file to get it to show the correct animation.
     
  12. KoubaK

    KoubaK Warlord

    Joined:
    May 8, 2017
    Messages:
    106
    Gender:
    Male
    Location:
    DMV
    Hey man, where is your original post. I'm trying to figure out what all you trying to do. I see your artdef file has code for all kinds of units (Warrior, Scout, etc.) but your GamePlay is all naval units. Could you tell me what unit are your units replacing, so that I can grab the right code for the artdef (i.e. Galley into "Small Boat" or something).
     
  13. JamesRoper1403

    JamesRoper1403 Chieftain

    Joined:
    Mar 7, 2016
    Messages:
    33
    I'll upload the latest version I have... I haven't touched the ArtDef since last time, but it has all the units I was planning on adding. I just need to finish the text which I have been able to handle so far.

    Here's a list of what I was planning to use though.

    <!-- Battlecruiser --> Battleship
    <!-- Dreadnought --> Minas Geraes
    <!-- Cruiser --> Destroyer
    <!-- Clipper --> Privateer
    <!-- Carrack --> Caravel
    <!-- Ship of the Line --> Frigate
    <!-- Protected Cruiser --> Ironclad
    <!-- Fleet Submarine --> U-Boat
    <!-- Skeid Longship --> Norwegian Longship
    <!-- Raiders --> Norwegian Beserker
    <!-- Desert Cavalry --> Camel Archer (MOAR Units)
    <!-- Maniple --> Hoplite
    <!-- Colonial Soldiers --> Conquistador
    <!-- Imperial Guard --> Garde Imperiale (MOAR Units)
    <!-- Equites --> Eques (MOAR Units)
    <!-- Territorial Soldiers --> Fatherland Volunteer (MOAR Units)
    <!-- Marine Corps --> French Marine (MOAR Units)
    <!-- Axeman --> Hirdman (MOAR Units)
    <!-- Composite Archers --> Hyksos Bowman (MOAR Units)
    <!-- Light Horses --> Jinete (MOAR Units)
    <!-- Legionary --> Legion
    <!-- Ronin --> Samurai
    <!-- Horse Archer --> Saka Horse Archer
    <!-- Escort Fighter --> P-51 Mustang
    <!-- Ballista --> Ballistra (MOAR Units)

    Here's my original post too - https://forums.civfanatics.com/threads/help-duplicating-editing-units.619513/
     

    Attached Files:

Share This Page