[GS] Change River Names using SQL

Cole98

AKA CerebralPolicy
Joined
Feb 10, 2012
Messages
135
Location
Salmon Arm, Canada
I would like to change the names of the rivers shared by the Cree and Canada to their English, I've tried with no success. I'm not on my desktop so I can't post my code yet but I was wondering if anyone could help.
I'm trying to change these
Kisiskāciwani-sīpiy to Saskatchewan River
Powinigow Sipi to Nelson River
 
I'm not near my computer with Civ, so I don't have access to verify, but going from memory, there are three tables you need to be looking at.
NamedRivers in the Gameplay Database .
NamedCivilizationRivers in the Gameplay Database.
LocalizedText/BaseGameText in the Localization Database.

The first two provide specifics of the rivers. The first one maps a River to a specific name of that river found in the LocalizedText table, while the second one maps a civilization to a specific river. For you, I'd suggest looking at the NamedCivilizationRivers to find what the PK backend name of your river in question is, then go to the NamedRivers to find the Name of that river. Finally, you go to the LocalizedText and search the Tags by the Name found and change the Text of it from there.

I'd recommend using my utility (https://forums.civfanatics.com/threads/gs-sql-helper-for-civilization-vi.644007/) which will allow you to make modifications in the UI to output the SQL you need or SQLite Studio (https://forums.civfanatics.com/threads/tutorial-modding-with-sqllite-studio-pc.608352/) which will help in navigation if you do the SQL statement by hand.
 
It may be related to the LoadOrder. Is your mod's SQL set to load after GS has been loaded in?

Posting your SQL Statement and Database.log could prove fruitful for debugging, too, once back on that machine.
 
I used your program to help streamline it, I probably need to do a load order statement in the .modinfo
Spoiler SQL Statement :

Code:
/*
    This is the file for your SQL code. Put any comments you want here.
*/
--RIVERS
---LOCALIZATION INITIALIZATION
INSERT INTO [LocalizedText]([Language], [Tag], [Text], [Gender], [Plurality])
 VALUES ('en_US', 'LOC_NAMED_RIVER_ASSINIBOINE_NAME', 'Assiniboine River', NULL, NULL);

INSERT INTO [LocalizedText]([Language], [Tag], [Text], [Gender], [Plurality])
 VALUES ('en_US', 'LOC_NAMED_RIVER_CHURCHILL_NAME', 'Churchill River', NULL, NULL);

INSERT INTO [LocalizedText]([Language], [Tag], [Text], [Gender], [Plurality])
 VALUES ('en_US', 'LOC_NAMED_RIVER_KOOTENAY_NAME', 'Kootenay River', NULL, NULL);
 
INSERT INTO [LocalizedText]([Language], [Tag], [Text], [Gender], [Plurality])
 VALUES ('en_US', 'LOC_NAMED_RIVER_NELSON_NAME', 'Nelson River', NULL, NULL);

INSERT INTO [LocalizedText]([Language], [Tag], [Text], [Gender], [Plurality])
 VALUES ('en_US', 'LOC_NAMED_RIVER_PEACE_NAME', 'Peace River', NULL, NULL);
 
INSERT INTO [LocalizedText]([Language], [Tag], [Text], [Gender], [Plurality])
 VALUES ('en_US', 'LOC_NAMED_RIVER_SASKATCHEWAN_NAME', 'Saskatchewan River', NULL, NULL);

INSERT INTO [LocalizedText]([Language], [Tag], [Text], [Gender], [Plurality])
 VALUES ('en_US', 'LOC_NAMED_RIVER_SEVERN_NAME', 'Severn River', NULL, NULL);

---NAMED
INSERT INTO [NamedRivers]([NamedRiverType], [Name])
 VALUES ('NAMED_RIVER_ASSINIBOINE', 'LOC_NAMED_RIVER_ASSINIBOINE_NAME');

INSERT INTO [NamedRivers]([NamedRiverType], [Name])
 VALUES ('NAMED_RIVER_CHURCHILL', 'LOC_NAMED_RIVER_CHURCHILL_NAME');

INSERT INTO [NamedRivers]([NamedRiverType], [Name])
 VALUES ('NAMED_RIVER_KOOTENAY', 'LOC_NAMED_RIVER_KOOTENAY_NAME');

INSERT INTO [NamedRivers]([NamedRiverType], [Name])
 VALUES ('NAMED_RIVER_PEACE', 'LOC_NAMED_RIVER_PEACE_NAME');

INSERT INTO [NamedRivers]([NamedRiverType], [Name])
 VALUES ('NAMED_RIVER_SEVERN', 'LOC_NAMED_RIVER_SEVERN_NAME');

