How to change Text & Audio (update base game)

Psychalgia

Chieftain
Joined
Jan 15, 2017
Messages
7
Location
Indiana, USA
After creating a mod I found myself annoyed with the descriptions of some of the units that I changed. I saw that the values did not reflect what was showing in their descriptions (popup and in civilopedia). So I set out to change these descriptions but had no ideal how to update them. After searching online for some insight I found some examples for civ5 but not civ6. Trying the examples for civ5 did not work on civ6.

I found myself digging through the base game lua scripts trying to find answers. Finding only fragments of clues I began trial and error. Assuming the logic behind the lua and the programming I finally, after many hours, had successfully updated the base text for those units I modded.

So I share my findings to you.

  1. Selecting the Table to update.

    Language tables and keys
    • Languages.........................PRIMARY KEY('Locale'),
    • AudioLanguages................PRIMARY KEY('Locale'),
    • DefaultAudioLanguages....PRIMARY KEY('Locale'),
    • SteamLanguages..............PRIMARY KEY('SteamLanguage'),
    • LanguagePriorities............PRIMARY KEY('PrimaryLanguage'),
    • LocalizedText....................PRIMARY KEY('Language'),
    • FontStyleSheets................PRIMARY KEY('Language'),
    Source: ..\Sid Meier's Civilization VI\Base\Assets\Text\LocalizationDatabase_Schema.lua

    All Tables require the table 'Key' attribute (parameter). If no Key is specified it will result in an error, that is observable in the log files, and will not load.

    What is the Key? It is the Language you are updating. So for example the key for the US English language is 'en_US'.

  2. Text & Audio Xml Structure

    The question now is how to access the table and supply the parameters.

    Structure
    Code:
    <GameData>
         <TABLE PRIMARY_KEY='LANGUAGE_NAME'>
         </TABLE>
    </GameData>
    With this structure you can access the base game language tables.

    Usage
    Code:
    -- Genaric Example--
    
    <GameData>
         <LocalizedText Language='en_US'>
         </LocalizedText>
    </GameData>
    This is a functional code example (however it does nothing).

    Where:
    -TABLE is 'LocalizedText '
    -PRIMARY_KEY for 'LocalizedText' table is 'Language'
    -Key value for the language is 'en_US'​

  3. Updating an Object

    So how do we change the existing text data for an object in the language table.

    Structure
    Code:
    <GameData>
         <TABLE PRIMARY_KEY='LANGUAGE_NAME'>
              <Update>
                   <Where OBJECT_TYPE='OBJECT_NAME'/>
                   <SET OBJECT_ATTRIBUTE='VALUE'/> 
              </Update>
         </TABLE>
    </GameData>

    Usage
    Code:
    -- TextExample.xml --
    
    <GameData>
         <LocalizedText Language='en_US'>
               <Update>
                   <Where Tag="LOC_UNIT_BUILDER_DESCRIPTION"/>
                   <Set Text='This object's description has been changed.'/>
              </Update>
         </LocalizedText>
    </GameData>
    
    --OR--
    
    <GameData>
         <LocalizedText Language='en_US'>
               <Update>
                   <Where Tag="LOC_UNIT_BUILDER_DESCRIPTION"/>
                   <Set>
                        <Text>This object's description has been changed.</Text>
                   </Set>
              </Update>
         </LocalizedText>
    </GameData>
    This is a working example on changing an object's text (observable in Civilopedia).

  4. MODINFO File Structure

    So now that an object has been changed how do this in our MODINFO file.

    Code:
    -- MyTextMod.modinfo --
    
    <?xml version="1.0" encoding="utf-8"?>
    <Mod id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" version="1">
         <Properties>
              <Name>Civ VI Text Example</Name>
              <Stability>Beta</Stability>
              <Teaser>Changes Text</Teaser>
              <Description>Changes Text</Description>
              <Authors>Psychalgia</Authors>
         </Properties>
    
         <Files>
              <File>TextExample.xml</File>
         </Files>
     
         <Components>
              <LocalizedText id="EXAMPLE_TEXT">
                   <Properties>
                        <RuleSet>RULESET_STANDARD</RuleSet>
                   </Properties>
                   <Items>
                        <File>TextExample.xml</File>
                   </Items>
              </LocalizedText>
         </Components>
    </Mod>
    This is not a functional example as it needs a valid GUID (id).


    Note: You must place the text xml file in the <LocalizedText> structure within the <Components> structure. The text changes will not work if you place it in the <UpdateDatabase> structure.


    -Final Thoughts-
    This tutorial only shows how to change existing object text. However the principles outlined should work for changing the audio as well.

    I look forward to seeing modders become inspired to update the vanilla text (emojis maybe?) and audio.
 
interesting, I hope to use this to add some custom audio soon, thanks.
 
Text at least appears to be fixed by choosing update text options now. I did this both with and without setting properties on the import to Ruleset RULESET_STANDARD

Code:
<GameData>
        <LocalizedText Language='en_US'>
            <Update>
                <Where Tag="LOC_LEADER_BARBAROSSA_NAME"/>
                <Set>
                    <Text>This object&apos;s description has been changed.</Text>
                </Set>
            </Update>
        </LocalizedText>
</GameData>
 
Top Bottom