Creating Your Own Sound Scripts!

Posted by on Mar 19, 2012 in Past Stories

If you don’t know what a sound script is, well you’re in for something rather special! Although you can play sound files directly by targeting the raw file, a sound script will allow you to control the sound in different ways. You can use a sound script in custom: maps, mods, and games. While you might not want to make a sound script if you’re just adding music to a single custom level, you will want to make them if you’re using custom sound effects, or many different sounds. Some of the perks of using sound scripts are: Choosing a shorter, more organized name for the sound. Ability to modify the sound without creating more sound files that would otherwise waste space. Pitch and volume alteration. Choosing a random sound file from an array. Subtitles (We won’t cover this, and custom subtitles are only for mods). Channels that handle the sound differently based on the use. DSP modification, and sound characters. Some of the problems of using a sound script are: None, there is no reason NOT to use them. The Manifest, and Script File So now that you have a basic understanding of what a sound script actually does, how about we learn more about the creation process.  sound scripts are stored in: GameGamefolderscriptsgame_sounds_SCRIPT.txt Once you have a sound script you’ll have to add it to the manifest. The manifest tells that game what sound scripts to load into memory. The manifest looks like this: game_sounds_manifest { "preload_file" "scripts/game_sounds_physics.txt" "preload_file" "scripts/game_sounds_weapons.txt" "preload_file" "scripts/game_sounds_ambient_generic.txt" "preload_file" "scripts/game_sounds_world.txt" "preload_file" "scripts/level_sounds_general.txt" } As you can see it’s a rather simple file, all you do is copy an existing line and change the file that it points too. Now lets look at what a sound script entry looks like, I’ll be sure to break it down into it’s simplest form. "Sound.Name_Entry" { "Command" "Setting" } This is what a completed sound script entry looks like: "Tube.explode_1" //Name of the sound entry { "channel" "CHAN_STATIC" //Channel that the sound functions on. If it is not defined it will use the default channel. "volume" "1" //Volume of the sound to be player, this is a value 0-1 and can be a decimal. If it is not defined it will be "1" "pitch" "100" //Pitch of the sound, can be 0-255, 100 if default. If it is not defined it will use the default. "soundlevel" "SNDLVL_90db" //Sound level, this is used for sound attenuation. It is basically how fast, and how far it falls off. "wave" "level/explode_1.wav" //Sound to be played, must be a WAV. } Pretty simple so far right? Good! Now lets make one from scratch! I’ll name my file game_sounds_tutorial.txt. Once you’ve made the script make sure to place it in the proper location: GameGamefolderscripts Then append the newly created script file into the manifest. Now time to create a sound entry in our new file. There are a...

Read More »