Tutorial: Scripted Sentences Last edited 4 months ago2019-04-23 06:22:56 UTC by Penguinboy Penguinboy

Download attachment

So how do you get a Monster to say what you want it to?

For basic sentences that are included in Half-Life this is easy, but how do I know what sentences are available? You will find them listed in the Sound folder in your Half-Life directory in a file called Sentences.txt.

Half-Life\valve\sound\sentences.txt

Open the sentences.txt file with NotePad or a similar text editor and scroll down, or use the find function until you get to the listing for Scientists.
// SCIENTIST
SC_OK0 scientist/excellentteam
SC_OK1 scientist/fellowscientist
SC_OK2 scientist/fine
SC_OK3 scientist/hopeyouknow
SC_OK4 scientist/leadtheway
And further down the list:
// fail to follow player any more
SC_STOP0 scientist/stop1
SC_STOP1 scientist/stop2
What does it mean? If you open the wav file you will here a scientist saying "With my brains and your brawn, we'll make an excellent team"

As you can see, the sentence.txt gives you a guide to what is in the sounds folder.

Making it work in your map

To get Monsters to say something, you will need to add a scripted_sentence to your map. The Entity Guide will give you more information on the Scripted_sentence

The Map

Make a simple map with a Scientist, Scripted_sentence, Info_player_start, a trigger and a light.

Scientist

Name your Scientist. I have used reggie. You can set the Flag Property to Gag if you want.

Scripted_sentence

Trigger

Whatever you use as a trigger must Target the Scripted Sentence. So the Target property of the monster_handgun in the example is sci_ss1.

Run the map and look at the Scientist, nothing happens. Pick up the gun and he will speak the chosen script.

Custom Sounds

The format of the WAV files is PCM,11,025 Hz, 8 Bit, Mono. If you want the monsters lips to move in sync with the words, then the .wav file must be in this format.

The easy way to create your own .wav file is to copy an existing one, rename it, open it in a sound editor, clear the existing .wav and add your own voice.

To get your new .wav file to work, you will need to add it to the sound folder. And you will also need to add a line to the Sentences.txt.

If we created a new file called help.wav, here is what we need to do to get it working.

First, add your new .wav file (help.wav) to the sound folder. I suggest adding it to your own folder (mywav) so you know where it is.

Second, Back up your original sentences.txt and rename it origsentences.txt, so that when you screw this up, you can load the old one back in.

Open the Sentences.txt
// HALF-LIFE SPEECH SYSTEM SENTENCES. DO NOT MODIFY THIS FILE! Max of 1023 sentences.
Somewhere in this list add:
//MYWAV
ME_SPEAK1 mywav/help
Simple, isn't it?

By adding !ME_SPEAK1 to the Sentence Name of your Scripted_sentence, your monster will now speak the help.wav

If you want to distribute your map, you will need to include the modified sentences.txt and the folder with the help.wav in it.

Other examples

Cutscene by Seventh-Monkey.

Special Mention to Rileymo, who did some initial work on this subject.

Comments

You must log in to post a comment. You can login or register a new account.