Tutorial: Scripted Sentences Last edited 19 years ago2004-09-04 04:00:00 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.

This article was converted from a previous version of TWHL and may need to be reviewed

  1. The formatting may be incorrect due to differences in the WikiCode processing engine, it needs to be revised and reformatted
  2. Some information may be out of date
  3. After the article is re-formatted and updated, remove this notice and the Review Required category.
  4. Some older tutorials are no longer useful, or they duplicate information from other tutorials and entity guides. In this case, delete the page after merging any relevant information into other pages. Contact an admin to delete a page.

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-Lifevalvesoundsentences.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?

// SCIENTIST tells you which sub-folder of the sounds folder the sentence .wav's are in. Any line prefixed with // is a comment and is thusly ignored by the game

SC_OK0 is the sentence name.

OK and Wait are the sentences spoken when the player "uses" the Scientist.

scientist/excellentteam is the sound folder that the .wav file is in, and the name of the .wav, in this case the name of the .wav file is excellentteam.wav

If you open the wav file you will here a scientist saying "With your brains and my 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

Name: This will be the Target of your Trigger. I used sci_ss1
Sentence Name: From the sentences.txt, !SC_STOP1 - It is very important that you add ! before your sentence name.
Speaker Type: The Name of your monster, in this case reggie.

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.

Steam Users

Your Steam/steamapps folder will contain the Half-Life GCF file, which you can open with GCFScape, and browse to the sounds folder. All the wav folders and the sentences.txt are there.

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.