UPDATE [NamedRivers]
SET [Name] = 'LOC_NAMED_RIVER_NELSON_NAME'
WHERE ([NamedRiverType] = 'NAMED_RIVER_POWINIGOW');

UPDATE [NamedRivers]
SET [Name] = 'LOC_NAMED_RIVER_SASKATCHEWAN_NAME'
WHERE ([NamedRiverType] = 'NAMED_RIVER_KISISKACIWANI_SIPIY');

---CIVILIZATION
INSERT INTO [NamedRiverCivilizations]([NamedRiverType], [CivilizationType])
 VALUES ('NAMED_RIVER_ASSINIBOINE', 'CIVILIZATION_CANADA');

INSERT INTO [NamedRiverCivilizations]([NamedRiverType], [CivilizationType])
 VALUES ('NAMED_RIVER_CHURCHILL', 'CIVILIZATION_CANADA');

INSERT INTO [NamedRiverCivilizations]([NamedRiverType], [CivilizationType])
 VALUES ('NAMED_RIVER_KOOTENAY', 'CIVILIZATION_CANADA');

INSERT INTO [NamedRiverCivilizations]([NamedRiverType], [CivilizationType])
 VALUES ('NAMED_RIVER_PEACE', 'CIVILIZATION_CANADA');

INSERT INTO [NamedRiverCivilizations]([NamedRiverType], [CivilizationType])
 VALUES ('NAMED_RIVER_RED', 'CIVILIZATION_CANADA');

INSERT INTO [NamedRiverCivilizations]([NamedRiverType], [CivilizationType])
 VALUES ('NAMED_RIVER_SEVERN', 'CIVILIZATION_CANADA');

Spoiler ModInfo :

Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="63461aa2-0f2a-4d57-aad1-7feeb6c6241b" version="1">
    <Properties>
        <Name>English Names for Shared Canadian/Cree Rivers</Name>
        <Teaser>Makes all rivers shared by Canada and Cree use English names</Teaser>
        <Description>Put a description here</Description>
        <Authors>CerebralPolicy</Authors>
        <CompatibleVersions>2.0</CompatibleVersions>
    </Properties>

    <!-- Files included -->
    <Files>
        <File>Code.sql</File>
    </Files>

    <!-- Different parts of the mod -->
    <InGameActions>
        <UpdateDatabase id="NEW_RIVER_NAMES">
            <Items>
                 <File>Code.sql</File>
            </Items>
        </UpdateDatabase>
    </InGameActions>
</Mod>
 
The SQL Statements appear correct and execute correctly on my end when interacting with the DB alone, which leads me to believe it is likely a loading issue. Try setting the Load Order to 1 or 2 and see if that helps it out.
 
<inGameActions> indeed do not want <Items>

This syntax should only be used in a modinfo file using the older <Settings> and <Components> tables rather than the newer <FrontEndActions> and <InGameActions> introduced by the release of the SDK
Code:
<Items>
     <File>Filename.sql</File>
</Items>
When using <InGameActions> and <FrontEndActions> only the following is needed to specify the files an action is to load or otherwise affect
Code:
<File>Filename.sql</File>
-------

Your larger problem however is that you are attempting to write to the LocalizedText table from an UpdateDatabase type of action, which will not work. You will simply get a "no such table" error.

LocalizedText must be loaded via an "UpdateText" type of action rather than an "UpdateDatabase" type of action.

A check of Database.log will show an error for the wrong type of table in an "UpdateDatabase" type of action.

This code must loaded via an "UpdateDatabase" type of action:
Code:
---NAMED
INSERT INTO [NamedRivers]([NamedRiverType], [Name])
 VALUES ('NAMED_RIVER_ASSINIBOINE', 'LOC_NAMED_RIVER_ASSINIBOINE_NAME');

INSERT INTO [NamedRivers]([NamedRiverType], [Name])
 VALUES ('NAMED_RIVER_CHURCHILL', 'LOC_NAMED_RIVER_CHURCHILL_NAME');

INSERT INTO [NamedRivers]([NamedRiverType], [Name])
 VALUES ('NAMED_RIVER_KOOTENAY', 'LOC_NAMED_RIVER_KOOTENAY_NAME');

INSERT INTO [NamedRivers]([NamedRiverType], [Name])
 VALUES ('NAMED_RIVER_PEACE', 'LOC_NAMED_RIVER_PEACE_NAME');

INSERT INTO [NamedRivers]([NamedRiverType], [Name])
 VALUES ('NAMED_RIVER_SEVERN', 'LOC_NAMED_RIVER_SEVERN_NAME');

