[Tutorial] How to setup NPC speech soundscripts.

Archived Source Engine and Obsidian Tutorials.
Post Reply
User avatar
Posts: 130
Joined: Tue Aug 08, 2006 2:53 am

Post by Hickadam » Thu May 03, 2007 1:59 am



I'm not sure if this is engine specific, or a mod thing, but whatever.

These are the steps to put custom .wav speaking npc's into your map.

1. Record your sounds, and place them in sounds/*folder*, folder name is up to you, but it's nice if it's the same as your map.

2. Open your sounds in faceposer, load the .wav's individually, and set the lip syncing, then create your scenes.

3. As you are satisfied with each scene, before saving it, edit the .wav event, and change the sound file from a "folder/file.wav" location, to a "soundname.soundname" format. I know this sounds weird but I'm gettin there.

4. A little info: I'm not an expert on this, but for some reason, organization probably, valve decided to make sound script files. The .wav file is referenced, and then the sound is identified with "name.name" with no extension. For instance, a flesh burning and chopping sound could normally be something like "sound/player/combat/fleshburn.wav" and "sound/player/slicer/fleshchop.wav".

The script file has that info in it, as well as other crap, and now, those files could be found as "flesh.burn" and "flesh.chop". Kinda nifty, but equally annoying in my opinion. Anyways, faceposer appears to allow references to .wav files, and it does in HL2 and some other mods, but I think they're taking away support for that. Faceposer only really likes sounds in something.something format.

5. So, now we're still re-naming our files in face poser. I reccommend a name of the map first, and then the soundname, unless you want something else. For example, "mymap.shotgun1" would be a logical name for a sound that was previously "sound/mymap/weapons/shotgun1.wav". Once you have decided on a logical pattern like that, write down or don't forget the names. Faceposer won't be able to find the file after changing the name; because that sound is not in the game_sounds.txt soundscripts. Dont sweat it, all the info is there, so just save it and move on.

6. Alternatively, you could add a script file temporarily to "obsidian/scripts/", and then add a precache line to it in "game_sounds_manifest.txt" so that faceposer could recognize the new sound names, and still play your sound, plus if you wanted to edit something this would make it easier, so that you wouldn't have to go back and edit everything. I wouldn't do that because if you forget that file is there, and you modify it, when you go to distribute your map, nobody will get that file, and your sounds will be missing; if you didn't add the additions or changes to your maps custom soundscript file; although it would appear to run perfectly on your own computer. Best to make sure you have all your ducks in a row, and take it one step at a time.

7. Now, you have your .wavs in their sound directory, you have your .vcd files in their scenes directory WITH all their sounds in a sound.name format. Now, add a custom soundscript file to the obsidian/maps/cfg folder. Name it "mapname_soundscripts.txt" replace mapname with your exact mapname; the same name as your .bsp file. And put your soundscripts inside. I'll put an example soundscript at the end of this essay, just bear with me for now.

8. So make your map, your character, and put in your logic_choreographed_scene ents, and hook em all up right.


You SHOULD be able to just go compile and have no problems, unfortunately, there is some fricken issue with the sound cacheing/precaching. Make an ambient generic, you don't have to give it a name, or touch anything else on it, but you MUST make the sound the same sound as your .scene file is supposed to play. Not in the sound.name format either. It has to be the full path and .wav extension. Do this for EACH and EVERY one of your scene ents. Otherwise, it will appear to work, then when you close and reload the map again, it will give you errors and not work. Don't ask me why, but this solves the problem. I suppose it just forces the game to precache the sound, because an ent like an ambient generic needs to be loaded and ready to go.

There, that SHOULD do it.

Good luck, and here is that sample of a "block" I guess you would call it... (I really suck at programming...) That you would put in a mapname_soundscripts.txt file, one of these for every sound!

"channel" "CHAN_VOICE"
"volume" "0.80000"
"pitch" "PITCH_NORM"

"soundlevel" "SNDLVL_NORM"

"wave" "oc_cannon/vo/example.wav"

From the quotes to the bottom bracket, one for each sound.

Hope this helps, and now I'm gonna go get rid of this headache... this has not been a fun issue to deal with...

Post Reply