Adding New Tech Quotes

Vokarya

Deity
Joined
Mar 25, 2011
Messages
6,241
OK, since there are several of us modders who are going to be adding tech quotes (text or audio), I have gone and written up a guide to adding a new tech quote. I'm creating a separate thread because this is going to be rather long, quite technical, and I don't want to clutter up the existing threads. We can use those threads for discussing which new quotes to use.

Adding Text
Adding a new text quote is the simpler of the two parts. There are four steps to creating a text quote.

First: Find the technology for which you want to add a quote. This is what I have done to find a tech needing a quote:
  • Navigate to caveman2cosmos\Assets\XML\Technologies.
  • Open CIV4TechInfos.xml in a text editor. I use Notepad2, but any text editor will work.
  • Reduce the text size so that you can see everything between <TechInfo> and </TechInfo> for one entire tech. You'll need pretty small text and a big monitor to do this efficiently, but you can do this by scrolling up and down as well.
  • Search for <Quote>TXT_KEY_TECH_ in order to see each technology's quote tag.
  • You should be able to see where a technology's name and its quote do not match. This is a tech that is a possibility for a new quote.
  • Alternatively, if you are in the Civilopedia, you may see a quote that just says TBD. These are also good targets for replacement.

Example:
I want to add a new quote for Television. As I search for <Quote>TXT_KEY_TECH_, I notice that Television has the following:
Code:
<Quote>TXT_KEY_TECH_MASS_MEDIA_QUOTE</Quote>
which means that Television is using Mass Media's quote, so that makes it a good technology for a new quote.

Second: Find a quote appropriate to the new technology. It can be respectful, pithy, funny, or anything else you feel fits. You should try to keep the quote short, and you should attribute it if possible.

