BrentRitchie
Oct 30, 2005, 08:33 PM
Ok, in the first tutorial we went through and changed alot of options in the CIV4CivilizationInfos.xml file. This will make the civilization available but we didn't really add much information. Remember the Description, short description, adjective, and civilopedia tags? Well all we did was tell the game where to find the correct information. Now we will actually create this information.
So the folder that holds all of the text in the game is in the Assets/XML/Text folder. The file that holds all of the short identifying text (Like unit names and such) is CIV4GameTextInfos_Objects.xml. We need to create 3 new entries one for each of the descriptions and one for the adjective.
Now before we actually start modding you must realize that Civ 4 was released world wide. So these files in the text folder actually define *ALL* of the languages that are supported. Something really interesting though is the fact that this folder lacks a schema. This means we could add Language support for any language we want including the cool ones like Klingon ;).
Ok, so we have the file open. Lets look at the first entry. BTW I have inlined the comments for this code again.
<!-- Create the new text element -->
<!-- you need to define a new text element for *every* tag made -->
<TEXT>
<!-- This is where we define those refrences we made before -->
<!-- One of our refrences were TXT_KEY_CIV_CANADA_TEXT -->
<Tag>TXT_KEY_IMPROVEMENT_LAND_WORKED</Tag>
<!-- This tag looks a little different then the ones below thats because the english language is asexual in nature -->
<!-- Being asexual we don't have to have different sentence structures to say the same thing like french -->
<!-- If you have your game settings to english this is the text that will show up -->
<!-- Nothing fancy just plain english -->
<English>Land Worked</English>
<!-- This tag tells the game that this is the french language description -->
<!-- you could just as easily write <Klingon> and the game would not care because of the lack of a schema -->
<French>
<!-- This is the text that will appear if the french language option is selected -->
<Text>En travaux</Text>
<!-- This tag is a little wierd, because in french and other languages words have genders -->
<!-- In this case "En Traveux" is male, this effects the words that appear around this text -->
<Gender>Male</Gender>
<!-- This simply states if the word is in plural form -->
<Plural>0</Plural>
<!-- End french language definition -->
</French>
<!-- Start German language definition -->
<!-- this is as far as I go I don't want to repeat myself three more times -->
<!-- you should get the basic idea for now -->
<German>
<Text>Bearbeitetes Land</Text>
<Gender>Male</Gender>
<Plural>0</Plural>
</German>
<Italian>
<Text>Terreno bonificato:Terreni bonificati</Text>
<Gender>Male</Gender>
<Plural>0</Plural>
</Italian>
<Spanish>
<Text>Tierra trabajada:Tierras trabajadas</Text>
<Gender>Female</Gender>
<Plural>0:1</Plural>
</Spanish>
</TEXT>
OK, so now we know the basic structure, lets start adding our definitions.
I like to add my definitions inside the files in alphabetical order, but you can add this stuff anywhere you want I suggest for this tutorial you just add it at the end of the file after the last </TEXT> tag but before the </Civ4GameText>.
So We'll add the descriptions in order, first is the TXT_KEY_CIV_AMERICA_DESC.
Add this:
Remember this is the Long or standard description, you see this at the leader select screen.
<TEXT>
<Tag>TXT_KEY_CIV_CANADA_DESC</Tag>
<English>Canadian Empire</English>
</TEXT>
This is fairly trivial and what it means is that when the game is set to english anywhere you refrence TXT_KEY_CIV_CANADA_DESC the phrase "Canadian Empire" will replace it. If you use a different language then there will be no description. I don't know french or anyother language that well so if somebody could help me translate these things that would be appreciated.
The next two entries are as follows:
<TEXT>
<Tag>TXT_KEY_CIV_CANADA_SHORT_DESC</Tag>
<English>Canada</English>
</TEXT>
<TEXT>
<Tag>TXT_KEY_CIV_CANADA_ADJECTIVE</Tag>
<English>Canadian</English>
</TEXT>
Remeber there is no schema so I can put in or leave out as many languages as I want.
Next is kind of cool. Remember the tag <Civilopedia>? This tag allows our civ to have a civilopedia entry of it's own. I think thats a nice touch. Now we are done with the CIV4GameTextInfos_Objects.xml file, We now have to open the CIV4GameText_Civilopedia_CivLeaders.xml. This holds all of the text for the civilopedia that relates to Civs and their leaders. If you glance through it you will see that this is just the text that shows up in the civilopedia and it has the same structure as the text object file. So I don't think that this part really needs an explanation. at the end of the file after the last </TEXT> tag and before the </Civ4GameText> tag add the following:
<TEXT>
<Tag>TXT_KEY_CIV_CANADA_PEDIA</Tag>
<English>*****Testing Canadian Mod</English>
</TEXT>
<TEXT>
<Tag>TXT_KEY_LEADER_JOHN_MACDONALD_PEDIA</Tag>
<English>[H1]John A. Macdonald [\H1][NEWLINE][BOLD]Prime Minister of Canada [\BOLD][NEWLINE][BOLD]Lived: [\BOLD] c. ???? - c. ???? BC[NEWLINE][PARAGRAPH:2][BOLD]Background:[\BOLD][NEWLINE]*****John A. Macdonald Played a major role in Canada's confederation. Through many meetings he finally joined upper and lower Canada to create the two provinces Quebec and Ontario.</English>
</TEXT>
Ok I said I wasn't going to explain the XML, so I won't. But I will explain the embedded tags. These tags are nothing more then HTML enclosed in square brackets instead of pointy brackets. HTML isn't necessary for modding civ 4 but it makes everything more interesting. So I would say take a crash course in basic HTML to add some flavor to your Civilopedia texts.
We now are looking at the <DefaultPlayerColor> tag. All we did was set it to red. But what if we wanted to add our own custom color? well color definitions can be found in the Assets/XML/Interface/ folder in the file CIV4ColorVals.xml. Color definitions are very straight forward. Take COLOR_CLEAR for example:
<!-- This starts the color definition -->
<ColorVal>
<!-- This is how we refrence the color -->
<!-- We should follow the naming scheme because it makes life easier -->
<Type>COLOR_CLEAR</Type>
<!-- This tells us the intensity of the red in this color. 0.00 is no red, 1.00 is ful intensity -->
<!-- It is *Very* important to use numbers in the format 0.00 or else the game will act funny or not even load -->
<!-- You must keep the values between 0.00 and 1.00 or the game will either act funny of crash -->
<fRed>1.00</fRed>
<!-- Tells us the intensity of green used for the color -->
<fGreen>1.00</fGreen>
<!-- Tells us the intensity of blue used for the color -->
<fBlue>1.00</fBlue>
<!-- This tag tells us how transparent the color is. -->
<!-- 1.0 means that the color is totally opaque, 0.0 means invisible -->
<fAlpha>0.00<fAlpha>
<!-- end color definition -->
</ColorVal>
Thats it for colors, Now I want to see someone implement every color they know ;)
I will skip the ArtDefineTag and ArtStyleTag because they deserve their own tutorial.
Now on to defining cities, these definitions go in the text directory in the CIV4GameTextInfos_Cities.xml file. There isn't anything new here so I will just add the St. Johns city definition we did in the last tutorial.
<TEXT>
<Tag>TXT_KEY_CITY_NAME_ST_JOHNS</Tag>
<English>St.John's</English>
</TEXT>
For every city you add in the cities list of your civ there has to be an accomponying definition in the CIV4GameTextInfos_Cities.xml file.
Thats it for adding the text entries for your civ. In the next tutorial I will explain how to add the John A Macdonald Leader for your new civ. If you want to play test you can use the Leader definition from Another civ.
So the folder that holds all of the text in the game is in the Assets/XML/Text folder. The file that holds all of the short identifying text (Like unit names and such) is CIV4GameTextInfos_Objects.xml. We need to create 3 new entries one for each of the descriptions and one for the adjective.
Now before we actually start modding you must realize that Civ 4 was released world wide. So these files in the text folder actually define *ALL* of the languages that are supported. Something really interesting though is the fact that this folder lacks a schema. This means we could add Language support for any language we want including the cool ones like Klingon ;).
Ok, so we have the file open. Lets look at the first entry. BTW I have inlined the comments for this code again.
<!-- Create the new text element -->
<!-- you need to define a new text element for *every* tag made -->
<TEXT>
<!-- This is where we define those refrences we made before -->
<!-- One of our refrences were TXT_KEY_CIV_CANADA_TEXT -->
<Tag>TXT_KEY_IMPROVEMENT_LAND_WORKED</Tag>
<!-- This tag looks a little different then the ones below thats because the english language is asexual in nature -->
<!-- Being asexual we don't have to have different sentence structures to say the same thing like french -->
<!-- If you have your game settings to english this is the text that will show up -->
<!-- Nothing fancy just plain english -->
<English>Land Worked</English>
<!-- This tag tells the game that this is the french language description -->
<!-- you could just as easily write <Klingon> and the game would not care because of the lack of a schema -->
<French>
<!-- This is the text that will appear if the french language option is selected -->
<Text>En travaux</Text>
<!-- This tag is a little wierd, because in french and other languages words have genders -->
<!-- In this case "En Traveux" is male, this effects the words that appear around this text -->
<Gender>Male</Gender>
<!-- This simply states if the word is in plural form -->
<Plural>0</Plural>
<!-- End french language definition -->
</French>
<!-- Start German language definition -->
<!-- this is as far as I go I don't want to repeat myself three more times -->
<!-- you should get the basic idea for now -->
<German>
<Text>Bearbeitetes Land</Text>
<Gender>Male</Gender>
<Plural>0</Plural>
</German>
<Italian>
<Text>Terreno bonificato:Terreni bonificati</Text>
<Gender>Male</Gender>
<Plural>0</Plural>
</Italian>
<Spanish>
<Text>Tierra trabajada:Tierras trabajadas</Text>
<Gender>Female</Gender>
<Plural>0:1</Plural>
</Spanish>
</TEXT>
OK, so now we know the basic structure, lets start adding our definitions.
I like to add my definitions inside the files in alphabetical order, but you can add this stuff anywhere you want I suggest for this tutorial you just add it at the end of the file after the last </TEXT> tag but before the </Civ4GameText>.
So We'll add the descriptions in order, first is the TXT_KEY_CIV_AMERICA_DESC.
Add this:
Remember this is the Long or standard description, you see this at the leader select screen.
<TEXT>
<Tag>TXT_KEY_CIV_CANADA_DESC</Tag>
<English>Canadian Empire</English>
</TEXT>
This is fairly trivial and what it means is that when the game is set to english anywhere you refrence TXT_KEY_CIV_CANADA_DESC the phrase "Canadian Empire" will replace it. If you use a different language then there will be no description. I don't know french or anyother language that well so if somebody could help me translate these things that would be appreciated.
The next two entries are as follows:
<TEXT>
<Tag>TXT_KEY_CIV_CANADA_SHORT_DESC</Tag>
<English>Canada</English>
</TEXT>
<TEXT>
<Tag>TXT_KEY_CIV_CANADA_ADJECTIVE</Tag>
<English>Canadian</English>
</TEXT>
Remeber there is no schema so I can put in or leave out as many languages as I want.
Next is kind of cool. Remember the tag <Civilopedia>? This tag allows our civ to have a civilopedia entry of it's own. I think thats a nice touch. Now we are done with the CIV4GameTextInfos_Objects.xml file, We now have to open the CIV4GameText_Civilopedia_CivLeaders.xml. This holds all of the text for the civilopedia that relates to Civs and their leaders. If you glance through it you will see that this is just the text that shows up in the civilopedia and it has the same structure as the text object file. So I don't think that this part really needs an explanation. at the end of the file after the last </TEXT> tag and before the </Civ4GameText> tag add the following:
<TEXT>
<Tag>TXT_KEY_CIV_CANADA_PEDIA</Tag>
<English>*****Testing Canadian Mod</English>
</TEXT>
<TEXT>
<Tag>TXT_KEY_LEADER_JOHN_MACDONALD_PEDIA</Tag>
<English>[H1]John A. Macdonald [\H1][NEWLINE][BOLD]Prime Minister of Canada [\BOLD][NEWLINE][BOLD]Lived: [\BOLD] c. ???? - c. ???? BC[NEWLINE][PARAGRAPH:2][BOLD]Background:[\BOLD][NEWLINE]*****John A. Macdonald Played a major role in Canada's confederation. Through many meetings he finally joined upper and lower Canada to create the two provinces Quebec and Ontario.</English>
</TEXT>
Ok I said I wasn't going to explain the XML, so I won't. But I will explain the embedded tags. These tags are nothing more then HTML enclosed in square brackets instead of pointy brackets. HTML isn't necessary for modding civ 4 but it makes everything more interesting. So I would say take a crash course in basic HTML to add some flavor to your Civilopedia texts.
We now are looking at the <DefaultPlayerColor> tag. All we did was set it to red. But what if we wanted to add our own custom color? well color definitions can be found in the Assets/XML/Interface/ folder in the file CIV4ColorVals.xml. Color definitions are very straight forward. Take COLOR_CLEAR for example:
<!-- This starts the color definition -->
<ColorVal>
<!-- This is how we refrence the color -->
<!-- We should follow the naming scheme because it makes life easier -->
<Type>COLOR_CLEAR</Type>
<!-- This tells us the intensity of the red in this color. 0.00 is no red, 1.00 is ful intensity -->
<!-- It is *Very* important to use numbers in the format 0.00 or else the game will act funny or not even load -->
<!-- You must keep the values between 0.00 and 1.00 or the game will either act funny of crash -->
<fRed>1.00</fRed>
<!-- Tells us the intensity of green used for the color -->
<fGreen>1.00</fGreen>
<!-- Tells us the intensity of blue used for the color -->
<fBlue>1.00</fBlue>
<!-- This tag tells us how transparent the color is. -->
<!-- 1.0 means that the color is totally opaque, 0.0 means invisible -->
<fAlpha>0.00<fAlpha>
<!-- end color definition -->
</ColorVal>
Thats it for colors, Now I want to see someone implement every color they know ;)
I will skip the ArtDefineTag and ArtStyleTag because they deserve their own tutorial.
Now on to defining cities, these definitions go in the text directory in the CIV4GameTextInfos_Cities.xml file. There isn't anything new here so I will just add the St. Johns city definition we did in the last tutorial.
<TEXT>
<Tag>TXT_KEY_CITY_NAME_ST_JOHNS</Tag>
<English>St.John's</English>
</TEXT>
For every city you add in the cities list of your civ there has to be an accomponying definition in the CIV4GameTextInfos_Cities.xml file.
Thats it for adding the text entries for your civ. In the next tutorial I will explain how to add the John A Macdonald Leader for your new civ. If you want to play test you can use the Leader definition from Another civ.