How to change the name of a civilization during the game?

clausewitz77

Tillito77
Joined
May 14, 2006
Messages
27
Location
Berlin
I am pretty new to modding, but in Civ5, I had created a mod which changed the names of some civilizations when a new era had started. Let's say, Rome became Italy in the industrial era. I want to do the same in Civ6. I think I found out everything I need, except the most basic:

How can I dynamically, I guess in lua, rename a civilization?

In Civ5, I could do:
civInfo.ShortDescription = Locale.ConvertTextKey(newKey)

But here, even after hours of reading posts and looking through other mods, I did not find out how to achieve this in Civ6. The closest I found, was to rename a city, where (in the Rosetta Dynamic City Name mod), I found:
pCity:SetName("New name")
But this exist for cities only, not for civilizations, from what I read.

So, in the end, I would like to change the name for Rome from LOC_CIVILIZATION_ROME_NAME to LOC_CIVILIZATION_ROME_NAME_INDUSTRIAL. Same for Description and Adjective.

For example, is it possible to trigger an SQL update script (SQL file) by lua during the game? Maybe this is done with "criteria" in the project settings? If so, how is it done?

I am really stuck and would be happy about any hint that can point me into the right direction.
 
Last edited:
For example, is it possible to trigger an SQL update script (SQL file) by lua during the game? Maybe this is done with "criteria" in the project settings? If so, how is it done?
This is not possible. Lua cannot affect the database.

There's no equivalent for a player to "City:SetName()"

So far as I know there's no equivalent in civ6 to civ5's "LocalizeAndSetText()" as I recall it was named
 
How would you achieve this then? I mean, to rename a civilization according to the era? Or do you think it is impossible?
 
Well, maybe not *all* files, but at least one included in the others (LeaderIcon.lua for example) and a bit of hacky hijacking of the PlayerConfigurations object...

See the result here
 
I would be also interested in this. And i wonder if Gedemons Code is enough to achieve this...or i really i have to edit several lua files too?

here is Gedemons Code:
Code:
<LeadersGCO>
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="Narmer"            Gender="Male"    StartDate="-3200"    EndDate="-3100"    />
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="Djoser"            Gender="Male"    StartDate="-2686"    EndDate="-2649"    />
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="Snefru"            Gender="Male"    StartDate="-2650"    EndDate="-2550"    />
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="Khufu"            Gender="Male"    StartDate="-2589"    EndDate="-2566"    />
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="Khafre"            Gender="Male"    StartDate="-2560"    EndDate="-2535"    />
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="Pepi II"        Gender="Male"    StartDate="-2278"    EndDate="-2184"    />
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="Senusret I"        Gender="Male"    StartDate="-1971"    EndDate="-1926"    />
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="Ahmose I"        Gender="Male"    StartDate="-1549"    EndDate="-1524"    />
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="Amenhotep I"    Gender="Male"    StartDate="-1525"    EndDate="-1504"    />
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="Thutmose II"    Gender="Male"    StartDate="-1493"    EndDate="-1479"    />
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="Hatshepsut"        Gender="Female"    StartDate="-1478"    EndDate="-1458"    />
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="Akhenaten"        Gender="Male"    StartDate="-1353"    EndDate="-1336"    />
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="Nefertiti"        Gender="Female"    StartDate="-1334"    EndDate="-1332"    />
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="Tutankhamun"    Gender="Male"    StartDate="-1332"    EndDate="-1323"    />
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="Seti I"            Gender="Male"    StartDate="-1290"    EndDate="-1279"    />
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="RamsesII"         Gender="Male"    StartDate="-1279"    EndDate="-1213"    />
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="Merenptah"         Gender="Male"    StartDate="-1000"    EndDate="-1000"    />
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="Twosret"         Gender="Male"    StartDate="-1000"    EndDate="-1000"    />
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="Xerxes I"         Gender="Male"    StartDate="-1000"    EndDate="-1000"    />
    <Row CivilizationType="CIVILIZATION_EGYPT"        LeaderName="Cleopatra"         Gender="Female"    StartDate="-51"        EndDate="-30"    />
</LeadersGCO>
 
That's a new table with the data used, the actual code to set the name (using part of that data) is in those files:
https://github.com/Gedemon/Civ6-GCO/blob/master/Scripts/GCO_PlayerConfig.lua (included in LeaderIcon.lua)
https://github.com/Gedemon/Civ6-GCO/blob/master/Scripts/GCO_PlayerScript.lua (see "function Define(self)")

Names are also based on the existence of name <Tag> with special syntax in the localization file, see "<!-- Government Naming -->" in
https://github.com/Gedemon/Civ6-GCO/blob/master/Text/GameText.xml

Note that the mod itself is not updated for GS patch yet, and that the code use some of the utilities functions integrated in my mod: it can be adapted for another mod, but it's not a simple copy/pasting.

More details in the discussion related to the inclusion of this in my mod here:
https://forums.civfanatics.com/thre...ng-dates-civil-wars-revolutions.624711/page-4
 
Back
Top Bottom