If you are going to play a music file, I would suggest using an MP3.
Some types of MP3 files will not play, you will have to experiment. But for the most part, any should work as long as it is in MP3 format.
First thing you need is the song.
Second thing you need is a soundalias.
Third, you need an IWD file.
Quote:
Wave files can be packed into the maps FF file, but MP3 files can only be played from and IWD file.
I will include a default soundalias, and a default IWD file. All you need to do is edit a few things on your end to get it working.
Start by downloading and unzipping the zip file I've included. Copy the IWD I've included to a mod folder. Use CustomMaps mod for now. Rename the IWD to your mapname. Just replace "mapname" with your mapname.
Next open up the IWD file with winzip, or pakscape or whatever you have to open that. To make it easy in the begining, rename your audio file to "
music_file.mp3". Put your audio file in there, and replace the default song I have in the
sound/amb_elements folder with yours. Save and close.
Also copy your song to the following Dir. "
Call of Duty 4 - Modern Warfare\raw\sound\amb_elements\music_file.mp3". If the "amb_elements" folder doesn't exist, create it.
Now we need to tell the game to fetch the song we want to play, in the directory we've created in that IWD using the soundalias. In the zip file I've attached, pull the soundalias file out "mp_mapname.csv" and paste it into the following Dir. "
Call of Duty 4 - Modern Warfare\raw\soundaliases" Rename the file so that mapname is the name of your map.
Next, open the .csv with MS Excel. If you don't have Excel, it will open with a text editor, but the formatting is not correct. Saving using a simple text editor might not work properly. I highly recommend MS Excel.
Once open, you will see that I've named the alias for the music file "my_song" for simplicity reasons. You won't need to edit anything in here but you can see and learn how the alias works by reading the descriptions in the above Cells. You can close it.
Now we have your files ready, we need to tell the game to run your soundalias. Since this song is going to play as the background ambient track, we need to state that in your maps main .gsc file. The same file where you define your teams. Open up your "mp_mapname.gsc" file and add or edit the following line to read:
Code:
ambientPlay ("my_song");
Here is where we state the alias we want to play. We named the alias "
my_song". So, now it knows to play the alias "my_song" as the ambient background track. The alias references our music file. Save and close.
Next, open up the compile tools and click "Update Zone file". Add the following line to your zone file, or rather, the right side.
sound,mp_mapname,,all_mp
Remember to edit "mapname" with the name of your map. This line tells your map to use your defined soundalias to play your sounds. Save the zone file and close.
Build FF.
I suggest Checking "
Enable Developer" "
Enable Developer Script" and "
Use Custom Command Line Options".
Under Custom command line options, we need to make sure you run the mod where your IWD is located. I suggested putting the IWD in the CustomMaps Mod folder, so if that is true, then make sure this is in the custom command line options.
+set fs_game mods/customMaps
Run Selected map and test.
There are a few errors that can happen. If your sound does not play it could be because
the file type is not supported. If this is the case, you will need to render the proper format. It may also say in the console "
could not play streamed file, blah blah" This is because we stated in the soundalias "streamed". If you get this error, simply edit the soundalias, and remove the cell that says "streamed, for your sound, and make that cell empty.
Other errors.
The sound doesn't play at all, and no errors occur. The game doesn't like your sounds format altogether, try a different sound or version of the sound.
Report back with any other errors. I know there are a few more but off the top of my head, I can't think of them. remember to check the full console by pressing "tilde" key [~], then pressing SHIFT + Tilde key to see the full console while ingame to check for errors.
It's easier than it looks.
Goodluck
![[thumbs_up]](images/BBCode/smilies/thumbs_up.gif)