[SOLVED] Debugging Mods, Help With Mod

Whale Cancer

Chieftain
Joined
Nov 19, 2016
Messages
7
EDIT: Solved by using the Aztec DLC as a base rather than the Punt civilization. Expect a pack of alternate leaders soon!

Hello,

I hope I am posting this in the right place, but the 'new civilizations' subforum seems to be for complete projects only and 'tutorials and reference' seems to not be for questions.

Anyway, I am trying to create a new leader for the Japanese civilization. This is just a test for a first mod at the moment. The new leader is Oda Nobunaga. All that has been changed is the addition of the new leader, a unique trait for him (1 additional military policy slot [intend to add culture on winning a battle next]), and supported files (e.g. color). I used the Punt civilization mod along with the game's data files as reference.

The mod loads properly and the leader displays correctly in the selection menu.

However, when I launch with my new leader selected I get a crash without any messages. Makes things hard to debug. Is there somewhere I can access debugging information? Why it crashed? My only inkling of what the issue may be is that I have no idea where the pedia entries are referenced (I added localizations for them using the Punt civilization as a guide, but I was unable to actually locate where those localizations are referenced).

Here is the mod in a zip file if anyone wants to take a look: https://www.dropbox.com/s/cnklau6zoezo4ya/Nobgunaga.zip?dl=0

EDIT: So I found 'Database.log'

Here is what seems to be the relevant part of the log:
[2154628.525] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId
[2154628.525] [Gameplay]: While executing - 'insert into Modifiers('ModifierId', 'ModifierType') values (?, ?);'
[2154628.525] [Gameplay]: In XMLSerializer while inserting row into table insert into Modifiers('ModifierId', 'ModifierType') with values (TRAIT_MILITARY_GOVERNMENT_SLOT, MODIFIER_PLAYER_CULTURE_ADJUST_GOVERNMENT_SLOTS_MODIFIER, ).
[2154628.525] [Gameplay]: In XMLSerializer while updating table Modifiers from file Nobunaga_Leaders.xml.
[2154628.525] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId

I don't get it as my trait seems to be the same as Barbarossa's values?

Code:
    <Modifiers>
        <Row>
            <ModifierId>TRAIT_MILITARY_GOVERNMENT_SLOT</ModifierId>
            <ModifierType>MODIFIER_PLAYER_CULTURE_ADJUST_GOVERNMENT_SLOTS_MODIFIER</ModifierType>
        </Row>
    </Modifiers>
    <ModifierArguments>
        <Row>
            <ModifierId>TRAIT_MILITARY_GOVERNMENT_SLOT</ModifierId>
            <Name>GovernmentSlotType</Name>
            <Value>SLOT_MILITARY</Value>
        </Row>
    </ModifierArguments>

Edit2: I seem to have cleared the error by deleting the (redundent?) modifiers in my leaders file. Now I still get a crash but my database.log consists only of:
[2156720.857] [Localization]: Validating Foreign Key Constraints...
[2156720.857] [Localization]: Passed Validation.
[2156720.865] [Configuration]: Validating Foreign Key Constraints...
[2156720.866] [Configuration]: Passed Validation.
[2156727.511] [FullTextSearch]: Initializing FullTextSearch
[2156728.085] [Gameplay]: Validating Foreign Key Constraints...
[2156728.101] [Gameplay]: Passed Validation.
[2156728.716] [Configuration]: Validating Foreign Key Constraints...
[2156728.716] [Configuration]: Passed Validation.
[2156768.881] [Gameplay]: Validating Foreign Key Constraints...
[2156768.903] [Gameplay]: Passed Validation.

Edit3 (am I seriously on edit3 already?): Gamecore.log seems to show my leader is not being properly assigned to Japan?
[2156769.902] Player 0: Civilization - (null) (0) Leader - LEADER_NOBUNAGA (236208237)

I declare my leader like this:
Code:
    <CivilizationLeaders>
        <Row CivilizationType="CIVILIZATION_JAPAN" LeaderType="LEADER_NOBUNAGA" CapitalName="LOC_CITY_NAME_NAGOYA"/>
    </CivilizationLeaders>
 
Last edited:
The reason why your attempt to state TRAIT_MILITARY_GOVERNMENT_SLOT failed is that the game does not let you create two or more rows in the <Modifiers> table that have
Code:
<ModifierId>TRAIT_MILITARY_GOVERNMENT_SLOT</ModifierId>
Since the game already has this modifierID name defined, you cannot attempt to add a second row to the table with the same name. You can make your leader also use the existing modifierID name, you just cannot attempt to re-create the same modifierID name.

That is what this part of the error means:
[2154628.525] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId

"Modifiers.ModifierId" is telling you TableName.ColumnName that must have all rows using a unique text string to all other rows within the game's database. This means anything you add in a mod must be unique and not repeat anything the base game, any of the game's DLC, any of the game's expansions (when they start coming), and any mod that loads before your mod add to the game.

The rest of the error messages with the same time-stamp ([2154628.525]) are telling you which file, which exact set of information, etc., the error was found within.

Since we are still in the process of figuring out how civ6 works as opposed to civ5 or civ4, I am not sure we have figured out all the table.column combinations that do not allow repeat designations. But my understanding of the way the "Modifiers" table is defined in 01_GameplaySchema.sql in folder C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization VI\Base\Assets\Gameplay\Data\Schema:
Code:
CREATE TABLE "Modifiers" (
		"ModifierId" TEXT NOT NULL,
		"ModifierType" TEXT NOT NULL,
		"RunOnce" BOOLEAN NOT NULL CHECK (RunOnce IN (0,1)) DEFAULT 0,
		"Permanent" BOOLEAN NOT NULL CHECK (Permanent IN (0,1)) DEFAULT 0,
		"OwnerRequirementSetId" TEXT,
		"SubjectRequirementSetId" TEXT,
		PRIMARY KEY(ModifierId),
		FOREIGN KEY (OwnerRequirementSetId) REFERENCES RequirementSets(RequirementSetId) ON DELETE CASCADE ON UPDATE CASCADE,
		FOREIGN KEY (SubjectRequirementSetId) REFERENCES RequirementSets(RequirementSetId) ON DELETE CASCADE ON UPDATE CASCADE);
tells me that the line
PRIMARY KEY(ModifierId),
is stating that the only "Primary" column within the table "Modifiers" is "ModifierId", and every row added to the table must be unique in its designation-name for "ModifierId" to all other usages.

Some tables have more than one column defined as the "PRIMARY KEY", and this apparently means that the combination of designations for these two (or three) columns must be unique to all other combinations, I think.
 
Back
Top Bottom