Custom Words

Premise

For those of you who play TFC often, you should know the sentence played by the announcement system when you take the enemy key on The Rock, "Take key to enemy gas chamber." What you may not know is that there is no sound file for the word "gas" at all. The sentences.txt file in fact shows that the word "gas" was created by using different segments of the words "got" and "ass." Seriously!

What is sentences.txt?

For those of you who have no idea what I'm talking about, you should know that Half-Life and TFC can use "scripted sentences" to string together the words that make up a sentence for the announcement system (also referred to as vox) and the marines (also referred to as hgrunts). Entries for commonly used scripted sentences are placed in a sentences.txt file in the TFC pak, but are not necessary; they can be plugged right into the entities in the map.

Example

The sentences.txt file in the TFC pak shows this entry:

RK_TAKEKEY vox/Take(e90) key(e90) to(e80) enemy got(e15) ass(s10 e80) chamber

Notice the extra tags on the ends of some words. These are used to modify or truncate parts of the sound file being played. got(e15) instructs that only the first 15% of the sound file "Take" should be played. ass(s10 e80) causes only 80% of the original file to be played, with the first 10% cut out entirely. There are other tags as well, including (p) and (t), which modify the pitch and playback speed of a sound file. The small modifications in the above entry have the effect of reducing "got" to a "g" sound and cutting down the word "ass" so it fits together snugly. Play the resulting sounds and you have the word "gas!"

NOTE: Tags can also be placed before strings of sounds to apply the effect to multiple sounds. Be sure to reset the tags after the sounds using the tag (s100 e100).

Using This Technique

Let's use this to our advantage now. For my new map, Das All Quiet, I want to create a new word, "trenches." I find that using the words "train," "renegade," "check," and "is," I can create this scripted sentence:

vox/train(s12) renegade(s6 e30) check(s9 e20) is(s1)

Now I have the word I need without the hassle of distributing another sound file with my map. Another case:

vox/termination(e5) on(s5 e64) termination(e5)

This creates the word "taunt," which I used once in a short sound file that said "Do not taunt Happy Fun Ball."

Misc

To find the exact proportions you need, you can experiment with different existing sound files by extracting them from the Valve and TFC PAK files using PakExplorer, then loading them into a sound editor and playing around with them (I use a shareware copy of GoldWave). Once you find the right parts of the sounds, you can use simple math to determine the percentages you need to specify.

Let's say you had a 500 ms sound file and you required the first 20 ms and the last 100 ms to be cut out. 20 divided by 500 is 0.04, or 4%. 100 divided by 500 is 0.2, or 20%. Thus, the tag required would be (s4 e20). And there you go!