![]() |
| 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:
|
| 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.
//BLP
Scripts is the name I gave to the section I
created to hold my new sentences for Barney. |
| 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. |
|