UPDATE [NamedRivers]
SET [Name] = 'LOC_NAMED_RIVER_NELSON_NAME'
WHERE ([NamedRiverType] = 'NAMED_RIVER_POWINIGOW');

UPDATE [NamedRivers]
SET [Name] = 'LOC_NAMED_RIVER_SASKATCHEWAN_NAME'
WHERE ([NamedRiverType] = 'NAMED_RIVER_KISISKACIWANI_SIPIY');

---CIVILIZATION
INSERT INTO [NamedRiverCivilizations]([NamedRiverType], [CivilizationType])
 VALUES ('NAMED_RIVER_ASSINIBOINE', 'CIVILIZATION_CANADA');

INSERT INTO [NamedRiverCivilizations]([NamedRiverType], [CivilizationType])
 VALUES ('NAMED_RIVER_CHURCHILL', 'CIVILIZATION_CANADA');

INSERT INTO [NamedRiverCivilizations]([NamedRiverType], [CivilizationType])
 VALUES ('NAMED_RIVER_KOOTENAY', 'CIVILIZATION_CANADA');

INSERT INTO [NamedRiverCivilizations]([NamedRiverType], [CivilizationType])
 VALUES ('NAMED_RIVER_PEACE', 'CIVILIZATION_CANADA');

INSERT INTO [NamedRiverCivilizations]([NamedRiverType], [CivilizationType])
 VALUES ('NAMED_RIVER_RED', 'CIVILIZATION_CANADA');

INSERT INTO [NamedRiverCivilizations]([NamedRiverType], [CivilizationType])
 VALUES ('NAMED_RIVER_SEVERN', 'CIVILIZATION_CANADA');
Whereas this must be loaded via an "UpdateText" type of action
Code:
INSERT INTO [LocalizedText]([Language], [Tag], [Text], [Gender], [Plurality])
 VALUES ('en_US', 'LOC_NAMED_RIVER_ASSINIBOINE_NAME', 'Assiniboine River', NULL, NULL);

INSERT INTO [LocalizedText]([Language], [Tag], [Text], [Gender], [Plurality])
 VALUES ('en_US', 'LOC_NAMED_RIVER_CHURCHILL_NAME', 'Churchill River', NULL, NULL);

INSERT INTO [LocalizedText]([Language], [Tag], [Text], [Gender], [Plurality])
 VALUES ('en_US', 'LOC_NAMED_RIVER_KOOTENAY_NAME', 'Kootenay River', NULL, NULL);
 
INSERT INTO [LocalizedText]([Language], [Tag], [Text], [Gender], [Plurality])
 VALUES ('en_US', 'LOC_NAMED_RIVER_NELSON_NAME', 'Nelson River', NULL, NULL);

INSERT INTO [LocalizedText]([Language], [Tag], [Text], [Gender], [Plurality])
 VALUES ('en_US', 'LOC_NAMED_RIVER_PEACE_NAME', 'Peace River', NULL, NULL);
 
INSERT INTO [LocalizedText]([Language], [Tag], [Text], [Gender], [Plurality])
 VALUES ('en_US', 'LOC_NAMED_RIVER_SASKATCHEWAN_NAME', 'Saskatchewan River', NULL, NULL);

INSERT INTO [LocalizedText]([Language], [Tag], [Text], [Gender], [Plurality])
 VALUES ('en_US', 'LOC_NAMED_RIVER_SEVERN_NAME', 'Severn River', NULL, NULL);
 
Last edited:
Hi, I don't see the following files in the Gameplay Database or Localization Database.

NamedRivers in the Gameplay Database .
NamedCivilizationRivers in the Gameplay Database.
LocalizedText/BaseGameText in the Localization Database.

However, I can see the names of rivers in the "Expansion2_NamedPlaces" located in C:\Program Files (x86)\Steam\steamapps\common\Sid Meier's Civilization VI\DLC\Expansion2\Data folder.
 
Code:
CREATE TABLE "NamedRivers" (
		"NamedRiverType" TEXT NOT NULL,
		"Name" TEXT NOT NULL,
		PRIMARY KEY(NamedRiverType));

CREATE TABLE "NamedRiverCivilizations" (
		"NamedRiverType" TEXT NOT NULL,
		"CivilizationType" TEXT NOT NULL,
		PRIMARY KEY(NamedRiverType, CivilizationType),
		FOREIGN KEY (NamedRiverType) REFERENCES NamedRivers(NamedRiverType) ON DELETE CASCADE ON UPDATE CASCADE,
		FOREIGN KEY (CivilizationType) REFERENCES Civilizations(CivilizationType) ON DELETE CASCADE ON UPDATE CASCADE);
