Firebinder's Half-Life Pages

 

Custom Sentences
May 31, 2002
In the course of working on The Best Laid Plans (you know - the mod I should be working on instead of writing this tutorial) I wanted to get some of the characters to speak non-standard sentences. I searched diligently, but found no single tutorial that really covered this subject, so I had to figure it out based on pieces of information gleaned from many sources and a lot of trial and error. With this article I hope to make learning to create custom sentences a little easier for you.

 

Creating the Custom Sentence
The first thing we have to do is create a sound file of our custom sentence. This sound file should be in Wav, 8 bit, 11025Hz, Mono format (although it is reported that up to 44000Hz will also work).

There are two ways to create this file: you can either edit and recombine the existing sound files, or you can record a new file from scratch. Each method has it's strengths and weaknesses. The edit and recombine method will allow you to keep the character's voices the same as in the original game, but getting it to really sound right will be time consuming and frustrating. Recording a new sentence from scratch can give you much better results - IF you have good equipment and access to some good voices.

Either way you're going to need a wav editor. Now THE wav editor to get is SoundForge - but it costs over $400. Most people's second choice is GoldWave, a shareware that costs $40. WaveFlow (which I use the most) is now shareware at $25. There are four decent freeware editors that I have found, ProWave, Audacity, Encounter2000, and SoundEngine.

Creating the sound file is an art, and it remains to be seen if I'm any good at it, so I'm not going to be able to tell you exactly how to do it. None the less I will try to offer some advice:

If you use the edit and recombine technique listen carefully to all of the existing sentences. Try to look not only for the words and phrases you want, but also for compatible inflections. Remember that you can use parts of words and recombine them into different words altogether. As you copy and paste the sound bits into your new wav file, watch out for gaps and static-like pops that can occur if you copy carelessly.

If you are going to record a brand new sentence from scratch be selective in choosing your voice actors. Are your friends voices really that good? Is yours? Be critical - be assured that the reviewers will be. Use a half-decent microphone, and take the time to learn how to use it properly. Watch out for background noises and echo. There is an excellent tutorial on voice acting over at Game Studio Sound - read Voice Acting 101.

All wav editors come with a collection of "filters" which can be used to modify the original file. Used carefully they can greatly enhance your custom sentence. The "normalize" filter in particular is useful for getting your sentences to sound a little more natural. Other filters may be able to improve a recorded voice. Almost all wav editors have special effect filters that can make a voice sound like it is on a radio, telephone, or in a large cavern. Play around with the filters you have available to see what they can do for you.

 

Putting the Sentence into Half-Life
To use your fancy new custom sentence in the game, you must first put it somewhere within the sound folder. Ah, but which sound folder? is what you should be asking yourself at this point, because there can be several. The default sound folder used by the game is found in the \valve\pak0.pak file, but there can also be an "unpaked" \valve\sound folder (although there isn't one initially), plus a sound folder in each individual mod's folder, and there can be one in each additional pak file you have installed.

In fact many of these choices will work, but the best sound folder to use will depend largely on what you intend to do with your level. A quick read of Delete_Me's article Pak Files and the Directory Folders is helpful in understanding how the game decides which files will get used. My recommendation, however, is that you use either the \valve\sound folder, or if you are working on a mod, use the sound folder within that mod's folder. If the folder does not exist, go ahead and create it. Although you can modify and use the pak files, this is not recommended.

The sound folder can contain subfolders for each of the different characters and for each type of special effects. Your "unpaked" sound folder does not need to contain all these subfolders, but it should contain the ones your custom wavs would logically belong in. Create them if they are not already there, then copy your custom wav file into that subfolder. The example below shows how I set this up for my own mod to add the custom sentence "Greet1.wav".

Now you need to tell the game about your custom wav file. The game uses the sentences.txt file to find the wav files it has access to, but again there can be many sentences.txt files to choose from. You will need to use one that is in your "unpaked" sound folder (not in a subfolder!). If the sentences.txt file is not already there you will need to copy it from the sound folder in the pak0.pak file (or if you are mapping for an existing mod, use the sentences.txt file from that mod's pak file).

Once you have the sentences.txt file in the appropriate sound folder, open it in notepad (or the text editor of your choice). You'll see that it is divided into sections for each character type. You will need to modify it by adding your new .wav file and a reference name at the end appropriate section (don't worry about the fact that the file begins with "DO NOT MODIFY THIS FILE!" - but don't delete any of the existing lines!). In the example below, the lines I added are in red.

(the // BARNEY section is located near the middle of the sentences.txt file)

// BARNEY

(intervening lines removed to show the last section within // BARNEY)

//c3a2 scripts
BA_SURVEY2A barney/c3a2_ba_2surv
BA_SURVEY4A barney/c3a2_ba_4surv
BA_SURVEY6A barney/c3a2_ba_6surv
BA_SURVEY8A barney/c3a2_ba_8surv
BA_PORTSTAY barney/c3a2_ba_stay

//BLP Scripts
BA_BLP01 barney/greet1

(My entry is made just before the Scientist section starts)

// SCIENTIST

SC_OK0 scientist/excellentteam
SC_OK1 scientist/fellowscientist

//BLP Scripts is the name I gave to the section I created to hold my new sentences for Barney.
BA_BLP01 is the reference name I gave for my new custom sentence.
barney/greet1 is the folder/file name of my custom sentence (The sound folder is assumed and should not be included here. Also note that the .wav extension must be omitted).

 

Using the Custom Sentence
Now you should be able to use your custom sentence exactly the same as you would any other wav in a scripted_sentence. Continuing with the earlier example, the Object Properties would look like this:

Notice that for "Sentence Name" you use the wav file's reference name as set in the sentences.txt file, and it must be preceded by an"!".

For more information about using scripted_sentences I'd recommend that you read the scripted_sentence tutorial over at Valve ERC.

 

Rules for the Novice Mapper About Invalid Brushes Textures from Plastic Models Custom Sentences

 

Return to Top

Site Map  
Respawn Frames Frag Frames