LeeS
Imperator
MAKING CHANGES TO THE FIRAXIS XML: Adding or Altering In-Game Text
(I) Determing Which Text 'Tags' Need to be Altered
In order to modify existing in-game civilopedia and help text, it's necessary to first know which text "tags" are being used by a particular building. This is not as difficult as it might seem. If I look up the current XML of the Workshop building in the file called "CIV5Buildings.xml" (supplied by FIRAXIS), I find the following commands that relate to in-game text:
I can't see any useful reason why I would want to alter the in-game name of the Workshop building, so I would discard the command for that from the list of commands I need to alter. The in-game name of a building will always be the <Description> command, so any time you are altering existing FIRAXIS-supplied buildings, there won't be much need to change the text used by the game for those commands.
Removing the <Description> command leaves a list of the following three commands:
At this point I have two choices on how to proceed:
Choice #1: I simply make up the text I want to have displayed without concerning myself with what the game was using previously.
Choice #2: I find the text the game is currently using for each of these commands, and I alter that pre-existing text as little as possible.
(II) Which Language Table to Use
Code:
<Help>TXT_KEY_BUILDING_WORKSHOP_HELP</Help>
<Description>TXT_KEY_BUILDING_WORKSHOP</Description>
<Civilopedia>TXT_KEY_CIV5_BUILDINGS_WORKSHOP_TEXT</Civilopedia>
<Strategy>TXT_KEY_BUILDING_WORKSHOP_STRATEGY</Strategy>
Removing the <Description> command leaves a list of the following three commands:
Code:
<Help>TXT_KEY_BUILDING_WORKSHOP_HELP</Help>
<Civilopedia>TXT_KEY_CIV5_BUILDINGS_WORKSHOP_TEXT</Civilopedia>
<Strategy>TXT_KEY_BUILDING_WORKSHOP_STRATEGY</Strategy>
Choice #1: I simply make up the text I want to have displayed without concerning myself with what the game was using previously.
Choice #2: I find the text the game is currently using for each of these commands, and I alter that pre-existing text as little as possible.
Regardless of which method I decide to use to add my altered in-game text, I must use one of the "language" tables to do so. In the case of English, which is the only language I know how to speak, read, or write, I use the <Language_en_US> table. If I were bilingual, and also was comfortable with Spanish, I could also make entries in the <Language_ES_ES> table for the Espanol version of the game.
(III) Example Where I Make Up Completely New "Workshop" Text EntriesIf I'm not particularly concerned about what was in-game as part of the Civilopedia, etc., for the Workshop, I can simply make up my own completely new entries for <Help> , <Civilopedia> , and <Strategy> text look-ups. I need to start with the <GameData> command and then I need to open the <Language_en_US> table:
Since I am going to change what FIRAXIS had supplied I use the <Update> command to substitute my new text into the "TEXT_KEY"s that the game previously used:
Then I define where the game is to make the first substitution by entering that I am replacing a text key "Tag", and that the name of the "Tag" I am going to replace is "TXT_KEY_BUILDING_WORKSHOP_HELP". Whether in an update or in an entirely new addition to the game, the language tables use the command Tag="TXT_KEY_something_and_something" to identify which "TXT_KEY_" the XML should refer or write to.
Next I use the "Set" command to tell the game what change to make, and that it needs to change the <Text> it had previously for this language "Tag":
I haven't actually entered the text to be inserted in place of the old text as yet. I've simply created the proper command structure for me to shove the actual text I want displayed in-game. I have to decide what I want the game to display.
Since the earlier examples I showed have changed the yield modification of the Workshop from +10 % production in a city to +20 % production in a city, and I have added +1 Culture as an inherent property of the Workshop I would want to place this information into the "_HELP" tag for the Workshop. I might therefore decide to enter the following text string:
If I'm satisfied that this will be a good text string for the game to use, I paste this in to line #5, as follows:
Now I can close-out this <Update> to the "TXT_KEY_BUILDING_WORKSHOP_HELP" Tag, and in this case I'm going to insert a blank line:
I still have two more <Update> commands to do, so I don't as yet close out the <Language_en_US> table. Since it might be useful to have a note on my mod reminding me what each of these Updates is doing, I might decide to add a human-readable comment between line #2 and #3:
At this point I am going to make the assumption that you are comfortable enough with the concept of closing-out open game tables and open <GameData> commands, so I am not going to add any more descriptive text as to what those sorts of commands are for. I will simply from here on in show these sorts of commands wherever appropriate.
The final two Updates I still need to make are for the Workshop's <Civilopedia> and <Strategy> Tags. I am going to show all of that in one go, including closing out the open table and game data:
What each of these added lines is doing:
# 8 is a human-readable comment to remind me that this update is for the <Civilopedia> entry of the Workshop
# 9 opens an <Update> command for the <Civilopedia> entry of the Workshop
# 10 tells the game which text "tag" to update.
# 11 is the "Set" command that tells the game what new text to use.
# 12 Closes out the open <Update> for the Workshop <Civilopedia> text.
# 13 is a blank line
# 14 is a human-readable comment to remind me that this update is for the <Strategy> entry of the Workshop
# 15 opens an <Update> command for the <Strategy> entry of the Workshop
# 16 tells the game which text "tag" to update.
# 17 is the "Set" command that tells the game what new text to use.
# 18 Closes out the open <Update> for the Workshop <Strategy> text.
# 19 Closes out the open <Language_en_US> table.
# 20 Closes out the open <GameData> command.
Here is the XML I would actually add to my mod, without the line numbers:
I could put this XML code in its own "___.XML" file in the mod, or I could add it to the file I would already have created for the changes I made to the Workshop building. If I place everything in one file, my XML for updating the Workshop would be as follows (click on the spoiler button):
(IV) Example Where I Alter the Existing "Workshop" Text Entries
Code:
1= <GameData>
2= <Language_en_US>
Code:
1= <GameData>
2= <Language_en_US>
3= <Update>
Code:
1= <GameData>
2= <Language_en_US>
3= <Update>
4= <Where Tag="TXT_KEY_BUILDING_WORKSHOP_HELP"/>
Code:
1= <GameData>
2= <Language_en_US>
3= <Update>
4= <Where Tag="TXT_KEY_BUILDING_WORKSHOP_HELP"/>
5= <Set Text=" "/>
Since the earlier examples I showed have changed the yield modification of the Workshop from +10 % production in a city to +20 % production in a city, and I have added +1 Culture as an inherent property of the Workshop I would want to place this information into the "_HELP" tag for the Workshop. I might therefore decide to enter the following text string:
Code:
"Workshops add 20% [ICON_PRODUCTION] to a city's total [ICON_PRODUCTION],
and they also add +1 [ICON_CULTURE] Culture to a city."
Code:
1= <GameData>
2= <Language_en_US>
3= <Update>
4= <Where Tag="TXT_KEY_BUILDING_WORKSHOP_HELP"/>
5= <Set Text="Workshops add 20% [ICON_PRODUCTION] to a city's total [ICON_PRODUCTION],
and they also add +1 [ICON_CULTURE] Culture to a city."/>
Code:
1= <GameData>
2= <Language_en_US>
3= <Update>
4= <Where Tag="TXT_KEY_BUILDING_WORKSHOP_HELP"/>
5= <Set Text="Workshops add 20% [ICON_PRODUCTION] to a city's total [ICON_PRODUCTION],
and they also add +1 [ICON_CULTURE] Culture to a city."/>
6= </Update>
7=
Code:
1= <GameData>
2= <Language_en_US>
2.1= <!-- Update to the "<Help>" text -->
3= <Update>
4= <Where Tag="TXT_KEY_BUILDING_WORKSHOP_HELP"/>
5= <Set Text="Workshops add 20% [ICON_PRODUCTION] to a city's total [ICON_PRODUCTION],
and they also add +1 [ICON_CULTURE] Culture to a city."/>
6= </Update>
7=
The final two Updates I still need to make are for the Workshop's <Civilopedia> and <Strategy> Tags. I am going to show all of that in one go, including closing out the open table and game data:
Code:
1= <GameData>
2= <Language_en_US>
2.1= <!-- Update to the "<Help>" text -->
3= <Update>
4= <Where Tag="TXT_KEY_BUILDING_WORKSHOP_HELP"/>
5= <Set Text="Workshops add 20% [ICON_PRODUCTION] to a city's total [ICON_PRODUCTION],
and they also add +1 [ICON_CULTURE] Culture to a city."/>
6= </Update>
7=
8= <!-- Update to the "<Civilopedia>" text -->
9= <Update>
10= <Where Tag="TXT_KEY_CIV5_BUILDINGS_WORKSHOP_TEXT"/>
11= <Set Text="A workshop is a building dedicated to constructing stuff. It boosts a city's
overall production."/>
12= </Update>
13=
14= <!-- Update to the "<Strategy>" text -->
15= <Update>
16= <Where Tag="TXT_KEY_BUILDING_WORKSHOP_STRATEGY"/>
17= <Set Text="The Workshop speeds a city's [ICON_PRODUCTION] Production by 20%. Allows
[ICON_PRODUCTION] Production trade routes"/>
18= </Update>
19= </Language_en_US>
20= </GameData>
# 8 is a human-readable comment to remind me that this update is for the <Civilopedia> entry of the Workshop
# 9 opens an <Update> command for the <Civilopedia> entry of the Workshop
# 10 tells the game which text "tag" to update.
# 11 is the "Set" command that tells the game what new text to use.
# 12 Closes out the open <Update> for the Workshop <Civilopedia> text.
# 13 is a blank line
# 14 is a human-readable comment to remind me that this update is for the <Strategy> entry of the Workshop
# 15 opens an <Update> command for the <Strategy> entry of the Workshop
# 16 tells the game which text "tag" to update.
# 17 is the "Set" command that tells the game what new text to use.
# 18 Closes out the open <Update> for the Workshop <Strategy> text.
# 19 Closes out the open <Language_en_US> table.
# 20 Closes out the open <GameData> command.
Here is the XML I would actually add to my mod, without the line numbers:
Code:
<GameData>
<Language_en_US>
<!-- Update to the "<Help>" text -->
<Update>
<Where Tag="TXT_KEY_BUILDING_WORKSHOP_HELP"/>
<Set Text="Workshops add 20% [ICON_PRODUCTION] to a city's total [ICON_PRODUCTION],
and they also add +1 [ICON_CULTURE] Culture to a city."/>
</Update>
<!-- Update to the "<Civilopedia>" text -->
<Update>
<Where Tag="TXT_KEY_CIV5_BUILDINGS_WORKSHOP_TEXT"/>
<Set Text="A workshop is a building dedicated to construction in a city. It boosts
a city's overall production."/>
</Update>
<!-- Update to the "<Strategy>" text -->
<Update>
<Where Tag="TXT_KEY_BUILDING_WORKSHOP_STRATEGY"/>
<Set Text="The Workshop speeds a city's [ICON_PRODUCTION] Production by 20%. Allows
[ICON_PRODUCTION] Production trade routes"/>
</Update>
</Language_en_US>
</GameData>
Spoiler :
Code:
<GameData>
<Building_YieldModifiers>
<Update>
<Where BuildingType="BUILDING_WORKSHOP" YieldType="YIELD_PRODUCTION"/>
<Set Yield="20"/>
</Update>
</Building_YieldModifiers>
<Building_YieldChanges>
<Row>
<BuildingType>BUILDING_WORKSHOP</BuildingType>
<YieldType>YIELD_CULTURE</YieldType>
<Yield>1</Yield>
</Row>
</Building_YieldChanges>
<Language_en_US>
<!-- Update to the "<Help>" text -->
<Update>
<Where Tag="TXT_KEY_BUILDING_WORKSHOP_HELP"/>
<Set Text="Workshops add 20% [ICON_PRODUCTION] to a city's total [ICON_PRODUCTION], and they also add +1 [ICON_CULTURE] Culture to a city."/>
</Update>
<!-- Update to the "<Civilopedia>" text -->
<Update>
<Where Tag="TXT_KEY_CIV5_BUILDINGS_WORKSHOP_TEXT"/>
<Set Text="A workshop is a building dedicated to construction in a city. It boosts a city's overall production."/>
</Update>
<!-- Update to the "<Strategy>" text -->
<Update>
<Where Tag="TXT_KEY_BUILDING_WORKSHOP_STRATEGY"/>
<Set Text="The Workshop speeds a city's [ICON_PRODUCTION] Production by 20%. Allows [ICON_PRODUCTION] Production trade routes"/>
</Update>
</Language_en_US>
</GameData>
In order to change the existing <Help>, <Strategy>, and <Civilopedia> as little as necessary to inform the player of the new effects of the Workshop building, I need to know what exactly is the pre-existing text used by the game. Instead of hunting around in a myriad different files supplied by FIRAXIS to find this information, you can simply use this file called "Text_Buildings.XML" . I believe I have hunted down all the text string "tags" related to buildings and I have copied them into "Text_Buildings.XML".
If I want to find the existing in-game text tag commands for the Workshop's <Help>, <Civilopedia>, and <Strategy> Tags I can do a "find" in notepad for TXT_KEY_BUILDING_WORKSHOP_HELP, TXT_KEY_CIV5_BUILDINGS_WORKSHOP_TEXT, and TXT_KEY_BUILDING_WORKSHOP_STRATEGY. Doing so, I find the following (I have reformatted the commands slightly to make the text more readable):
Looking at these three sets of text commands, I would most likely conclude that I really only need to change the first one, for TXT_KEY_BUILDING_WORKSHOP_HELP. Further, I might decide I really don't need to add any text about the +1 Culture I have added to the workshop, since the game always shows the yields that are inherent to the building when a player mouses over the name of the building in city build lists, etc. So all I really need to do is add a note about the change to +20 % production in a city instead of the normal +10 %. So, this is what I would use for my <Language_en_US> table:
I purposefully reformatted the appearance of the new "Text" entry above to make it a little easier for you to read. I would probably actually enter it into my mod as follows. Either way will work.
I generally always look at what is in the game before I alter it, because this will often lead me to the conclusion that I don't need to do anything to one or more of the existing text strings related to a building.
If I want to find the existing in-game text tag commands for the Workshop's <Help>, <Civilopedia>, and <Strategy> Tags I can do a "find" in notepad for TXT_KEY_BUILDING_WORKSHOP_HELP, TXT_KEY_CIV5_BUILDINGS_WORKSHOP_TEXT, and TXT_KEY_BUILDING_WORKSHOP_STRATEGY. Doing so, I find the following (I have reformatted the commands slightly to make the text more readable):
Spoiler :
Code:
<Row Tag="TXT_KEY_BUILDING_WORKSHOP_HELP">
<Text>Allows [ICON_PRODUCTION] Production to be moved from this city along trade routes inside your civilization.</Text>
</Row>
<Row Tag="TXT_KEY_CIV5_BUILDINGS_WORKSHOP_TEXT">
<Text>
A workshop is a building dedicated to constructing stuff. It would contain raw materials, tools, and the skilled labor
to build whatever was needed. A pottery workshop would create pottery (unsurprisingly), while a carpentry workshop might
construct doors, cabinets, floors - anything wooden. In Renaissance Italy, many artists worked in workshops, where a great
painter might take credit for a painting that was in fact painted by his employees and students who had learned to accurately
mimic his style, a practice which gives art collectors and historians headaches even today.
</Text>
</Row>
<Row Tag="TXT_KEY_BUILDING_WORKSHOP_STRATEGY">
<Text>The Workshop speeds a city's [ICON_PRODUCTION] Production.</Text>
</Row>
Looking at these three sets of text commands, I would most likely conclude that I really only need to change the first one, for TXT_KEY_BUILDING_WORKSHOP_HELP. Further, I might decide I really don't need to add any text about the +1 Culture I have added to the workshop, since the game always shows the yields that are inherent to the building when a player mouses over the name of the building in city build lists, etc. So all I really need to do is add a note about the change to +20 % production in a city instead of the normal +10 %. So, this is what I would use for my <Language_en_US> table:
Spoiler :
Code:
<GameData>
<Language_en_US>
<!-- Update to the "<Help>" text -->
<Update>
<Where Tag="TXT_KEY_BUILDING_WORKSHOP_HELP"/>
<Set Text="Allows [ICON_PRODUCTION] Production to be moved from this city along trade routes inside your civilization.
[NEWLINE]Workshops add 20% to a city's total [ICON_PRODUCTION]."/>
</Update>
</Language_en_US>
</GameData>
Spoiler :
Code:
<GameData>
<Language_en_US>
<!-- Update to the "<Help>" text -->
<Update>
<Where Tag="TXT_KEY_BUILDING_WORKSHOP_HELP"/>
<Set Text="Allows [ICON_PRODUCTION] Production to be moved from this city along trade routes inside your civilization.[NEWLINE]Workshops add 20% to a city's total [ICON_PRODUCTION]."/>
</Update>
</Language_en_US>
</GameData>