[Tut] Custom Sound Looping [with distance restrictions]

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

[Tut] Custom Sound Looping [with distance restrictions]

Post by Drofder2004 » November 1st, 2012, 1:21 am

Mapping
- Right-click < Script < Origin
- Add Key/Value
Key: targetname
Value: repect_radio (or anything else you want)

Scripting
Create a GSC called "my_map.gsc" and place inside folder "raw/maps/mp".

Code: Select all

main()
{
   maps\mp\_load::main();
 
   game["allies"] = "sas";
   game["axis"] = "russian";
   game["attackers"] = "axis";
   game["defenders"] = "allies";
   game["allies_soldiertype"] = "woodland";
   game["axis_soldiertype"] = "woodland";
 
   thread music_one_item();
   thread music_multiple_items();
}
 
music_one_item()
{
   respect_single = getent("respect_radio_single", "targetname") playLoopSound("respect");  // Soundalias = respect
}
 
music_multiple_items()
{
   respect_box = getentarray("respect_radio","targetname");
 
   for(i=0;i<respect_box.size;i++)
      respect_box[i] playLoopSound("respect"); // Soundalias = respect
}
SoundAlias
- Create a file called "my_map.csv" and place this inside folder "raw/soundaliases"
- Save the following text into your CSV file (in notepad) [Where you see the word [EDIT], please remove this and make a single line of text]
- Open the file in Excel (unless you understand csv structures)
- Change first column to the alias of the sound. You will replace these in the GSC above ( // Soundalias = respect )
- The third column is the location of the file. I recommend creating a folder "my_map" and then placing your files in there.
- The fourth column is the minimum volume the file can be when inside the max distance.
- The fifth column is the maximum the volume will be.
- Change the values 100 and 250 (250 is the furthest you will hear the sound from and 100 is the distance from the sound where volume starts to decrease)
- Leave all other values alone.

Code: Select all

name,sequence,file,vol_min,vol_max,vol_mod,pitch_min,pitch_max,dist_min,dist_max,channel,type,probability,loop,masterslave,loadspec,subtitle,
[EDIT]compression,secondaryaliasname,volumefalloffcurve,startdelay,speakermap,reverb,lfe percentage,center percentage,platform,envelop_min,envelop_max,envelop percentage
,,,,,,,,,,,,,,,,,,,,,,,,,,,,

#Respect,,,,,,,,,,,,,,,,,,,,,,,,,,,,
respect,,mp_respect/respect.mp3,0,1,,,,100,250,auto,streamed,,looping,,,,,,,,,,,,,,,
Sound
- When using an MP3 make sure to set the bitrate at 96kbps (the game most likely allows more, however this is the setting I used successfully), you can change the bitrate using Audacity or a similar program.
- Place the sound file inside folder "raw/sound/my_map"

Zone File
- Open "zone_source\my_map.csv"
- Add "sound,my_map,,all_mp" to the bottom line
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: [Tut] Custom Sound Looping [with distance restrictions]

Post by Rezil » November 1st, 2012, 2:20 am

I thought you were gonna keep this a secret! :(

Awesome tut by the way, I still have no clue why bitrate should have anything to do with the sound being able to loop or not.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: [Tut] Custom Sound Looping [with distance restrictions]

Post by F |Madness| U » November 1st, 2012, 1:50 pm

Very nicely done Drofder.
-

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: [Tut] Custom Sound Looping [with distance restrictions]

Post by Drofder2004 » November 1st, 2012, 10:41 pm

Rezil wrote:I thought you were gonna keep this a secret! :(

Awesome tut by the way, I still have no clue why bitrate should have anything to do with the sound being able to loop or not.
It is a secret. Only you, me and everyone else can see it, but we MUST keep it a secret, ok?
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

lZombieGodl
CJ Wannabe
CJ Wannabe
Posts: 2
Joined: November 9th, 2012, 10:06 pm

Re: [Tut] Custom Sound Looping [with distance restrictions]

Post by lZombieGodl » November 9th, 2012, 10:08 pm

I Could really do with some help on this, i dont understand what you mean by "Remove this and replace with a line of text" and im not sure what i should put in the 3rd' column, can you help me :)

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: [Tut] Custom Sound Looping [with distance restrictions]

Post by F |Madness| U » November 9th, 2012, 10:17 pm

lZombieGodl wrote:
I Could really do with some help on this, i dont understand what you mean by "Remove this and replace with a line of text" and im not sure what i should put in the 3rd' column, can you help me :)

Code: Select all

name,sequence,file,vol_min,vol_max,vol_mod,pitch_min,pitch_max,dist_min,dist_max,channel,type,probability,loop,masterslave,loadspec,subtitle,
[EDIT]compression,secondaryaliasname,volumefalloffcurve,startdelay,speakermap,reverb,lfe percentage,center percentage,platform,envelop_min,envelop_max,envelop percentage
,,,,,,,,,,,,,,,,,,,,,,,,,,,,

#Respect,,,,,,,,,,,,,,,,,,,,,,,,,,,,
respect,,mp_respect/respect.mp3,0,1,,,,100,250,auto,streamed,,looping,,,,,,,,,,,,,,,
It means that when you put this code into your csv, delete the word [EDIT] along with the square brackets, to make a single line of text from that code.
-

lZombieGodl
CJ Wannabe
CJ Wannabe
Posts: 2
Joined: November 9th, 2012, 10:06 pm

Re: [Tut] Custom Sound Looping [with distance restrictions]

Post by lZombieGodl » November 9th, 2012, 10:55 pm

F |Madness| U wrote:
lZombieGodl wrote:
I Could really do with some help on this, i dont understand what you mean by "Remove this and replace with a line of text" and im not sure what i should put in the 3rd' column, can you help me :)

Code: Select all

name,sequence,file,vol_min,vol_max,vol_mod,pitch_min,pitch_max,dist_min,dist_max,channel,type,probability,loop,masterslave,loadspec,subtitle,
[EDIT]compression,secondaryaliasname,volumefalloffcurve,startdelay,speakermap,reverb,lfe percentage,center percentage,platform,envelop_min,envelop_max,envelop percentage
,,,,,,,,,,,,,,,,,,,,,,,,,,,,

#Respect,,,,,,,,,,,,,,,,,,,,,,,,,,,,
respect,,mp_respect/respect.mp3,0,1,,,,100,250,auto,streamed,,looping,,,,,,,,,,,,,,,
It means that when you put this code into your csv, delete the word [EDIT] along with the square brackets, to make a single line of text from that code.
okay, ive done that, and im not getting an error anymore, but no musics playing, i think its because "- The third column is the location of the file. I recommend creating a folder "my_map" and then placing your files in there." i dont understand where im meant to put that folder, and what i write in the 3rd column

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: [Tut] Custom Sound Looping [with distance restrictions]

Post by Drofder2004 » November 10th, 2012, 2:40 pm

Sound
- When using an MP3 make sure to set the bitrate at 96kbps (the game most likely allows more, however this is the setting I used successfully), you can change the bitrate using Audacity or a similar program.
- Place the sound file inside folder "raw/sound/my_map"
Sorry, it isn't very clear. This is the folder I am referring to.

When you test you map, please use "/developer 1" (before laoding your map) and look for any errors in red text.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Post Reply

Who is online

Users browsing this forum: No registered users and 37 guests