MODSon[line.com] Wiki - Beta 1.0
Call of Duty 2: Sounds
From MODSonline Wiki
STILL IN PRODUCTION: Pictures and better examples are on the way! So, you want to add some sounds to your Call of Duty two map? There are many different ways to do this. You can have sounds just playing or have a trigger start a sound.
Contents |
[edit] Setup
[edit] The Sounds
First let's setup the folders and files needed to have sounds in Call of Duty 2. Go to your CoD2 main folder.
C:\Program Files\Activision\Call of Duty 2\main
Make a new folder called sound. In the sound folder you can make a new folder where you will put all of your sounds. I created one called misc.
C:\Program Files\Activision\Call of Duty 2\main\sound\misc
Now for the actual sound files. They should be a wav file. I have always used files of the format below. The sounds are required to be in this format. Anything else might not be played.
| Bit Rate: | 705kbps |
| Audio sample size: | 16 bit |
| Channels: | 1 (mono) |
| Audio sample rate: | 44 kHz |
| Audio format: | PCM |
Place the sound files in the misc folder.
[edit] Soundaliases
Make your way back to the main folder and create another new folder called soundaliases. Now open up notepad. We are going to create the sound alias for your map. This will make the game understand where the sounds are located and what they are called. Here is an example of a sound alias.
ring,,/misc/ring.wav,1,1,,1,1,10,2000,auto,streamed,,,,,,,,,,,, radio_d,,/misc/radio_explod.wav,1,1,,1,1,10,1000,auto,streamed,,,,,,,,,,,, elevator,,/misc/elevator.wav,1,1,,1,1,10,2000,auto,streamed,,,,,,,,,,,, generator,,/misc/generator.wav,.1,.1,,1,1,10,1000,auto,streamed,,,,,,,,,,,, waterlap,,/misc/waterlap.wav,1,1,,1,1,10,500,auto,streamed,,,,,,,,,,,,
Save this in the soundaliases folder as: mp_[your_map_name].csv. Make sure you have the Save as type:' set to All Files or it will not save as a csv. NOTE: All csv files should be opened and edited using NOTEPAD. You can not use Microsoft Excel to edit them.
Now let me explain what each part means.
ring: this is the name of the alias. You will refer to this in the scripting part.
/misc/ring.wav: This is the location of the wav or sound file. When you use the alias ring the game knows you are talking about the ring.wav in the sound/misc folder.
The first 1 and second 1 deal with the volume of the sound. The min then the max. 1 is full volume and 0 is silent.
The next two ones deal with pitch or speed. 1 is normal speed where 2 is two times as fast and 0.5 is half speed.
The 10 and 2000 is the min and max distance. This is how far away the player must be to hear the sound. A minimum of 10 units and a max of 2000.
Auto: This is the channel that the sound plays over. Most of your sounds will be auto, but you can have auto, menu, weapon, voice, item, body, local, music, announcer. If you don't know which to choose, just use auto. Chances are it is right.
The alias follows this pattern:
name,sequence,file,vol_min,vol_max,vol_mod,pitch_min,pitch_max,dist_min,dist_max,channel,type,probability,loop,masterslave, loadspec,subtitle,compression,secondaryaliasname,volumefalloffcurve,startdelay,speakermap,reverb,lfe percentage
Be sure to make the name something that isn't being used already. This could cause problems latter on.
[edit] Mapping
Now that you have your alias setup, it is time for the mapping part. There are two different types that I will walk you through.
Non-Triggered and Triggered
[edit] Non-Triggered
This is the simplest and easiest to add. First, create a new script_origin. This is where the sound will be coming from. Give it a targetname of water_sound. This will be used in the scripting part to tell the origin to play the sound. That is it for the mapping, so save and compile!
Below is the script I used to make the sound start when the game started.
In your mp_[map_name].gsc add the following.
main()
{
sound = getent("water_sound", "targetname");
sound playloopsound("waterlap");
}
This script will loop the sound waterlap from the sound alias over and over until the map is over! This is where the sound alias comes into play. ring is what we called our alias. In the script we told the script_origin to play the sound waterlap. Sound aliases make it easier to call on the sound, rather than putting all of that info into the script!
[edit] Triggers
Now let's say you want to have a trigger play a sound on a spot when the trigger is triggered. It is very simple! It is almost the same as the example above.
First let's start with the origin where the sound will be played. Create a script_origin and give it a targetname of ring_sound. This is where the sound will be played once the trigger is triggered.
Next, make a trigger_multiple and give it a targetname of sound_trigger.
You are now done with the mapping part and can save and compile.
Below is the script I used to make the sound start when the trigger was triggered.
main()
{
thread trigger();
}
trigger()
{
trigger = getent("sound_trigger", "targetname");
sound = getent("ring_sound", "targetname");
while(1)
{
trigger waittill("trigger");
sound playsound("ring");
wait 5;
}
}
Now it is just like before. When the trigger is triggered the origin will play the sound that ring points too. Every time the trigger is triggered it will play the sound ring!
