[SOLVED] need help trying to mod Diplomatic Actions :)

Seileach

Chieftain
Joined
Feb 1, 2002
Messages
79
hi :)

i wanted to make Reconquest War and Protectorate War available sooner, the Renaissance seems somewhat late for other empires to understand the desire to take back what was taken from us and to protect those under our protection :D

these seem to be defined by these lines in DiplomaticActions.xml:

Code:
    <DiplomaticActions>
        /* lines missing */
        <Row DiplomaticActionType="DIPLOACTION_DECLARE_RECONQUEST_WAR" Name="LOC_DIPLOACTION_DECLARE_RECONQUEST_WAR_NAME" Description="LOC_DIPLOACTION_DECLARE_RECONQUEST_WAR_DESCRIPTION" CivilopediaKey="DIPLO_3" UIGroup="FORMALWAR" DenouncementTurnsRequired="5" InitiatorPrereqCivic="CIVIC_DIPLOMATIC_SERVICE" Cost="0" WarmongerPercent="0" RequiresOccupiedCity="true"/>
        <Row DiplomaticActionType="DIPLOACTION_DECLARE_PROTECTORATE_WAR" Name="LOC_DIPLOACTION_DECLARE_PROTECTORATE_WAR_NAME" Description="LOC_DIPLOACTION_DECLARE_PROTECTORATE_WAR_DESCRIPTION" CivilopediaKey="DIPLO_3" UIGroup="FORMALWAR" DenouncementTurnsRequired="0" InitiatorPrereqCivic="CIVIC_DIPLOMATIC_SERVICE" Cost="0" WarmongerPercent="0" RequiresWarOnAlliedCityState="true"/>
        /* lines missing */
    </DiplomaticActions>

so i tried this:

Code:
UPDATE DiplomaticActions SET InitiatorPrereqCivic = "CIVIC_DEFENSIVE_TACTICS" WHERE DiplomaticActionType="DIPLOACTION_DECLARE_RECONQUEST_WAR";
UPDATE DiplomaticActions SET InitiatorPrereqCivic = "CIVIC_RECORDED_HISTORY" WHERE DiplomaticActionType="DIPLOACTION_DECLARE_PROTECTORATE_WAR";

but there was no change. any idea what am i doing wrong?

cheers! :)
 
Could be any number of things you are doing wrong. I assume you are doing this within a mod and not directly within the game's base files or folders.

Zip the version of the mod that is in the game's \Documents\My Games\Sid Meier's Civilization VI\Mods folder. Otherwise it is impossible to determine what you are doing incorrectly.
 
you can find the zipped mod here

this is a simple mod where i gather some small tweaks to make gameplay more to my liking

the rest of the mod works fine, just as intended
 
someone else had a similar problem

apparently, in their case the change went into effect, it just didn't show in the civics tree... i didn't check for that, i just saw that my mod didn't change the civics tree and assumed no change went into effect.

when i loaded a game i had started with my mod, where my civ already had the civics i wanted to grant those diplomatic actions, nothing had changed, the diplomatic actions were not available to me. however, it is possible that those actions become available not by having the civic, but by gaining the civic... it sounds convoluted to me, but everything about modding Civ6 sounds convoluted to me...

i will try and test this, although i'm not entirely sure how i will test it... maybe start a game in the quickest speed, let one of the AI take one of my cities and make a bee-line for the Military Defences civic, where i want to put the Reconquest War diplomatic action... not feeling terribly optimistic though...
 
The structure of the modinfo file is ok, and the code executes properly when loaded via an SQL "execute code" when not in the game and using SQLiteViewer to view the game database and make test changes to it.

Your sql file is failing on the Improvements code, before it ever gets to the lines in question, however, when running the mod by the game.

Database.log
Code:
[122112.667] [Gameplay] ERROR: CHECK constraint failed: Improvements
[122112.667] [Gameplay] ERROR: CHECK constraint failed: Improvements
This tracks to this in Modding.log, which tells us which SQL file contains the error
Code:
[122112.666] Status: UpdateDatabase - Loading Rules.sql
[122112.667] Warning: UpdateDatabase - Error Loading SQL.
You file's code
Code:
UPDATE Improvements SET SameAdjacentValid = "false" WHERE ImprovementType="IMPROVEMENT_CHATEAU";
UPDATE Improvements SET SameAdjacentValid = "false" WHERE ImprovementType="IMPROVEMENT_COLOSSAL_HEAD";
UPDATE Improvements SET SameAdjacentValid = "false" WHERE ImprovementType="IMPROVEMENT_KURGAN";
UPDATE Improvements SET SameAdjacentValid = "false" WHERE ImprovementType="IMPROVEMENT_MISSION";
UPDATE Improvements SET SameAdjacentValid = "false" WHERE ImprovementType="IMPROVEMENT_ZIGGURAT";
SQL does not use "true" or "false". It uses numerical 1 and 0 for true/false.

"true" and "false" witihn XML files are parsed into numerical 1 and 0 when entered into the game's database.
 
it's working now, thanks :)

i would never get there on my own, i didn't know SQL does not use "true" or "false" and that change really seemed to be working, i guess that was just a coincidence :)

once again, thanks :)
 
What @thecrazyscot is talking about is this file: C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization VI\Base\Assets\Gameplay\Data\Schema/01_GameplaySchema.sql

"Gameplay" in ~Assets\Gameplay\Data~ means everything after a player clicks on the "Start Game" or "Load Save" buttons

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