Both of these tables are in the DebugGameplay.sqlite database when Gathering Storm is enabled and running. I see them as valid tables with data in them when I use SQLiteViewer to examine the contents of the InGame "debug" database.

Both BaseGameText and LocalizaedText appear in the DebugLocalization.sqlite database.
 
LeeS, understood now. Will download SQLite program.
Code:
CREATE TABLE "NamedRivers" (
        "NamedRiverType" TEXT NOT NULL,
        "Name" TEXT NOT NULL,
        PRIMARY KEY(NamedRiverType));

CREATE TABLE "NamedRiverCivilizations" (
        "NamedRiverType" TEXT NOT NULL,
        "CivilizationType" TEXT NOT NULL,
        PRIMARY KEY(NamedRiverType, CivilizationType),
        FOREIGN KEY (NamedRiverType) REFERENCES NamedRivers(NamedRiverType) ON DELETE CASCADE ON UPDATE CASCADE,
        FOREIGN KEY (CivilizationType) REFERENCES Civilizations(CivilizationType) ON DELETE CASCADE ON UPDATE CASCADE);
Both of these tables are in the DebugGameplay.sqlite database when Gathering Storm is enabled and running. I see them as valid tables with data in them when I use SQLiteViewer to examine the contents of the InGame "debug" database.

Both BaseGameText and LocalizaedText appear in the DebugLocalization.sqlite database.
 
Code:
CREATE TABLE "NamedRivers" (
        "NamedRiverType" TEXT NOT NULL,
        "Name" TEXT NOT NULL,
        PRIMARY KEY(NamedRiverType));

CREATE TABLE "NamedRiverCivilizations" (
        "NamedRiverType" TEXT NOT NULL,
        "CivilizationType" TEXT NOT NULL,
        PRIMARY KEY(NamedRiverType, CivilizationType),
        FOREIGN KEY (NamedRiverType) REFERENCES NamedRivers(NamedRiverType) ON DELETE CASCADE ON UPDATE CASCADE,
        FOREIGN KEY (CivilizationType) REFERENCES Civilizations(CivilizationType) ON DELETE CASCADE ON UPDATE CASCADE);
Both of these tables are in the DebugGameplay.sqlite database when Gathering Storm is enabled and running. I see them as valid tables with data in them when I use SQLiteViewer to examine the contents of the InGame "debug" database.

Both BaseGameText and LocalizaedText appear in the DebugLocalization.sqlite database.

Please help someone who doesn't understand. Where should I look for this database and how do I open it? What do you mean by InGame "debug" database?
 
Last edited:
Please help someone who doesn't understand. Where should I look for this database and how do I open it? What do you mean by InGame "debug" database?


What are you trying to do with it? Viewing the database with SQL lite (or similar) is a way of quickly seeing how your sql code effects the database tables. check out this tutorial and I think it will make sense: https://forums.civfanatics.com/threads/tutorial-modding-with-sqllite-studio-pc.608352/


Both BaseGameText and LocalizaedText appear in the DebugLocalization.sqlite database.

I did this, but for me I couldn't find any of the place names in LocalizedText (when using sql lite to browse the debuglocalization database). Nothing with the tag beginning with 'LOC_NAMED...' appeared. Sorry to comment on an old thread, but ive been trying a similar thing to OP. I have added more named rivers, lakes, and seas to the database. It ends up working fine in game, but the only way to test is to go in game. It would be nice to check it in the localised text database
 
The two tables I mentioned are held within the DebugLocalization.sqlite database rather than the DebugGameplay.sqlite or DebugConfiguration.sqlite but the Localization Database is not complete for its contents. It is a copy of the "real" language database the game uses and apparently is not updated to unclude a lot of the stuff from Gathering Storm or Rise and Fall, and does not include stuff added by mods. I mentioned it in my previous post to point out the distinction as to where the various piece-parts of our code are sent from point-of-view of databases.

DebugGameplay.sqlite and DebugConfiguration.sqlite are also copies of the "real" databases the game uses (and to which we are not allowed access) and they are updated to reflect changes made by mods.
 
The two tables I mentioned are held within the DebugLocalization.sqlite database rather than the DebugGameplay.sqlite or DebugConfiguration.sqlite but the Localization Database is not complete for its contents. It is a copy of the "real" language database the game uses and apparently is not updated to unclude a lot of the stuff from Gathering Storm or Rise and Fall, and does not include stuff added by mods. I mentioned it in my previous post to point out the distinction as to where the various piece-parts of our code are sent from point-of-view of databases.

DebugGameplay.sqlite and DebugConfiguration.sqlite are also copies of the "real" databases the game uses (and to which we are not allowed access) and they are updated to reflect changes made by mods.
great, thanks for the explanation!
 
Back
Top Bottom