• We are currently performing site maintenance, parts of civfanatics are currently offline, but will come back online in the coming days. For more updates please see here.

How to edit Governor Promotions

Atlas627

Deity
Joined
Aug 25, 2011
Messages
3,123
Does anyone know how to edit the positions of the Governor promotions in the promotion trees?
 
The order they appear is handled by the GovernorPromotions table - the relevant columns are Level, Column and BaseAbility. Presumably, you don't just want to change their position, but also the pre-reqs, for which you need to look at the GovernorPromotionPrereqs table.
 
The order they appear is handled by the GovernorPromotions table - the relevant columns are Level, Column and BaseAbility. Presumably, you don't just want to change their position, but also the pre-reqs, for which you need to look at the GovernorPromotionPrereqs table.

This is what I thought as well, but doing so didn't change the description or title positions (may have changed the actual content of each promotion; didn't check). The descriptions changed to what I modded them to, they just didn't swap positions in the Promotion selection UI.
 
Also, trying to add a new promotion in place of a vanilla one didn't do anything to the UI either (again, haven't checked the actual gameplay functionality yet). Old promotion is still there.
 
In case you're able to figure it out quicker than me, I'm seeing this in database.log

Code:
[451246.862] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId
[451246.862] [Gameplay]: While executing - 'insert into Modifiers('ModifierId', 'ModifierType', 'SubjectRequirementSetId', 'Permanent') values (?, ?, ?, ?);'
[451246.862] [Gameplay]: In XMLSerializer while inserting row into table insert into Modifiers('ModifierId', 'ModifierType', 'SubjectRequirementSetId', 'Permanent') with  values (AtlasGoverning_Surveyor_Guildmaster_Increased_Builder_Movement, MODIFIER_SINGLE_CITY_GRANT_ABILITY_FOR_TRAINED_UNITS, UNIT_IS_MILITARY_ENGINEER, 1, ).
[451246.862] [Gameplay]: In XMLSerializer while updating table Modifiers from file SurveyorInfrastructure.xml.
[451246.862] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId

Edit: removed "correct" code as I'm no longer sure it is.
 
In case you're able to figure it out quicker than me, I'm seeing this in database.log

Code:
[451246.862] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId
[451246.862] [Gameplay]: While executing - 'insert into Modifiers('ModifierId', 'ModifierType', 'SubjectRequirementSetId', 'Permanent') values (?, ?, ?, ?);'
[451246.862] [Gameplay]: In XMLSerializer while inserting row into table insert into Modifiers('ModifierId', 'ModifierType', 'SubjectRequirementSetId', 'Permanent') with  values (AtlasGoverning_Surveyor_Guildmaster_Increased_Builder_Movement, MODIFIER_SINGLE_CITY_GRANT_ABILITY_FOR_TRAINED_UNITS, UNIT_IS_MILITARY_ENGINEER, 1, ).
[451246.862] [Gameplay]: In XMLSerializer while updating table Modifiers from file SurveyorInfrastructure.xml.
[451246.862] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId

Edit: removed "correct" code as I'm no longer sure it is.

Thanks, I wasn't getting any errors from the game so I assumed the log would be fine. I fixed all of the problems and now the log is clear and happy, but the promotions still aren't changing slots. I've uploaded the file which needed edits (the rest are the same).
 

Attachments

Have you had any luck fixing this? Using the latest file you provided, I'm getting these errors in modding.log:

Code:
[592700.989] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId
[592700.989] [Gameplay]: While executing - 'insert into Modifiers('ModifierId', 'ModifierType', 'SubjectRequirementSetId', 'Permanent') values (?, ?, ?, ?);'
[592700.989] [Gameplay]: In XMLSerializer while inserting row into table insert into Modifiers('ModifierId', 'ModifierType', 'SubjectRequirementSetId', 'Permanent') with  values (AtlasGoverning_Surveyor_Guildmaster_Increased_Builder_Movement, MODIFIER_SINGLE_CITY_GRANT_ABILITY_FOR_TRAINED_UNITS, UNIT_IS_MILITARY_ENGINEER, 1, ).
[592700.989] [Gameplay]: In XMLSerializer while updating table Modifiers from file SurveyorInfrastructure.xml.
[592700.989] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId

Modifiers give me headaches, but I'll keep poking around trying to figure it out unless someone else posts the answer.

Edit: Is it me, or are you not actually giving +1 movement to builders and engineers in that file? The modifier arguments has +1 charges added, but on movement just has this:

Code:
       <Row>
           <ModifierId>AtlasGoverning_Surveyor_Guildmaster_Increased_Builder_Movement</ModifierId>
           <Name>AbilityType</Name>
           <Value>AtlasGoverning_Surveyor_Engineer_Increased_Movement</Value>
       </Row>
       <Row>
           <ModifierId>AtlasGoverning_Surveyor_Guildmaster_Increased_Engineer_Movement</ModifierId>
           <Name>AbilityType</Name>
           <Value>AtlasGoverning_Surveyor_Engineer_Increased_Movement</Value>
       </Row>
 