Example:
Continuing with the Television example, I search Wikiquote for television and find this classic, with attribution (although it is on his page, http://en.wikiquote.org/wiki/Ernie_Kovacs, and not the Television page, http://en.wikiquote.org/wiki/Television):
"Television is a medium, so called because it is neither rare nor well-done." - Ernie Kovacs

Third: Return to caveman2cosmos\Assets\XML\Technologies\CIV4TechInfos.xml and change the <Quote> tag so it reads something different. Quote tags are generally named TXT_KEY_TECH_***_QUOTE, where *** is the name of the technology. This helps keep them straight, as two quotes shouldn't be using the same tag.

Example:
Continuing again, I change the text of Television's Quote tag to read:
Code:
<Quote>TXT_KEY_TECH_TELEVISION_QUOTE</Quote>

Fourth: Add the text for the quote. To do this, you can either add the appropriate code to any existing file in caveman2cosmos\Assets\XML\Text, or you can create your own text file by copying one of the existing files, renaming it (as long as the file name ends with .xml), and deleting everything between <Civ4GameText xmlns="http://www.firaxis.com"> and </Civ4GameText>. This is the code you will need to insert before the </Civ4GameText>:
Code:
<TEXT>
	<Tag></Tag>
	<English></English>
	<French></French>
	<German></German>
	<Italian></Italian>
	<Spanish></Spanish>
</TEXT>
You will need one of these for each quote you want to include. The TXT_KEY_TECH_***_QUOTE you added to CIV4TechInfos.xml goes between <Tag> and </Tag>. Your quote goes between <English> and </English>. Once you add your quote, the C2C translators will add the translations.

Certain characters don't work in XML. These are called escape characters. There are supposedly five of them and if your quote has any of them, you need to replace it with the string on the right or the XML will choke.
" | &quot;
'| &apos;
<| &lt;
>| &gt;
&| &amp;
I haven't had any problems with the apostrophe, and I haven't used the less-than or greater-than signs, but I would definitely use &quot; in place of " and &amp; in place of &.

If a tech is using a TBD quote and already has a unique tag, you will instead have to find which file in caveman2cosmos\Assets\XML\Text is using that tag and place your new quote in that file.

Example:
Continuing with the Television example, I add this to the caveman2cosmos\Assets\XML\Text\Vokarya_Tech_Quotes.xml file.
Code:
<TEXT>
	<Tag>TXT_KEY_TECH_TELEVISION_QUOTE</Tag>
	<English>&quot;Television is a medium, so called because it is neither rare nor well-done.&quot; - Ernie Kovacs</English>
	<French></French>
	<German>  </German>
	<Italian>  </Italian>
	<Spanish>  </Spanish>
</TEXT>

Then you're done adding the text quote. I would at this point check your work by loading up Caveman 2 Cosmos. If you did it right, it should look like this:

Civ4ScreenShot0001.JPG

Adding Audio
Audio files will be needed for any tech quote for which you added a new quote or any tech quote that is currently using in its XML:
Code:
<Sound>AS2D_TECH_GENERIC</Sound>

You will need an mp3 file of the quote. I think all tech quotes are mp3 files and background sounds are wav files.

First: Copy the mp3 file to caveman2cosmos\Assets\Sounds\Tech.

You will have to edit three files:
  • caveman2cosmos\Assets\XML\Audio\AudioDefines.xml
  • caveman2cosmos\Assets\XML\Audio\Audio2DScripts.xml
  • caveman2cosmos\Assets\XML\Technologies\CIV4TechInfos.xml

Second: The AudioDefines.xml file is for telling the game where to find the sound file. You will need one of these for each audio quote:
Code:
<SoundData>
	<SoundID>SND_TECH_***</SoundID>
	<Filename>Sounds/Tech/***</Filename>
	<LoadType>DYNAMIC_RES</LoadType>
	<bIsCompressed>1</bIsCompressed>
	<bInGeneric>1</bInGeneric>
</SoundData>
The first *** is the name of the technology. The second *** is the exact name of the sound file, without the extension. Don't change anything else. Copy and paste this code into the AudioDefines.xml file, just before the </SoundDatas>. There's only one </SoundDatas> in AudioDefines.xml, so you should be able to find it with a search using a text editor. Then add in the appropriate names.

Example:
Back to Television again. For this example, say I have a file named Television.mp3 and I've already copied it to caveman2cosmos\Assets\Sounds\Tech. I edit AudioDefines.xml with this:
Code:
<SoundData>
	<SoundID>SND_TECH_TELEVISION</SoundID>
	<Filename>Sounds/Tech/Television</Filename>
	<LoadType>DYNAMIC_RES</LoadType>
	<bIsCompressed>1</bIsCompressed>
	<bInGeneric>1</bInGeneric>
</SoundData>

Third: The Audio2DScripts.xml file tells the game how to play the sound file. This is the code to add to the file:
Code:
<Script2DSound>
	<ScriptID>AS2D_TECH_***</ScriptID>
	<SoundID>SND_TECH_***</SoundID>
	<SoundType>GAME_SPEECH</SoundType>
	<iMinVolume>100</iMinVolume>
	<iMaxVolume>100</iMaxVolume>
	<iPitchChangeDown>0</iPitchChangeDown>
	<iPitchChangeUp>0</iPitchChangeUp>
	<iMinLeftPan>-1</iMinLeftPan>
	<iMaxLeftPan>-1</iMaxLeftPan>
	<iMinRightPan>-1</iMinRightPan>
	<iMaxRightPan>-1</iMaxRightPan>
	<bLooping>0</bLooping>
	<iMinTimeDelay>0</iMinTimeDelay>
	<iMaxTimeDelay>0</iMaxTimeDelay>
	<bTaperForSoundtracks>0</bTaperForSoundtracks>
	<iLengthOfSound>0</iLengthOfSound>
	<fMinDryLevel>1.0</fMinDryLevel>
	<fMaxDryLevel>1.0</fMaxDryLevel>
	<fMinWetLevel>0.0</fMinWetLevel>
	<fMaxWetLevel>0.0</fMaxWetLevel>
	<iNotPlayPercent>0</iNotPlayPercent>
</Script2DSound>

You will need one of these for each tech quote. Insert one copy of this per quote at the end of Audio2DScripts.xml, just before the </Script2DSounds> at the end. You have to fill in both *** with the name of the technology you are using, just like you did for AudioDefines.xml.

Example:
Television again. I open up Audio2DScripts.xml and add this to the end:
Code:
<Script2DSound>
	<ScriptID>AS2D_TECH_TELEVISION</ScriptID>
	<SoundID>SND_TECH_TELEVISION</SoundID>
	<SoundType>GAME_SPEECH</SoundType>
	<iMinVolume>100</iMinVolume>
	<iMaxVolume>100</iMaxVolume>
	<iPitchChangeDown>0</iPitchChangeDown>
	<iPitchChangeUp>0</iPitchChangeUp>
	<iMinLeftPan>-1</iMinLeftPan>
	<iMaxLeftPan>-1</iMaxLeftPan>
	<iMinRightPan>-1</iMinRightPan>
	<iMaxRightPan>-1</iMaxRightPan>
	<bLooping>0</bLooping>
	<iMinTimeDelay>0</iMinTimeDelay>
	<iMaxTimeDelay>0</iMaxTimeDelay>
	<bTaperForSoundtracks>0</bTaperForSoundtracks>
	<iLengthOfSound>0</iLengthOfSound>
	<fMinDryLevel>1.0</fMinDryLevel>
	<fMaxDryLevel>1.0</fMaxDryLevel>
	<fMinWetLevel>0.0</fMinWetLevel>
	<fMaxWetLevel>0.0</fMaxWetLevel>
	<iNotPlayPercent>0</iNotPlayPercent>
</Script2DSound>

Fourth: Return once more to the CIV4TechInfos.xml file. Find the <Sound></Sound> for the tech you are adding the audio for. Change this to use the ScriptID that you created in Audio2DScripts.xml. Save it and you're done.

Example:
Television one last time. I open up CIV4TechInfos.xml and edit so I have this:
Code:
<TechInfo>
	<Type>TECH_TELEVISION</Type>
[I]...much snipping here...[/I] 
	<Quote>TXT_KEY_TECH_TELEVISION_QUOTE</Quote>
	<Sound>AS2D_TECH_TELEVISION</Sound>
	<SoundMP>AS2D_TECH_MP_MASS_MEDIA</SoundMP>
	<Button>Art/Interface/Buttons/TechTree/television.dds</Button>
</TechInfo>

Caveat:The <SoundMP> tag is for multiplayer games. I did some searching, and all the MP sound files just say "You have discovered Tech Name." I don't know if we want to get into adding the MP files, but if you do want to add them, you would add the MP audio the same way you add the regular audio.

I think it's a good idea to test your new quote before pushing it to the SVN. Here is my quick-and-dirty guide to testing a new quote:
  • Start Caveman2Cosmos.
  • Start a Custom Game with the following settings: Duel size, Mastery Victory on, no rivals, No Barbarians checked.
  • Build the starting city.
  • Go into Worldbuilder.
  • Raise the starting city size to 11.
  • Give the city a Good (Fusion Power). It's close to the bottom of the building list so it is easy to find.
  • Give your civilization the Divination tech and all the technologies needed as prerequisites for the tech you are trying to test.
  • Have the city build the Oracle. It will take one turn with Fusion Power.
  • Select the tech you want to test. After the Oracle movie plays, you will get the popup for the tech and the quote should play if you did everything right.

I hope this helps. Let me know if there are any problems with this guide.
 

12padams

Prince
Joined
Sep 9, 2009
Messages
494
Thanks so much for this! I'm gunna go through every single tech in the game from beginning to end adding quotes (for those that need it) and also recording audio quotes and adding them to the game. I've just used this guide to make Nomadic Lifestyle play my audio quote upon being researched so ill upload that to the svn very soon ;)

I'll aim to have all quotes for the prehistoric era done perfectly (matching up to the text and everything) by v28 and even more eras if I can. I work in order though so I'll do all techs from beginning to end ;)
 

12padams

Prince
Joined
Sep 9, 2009
Messages
494
Hey for some reason I tried this tutorial for adding an audio quote for nomadic lifestyle but it didn't work... Can you please check the XML files to confirm I did this correctly? It's revision 4222
 

Vokarya

Deity
Joined
Mar 25, 2011
Messages
6,241
Hey for some reason I tried this tutorial for adding an audio quote for nomadic lifestyle but it didn't work... Can you please check the XML files to confirm I did this correctly? It's revision 4222

I'll look into it. I tried some experimentation and nothing seemed to work, but I don't think I tried absolutely everything yet.
 

Vokarya

Deity
Joined
Mar 25, 2011
Messages
6,241
Hey for some reason I tried this tutorial for adding an audio quote for nomadic lifestyle but it didn't work... Can you please check the XML files to confirm I did this correctly? It's revision 4222

Found the problem. In Audio2DScripts.xml, you have this:
Code:
<ScriptID>AS2D_TECH_NOMADIC_LIFESTYLE</ScriptID>

But in CIV4TechInfos.xml, you have this:
Code:
<Sound>AS2D_NOMADIC_LIFESTYLE</Sound>

See the difference? The two have to exactly match, or the sound quote doesn't play. You can change either one to match the other. I suggest changing the CIV4TechInfos.xml to AS2D_TECH_NOMADIC_LIFESTYLE.
 

12padams

Prince
Joined
Sep 9, 2009
Messages
494
Now that I know how to add both tech and audio quotes I am going to completly fill out this entire game from beginning to end making sure every tech has a unique quote and the text and audio of each quote actually matches.

I'm going to work in columns with a goal of 1 column per day. Today I'm working on coulmn 2 and 3 of the prehistoric era. I've recorded all necessary quotes and found and recorded a quote for controlled fire. I will upload this to the svn in a few hours once I've sorted it all out and made sure it all works correctly.

Hopefully I'll have the prehistoric age completly sorted out by v28 and then another age completed for each version after that. The good thing about the audio files is that once I link them to the game they can easily be modified by simply replacing the mp3 file since the game will still find the same name file when a tech has been researched.

Anyway I hope you all enjoy the effort I'm putting into this as much as you enjoy the enoumous amount of effort all the other devs put into this game everyday. Please note that I'm gunna get a little obsessed with doing this and I most likely will work on my lets play less often due to my time being spent on this instead.

Btw not that Im actually going to do this but is it possible to add a button next to the description (information, stradagy, history) of a unit, building, technology or anything else in the sevopedia that plays an audio file (that I could record) which reads all the contents in the description box? Lol I was just thinking because it would be cool to have a narrator for those sections and once I've done the tech quotes I would be more than happy to work on narrating everything in the description boxes too... I know I'm crazy but I was just asking lol ;)
 

12padams

Prince
Joined
Sep 9, 2009
Messages
494
@12padams

If you have a question about what a tech means let me know. ex. Hard Hammer Percussion is about a type of stone tool, not say stone percussion instruments. Or Tanning is about tanning leather not tanning on the beach. I know some can be confusing or vague.

Awesome thanks for doing this for me when I need help understanding a tech so I can find an appropriate quote for it. Basically I have completed the tech tree so far from X1 to X3 so everything in those 3 columns has an appropriate text and matching audio tech quote as of revision 4227. Oh and it works... I've researched and listened to myself speak all of them in the game ;)

The Prehistoric Era has a total of 18 columns and since I've done the first 3 that leaves me with 15 left. I will definitely have the prehistoric era completely sorted out by V28 and Maybe even the Ancient Era.

So far the only tech I've come across without a proper (made for it) quote was controlled fire. Here is the audio of the quote so you can hear and see what the quote I chose for controlled fire was: http://picosong.com/3F5b/

Btw the only quotes with an actual audio quote I come across so far from X1 to X3 were language and herbalism. Its good now that I recorded and added 7 more audio quotes to fill it up so those first starting the game now (if using the svn) won't have silent quotes.
 
Top Bottom