For everything in the "FrontEnd" (or pre-game) you need to look in file C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization VI\Base\Assets\Configuration\Data\Schema/AdditionalTables.sql

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

Specifically for table "Improvements" the definition of the table and its columns is
Code:
CREATE TABLE "Improvements" (
		"ImprovementType" TEXT NOT NULL,
		"Name" TEXT NOT NULL,
		"BarbarianCamp" BOOLEAN NOT NULL CHECK (BarbarianCamp IN (0,1)) DEFAULT 0,
		"PrereqTech" TEXT,
		"PrereqCivic" TEXT,
		"Buildable" BOOLEAN NOT NULL CHECK (Buildable IN (0,1)) DEFAULT 0,
		"Description" TEXT,
		"RemoveOnEntry" BOOLEAN NOT NULL CHECK (RemoveOnEntry IN (0,1)) DEFAULT 0,
		"DispersalGold" INTEGER NOT NULL DEFAULT 0,
		"PlunderType" TEXT NOT NULL,
		"PlunderAmount" INTEGER NOT NULL DEFAULT 0,
		"Goody" BOOLEAN NOT NULL CHECK (Goody IN (0,1)) DEFAULT 0,
		"TilesPerGoody" INTEGER,
		"GoodyRange" INTEGER,
		"Icon" TEXT NOT NULL,
		"TraitType" TEXT,
		"Housing" INTEGER NOT NULL DEFAULT 0,
		"TilesRequired" INTEGER NOT NULL DEFAULT 1,
		"SameAdjacentValid" BOOLEAN NOT NULL CHECK (SameAdjacentValid IN (0,1)) DEFAULT 1,
		"RequiresRiver" INTEGER NOT NULL DEFAULT 0,
		"EnforceTerrain" BOOLEAN NOT NULL CHECK (EnforceTerrain IN (0,1)) DEFAULT 0,
		"BuildInLine" BOOLEAN NOT NULL CHECK (BuildInLine IN (0,1)) DEFAULT 0,
		"CanBuildOutsideTerritory" BOOLEAN NOT NULL CHECK (CanBuildOutsideTerritory IN (0,1)) DEFAULT 0,
		"BuildOnFrontier" BOOLEAN NOT NULL CHECK (BuildOnFrontier IN (0,1)) DEFAULT 0,
		"AirSlots" INTEGER NOT NULL DEFAULT 0,
		"DefenseModifier" INTEGER NOT NULL DEFAULT 0,
		"GrantFortification" INTEGER NOT NULL DEFAULT 0,
		"MinimumAppeal" INTEGER,
		"Coast" BOOLEAN NOT NULL CHECK (Coast IN (0,1)) DEFAULT 0,
		"YieldFromAppeal" TEXT,
		"WeaponSlots" INTEGER NOT NULL DEFAULT 0,
		"ReligiousUnitHealRate" INTEGER NOT NULL DEFAULT 0,
		"Appeal" INTEGER NOT NULL DEFAULT 0,
		"OnePerCity" BOOLEAN NOT NULL CHECK (OnePerCity IN (0,1)) DEFAULT 0,
		"YieldFromAppealPercent" INTEGER NOT NULL DEFAULT 100,
		"ValidAdjacentTerrainAmount" INTEGER NOT NULL DEFAULT 0,
		"Domain" TEXT NOT NULL DEFAULT "DOMAIN_LAND",
		PRIMARY KEY(ImprovementType),
		FOREIGN KEY (PrereqTech) REFERENCES Technologies(TechnologyType) ON DELETE SET DEFAULT ON UPDATE SET DEFAULT,
		FOREIGN KEY (PrereqCivic) REFERENCES Civics(CivicType) ON DELETE SET DEFAULT ON UPDATE SET DEFAULT,
		FOREIGN KEY (TraitType) REFERENCES Traits(TraitType) ON DELETE SET DEFAULT ON UPDATE SET DEFAULT,
		FOREIGN KEY (YieldFromAppeal) REFERENCES Yields(YieldType) ON DELETE SET DEFAULT ON UPDATE SET DEFAULT,
		FOREIGN KEY (ImprovementType) REFERENCES Types(Type) ON DELETE CASCADE ON UPDATE CASCADE);
This line tells us the definition of the "SameAdjacentValid" column
Code:
"SameAdjacentValid" BOOLEAN NOT NULL CHECK (SameAdjacentValid IN (0,1)) DEFAULT 1,
This column-definition tells us that the values must be 1 or 0 (remember that XML "true" is translated as 1) and that if no value is given for this column the game will default to using "1" (ie, true).
 
thanks, that's extremely helpful :) i didn't know exactly how the schema worked, but with this practical example it's clearer now

i may further tweak my mod and make those improvements a OnePerCity kind of deal :)
 
You can also use a tool like SQLite Studio to see the data in a few different formats. In the case of SQLite Studio, you can right click and select "Edit Table" to get fast access to a list of Constraints. The original DDL is also available on the last tab if you want to look at the actual code. I find this easier to use because the Data tab contains actual real data to look at, which is not present in the Firaxis Schema files.

Remember that when you use SQLite Studio you hook it up to the Debug database which is rewritten everytime you start a new game or load a save, so there is no danger of messing up files like poking around in the game's core files brings.

upload_2017-8-23_21-57-10.png


upload_2017-8-23_21-58-52.png


upload_2017-8-23_21-59-7.png
 
Top Bottom