Last edited:
Have you had any luck fixing this? Using the latest file you provided, I'm getting these errors in modding.log:

Code:
[592700.989] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId
[592700.989] [Gameplay]: While executing - 'insert into Modifiers('ModifierId', 'ModifierType', 'SubjectRequirementSetId', 'Permanent') values (?, ?, ?, ?);'
[592700.989] [Gameplay]: In XMLSerializer while inserting row into table insert into Modifiers('ModifierId', 'ModifierType', 'SubjectRequirementSetId', 'Permanent') with  values (AtlasGoverning_Surveyor_Guildmaster_Increased_Builder_Movement, MODIFIER_SINGLE_CITY_GRANT_ABILITY_FOR_TRAINED_UNITS, UNIT_IS_MILITARY_ENGINEER, 1, ).
[592700.989] [Gameplay]: In XMLSerializer while updating table Modifiers from file SurveyorInfrastructure.xml.
[592700.989] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId

Modifiers give me headaches, but I'll keep poking around trying to figure it out unless someone else posts the answer.

Edit: Is it me, or are you not actually giving +1 movement to builders and engineers in that file? The modifier arguments has +1 charges added, but on movement just has this:

Code:
       <Row>
           <ModifierId>AtlasGoverning_Surveyor_Guildmaster_Increased_Builder_Movement</ModifierId>
           <Name>AbilityType</Name>
           <Value>AtlasGoverning_Surveyor_Engineer_Increased_Movement</Value>
       </Row>
       <Row>
           <ModifierId>AtlasGoverning_Surveyor_Guildmaster_Increased_Engineer_Movement</ModifierId>
           <Name>AbilityType</Name>
           <Value>AtlasGoverning_Surveyor_Engineer_Increased_Movement</Value>
       </Row>

Thanks so much for looking at this. You are right that I never actually applied the movement modifiers to the Governor promotion, but that shouldn't have caused a problem otherwise. I've fixed that now. However, I can't find the error you see in the log file. Are you looking at the updated version of the file? Is it possible that my files aren't updating correctly?
 
I was using the latest file you posted in this thread, with the contents of the /cache directory deleted prior to launching the game. The only mod running that affected gameplay was yours. From what I can make of it, that error was caused by the missing movement modifier.

As to your other issue of the promotions not being in the spots you wanted, I'm still scratching my head. Will take another look at it when I get a moment, unless you post here first to say you've solved it.
 
The quoted error is not a Modding.log error: it is a Database.log error.
Code:
[592700.989] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId
[592700.989] [Gameplay]: While executing - 'insert into Modifiers('ModifierId', 'ModifierType', 'SubjectRequirementSetId', 'Permanent') values (?, ?, ?, ?);'
[592700.989] [Gameplay]: In XMLSerializer while inserting row into table insert into Modifiers('ModifierId', 'ModifierType', 'SubjectRequirementSetId', 'Permanent') with  values (AtlasGoverning_Surveyor_Guildmaster_Increased_Builder_Movement, MODIFIER_SINGLE_CITY_GRANT_ABILITY_FOR_TRAINED_UNITS, UNIT_IS_MILITARY_ENGINEER, 1, ).
[592700.989] [Gameplay]: In XMLSerializer while updating table Modifiers from file SurveyorInfrastructure.xml.
[592700.989] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId
This set of errors is reporting an attempt to define the same "ModifierId" more than once within table "Modifiers". That is what the "UNIQUE constraint failed" part of the top message-line means: you have violated SQL database unique constraint rules. Every game-table has a set of SQL "Unique Constraints" on the contents of the table-columns. Some game tables require that every new row have a unique designation for column-X to every other row within the table. Some game-tables require that a combination of column-datas must be unique in every row to every other combination for the same set of columns. The offending "Table.Column" is listed right on the leading message-line in Database.log
Code:
[592700.989] [Gameplay] ERROR: UNIQUE constraint failed: Modifiers.ModifierId
Unique Constraint errors are fatal syntax errors. The game ceases to read anything further within the same file as soon as it encounters any fatal syntax error.

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

This is the Firaxis definition of the table and it's restraints:
Code:
CREATE TABLE "Modifiers" (
		"ModifierId" TEXT NOT NULL,
		"ModifierType" TEXT NOT NULL,
		"RunOnce" BOOLEAN NOT NULL CHECK (RunOnce IN (0,1)) DEFAULT 0,
		"NewOnly" BOOLEAN NOT NULL CHECK (NewOnly IN (0,1)) DEFAULT 0,
		"Permanent" BOOLEAN NOT NULL CHECK (Permanent IN (0,1)) DEFAULT 0,
		"OwnerRequirementSetId" TEXT,
		"SubjectRequirementSetId" TEXT,
		"OwnerStackLimit" INTEGER,
		"SubjectStackLimit" INTEGER,
		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);
The "PRIMARY KEY" line tells us which column or combination-of-columns must have a unique set of argument-data to all other rows within the same table.
 
Last edited:
Thanks, but I am not receiving this error! And I checked the files for the part that is shown in that error and it no longer exists because I fixed it before uploading the most recent file, so I am not sure what the problem is now.
 
I'm not seeing any database errors either after copying-in your updated xml-file. But there's no real mystery as to why your database changes aren't showing up in the interface. You have no LoadOrder setting in the "UpdateDatabase" action. So your changes are being over-written when Gathering Storm loads. Afer altering your modinfo file to this the Liang promotions are showing in the user interface as you've re-directed them:
Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="299a1e6e-cff6-41ab-b57c-2e4d24a484dd" version="1">
  <Properties>
    <Name>Atlas' More Interesting Governing - Gathering Storm</Name>
    <Description>This mod is part of a series of mods with the goal to make choices in the game more interesting by both balancing them and adding more interesting mechanics. The goal of this mod in particular is to make Loyalty more dynamic, and also to make the Governors more powerful and interesting to use.</Description>
    <Teaser>More interesting and powerful Governors</Teaser>
    <Authors>Atlas</Authors>
    <CompatibleVersions>1.2,2.0</CompatibleVersions>
  </Properties>
  <Dependencies>
    <Mod id="4873eb62-8ccc-4574-b784-dda455e74e68" title="Expansion: Gathering Storm" />
    <Mod id="1B28771A-C749-434B-9053-D1380C553DE9" title="Expansion: Rise and Fall" />
    <Mod id="2F6E858A-28EF-46B3-BEAC-B985E52E9BC1" title="DLC: Vikings Content" />
  </Dependencies>
  <InGameActions>
    <UpdateDatabase id="AtlasGoverning_Gameplay">
      <Properties>
        <LoadOrder>151</LoadOrder>
      </Properties>
      <File>Loyalty/Improvements.xml</File>
      <File>Loyalty/Parameters.xml</File>
      <File>Governors/CardinalReligious.xml</File>
      <File>Governors/SurveyorInfrastructure.xml</File>
    </UpdateDatabase>
    <UpdateText id="AtlasGoverning_Text">
      <Properties>
        <LoadOrder>151</LoadOrder>
      </Properties>
      <File>Loyalty/LoyaltyDescriptions.xml</File>
      <File>Governors/CardinalDescriptions.xml</File>
      <File>Governors/SurveyorDescriptions.xml</File>
    </UpdateText>
  </InGameActions>
  <Files>
    <File>Governors/CardinalDescriptions.xml</File>
    <File>Governors/CardinalReligious.xml</File>
    <File>Governors/EducatorResearch.xml</File>
    <File>Governors/SurveyorDescriptions.xml</File>
    <File>Governors/SurveyorInfrastructure.xml</File>
    <File>Loyalty/Improvements.xml</File>
    <File>Loyalty/LoyaltyDescriptions.xml</File>
    <File>Loyalty/Parameters.xml</File>
  </Files>
</Mod>
I did not check any of the other Governors to see if redirects for them were being applied as you want, but I would assume they are.

A check of the actual game database showed the Parks and Recreation promotion had 3 prereqs before I added the LoadOrder value to the UpdateDatebase action.

Get a SQL database viewer program so you can inspect the contents of the actual game database after your mod and game DLC/Expacs are loaded when the game does not act in the way you expect it to. I use SQLiteBrowser. Others use and swear by other but similar programs. Database.log only shows errors in syntax -- it does not tell you when the database is not being alterred as you expect because relative LoadOrder of Mods/DLC/Expacs is causing a re-write of the changes your mod is making. Nor does Database.log report an error when an "Update" statement is executed before the thing being updated is even added to the SQL database.

You want to open and look at the database file named "DebugGameplay.sqlite" within folder C:\Users\[UserName]\Documents\My Games\Sid Meier's Civilization VI\Cache
 
Last edited:
Thanks a lot LeeS. I had assumed it wasn't a load order thing as only SOME of my changes were getting overwritten, but now I realize it was the gameplay changes that were being overwritten (such as swapping promotion slots) but not the text changes (so my other promotions looked like they had been changed). Glad to know it isn't that Governors are uneditable, and I will look into a database viewer so I don't have to ask you to do my dirty work for me in the future! =)

Thank you again Racha for helping me look even though you hate modifiers.
 
Back
Top Bottom