Call of Duty 5: Sounds with Line Emitter

From COD Modding & Mapping Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Adding sound using a line emitter

Line emitters play a continuous looping sound. Good for rivers, rain, waterfalls etc, the other good thing about using a line emitter is that as you get closer to it the sound gets louder and as you walk away from it it gets quieter, which adds a certain realism to the sound as this is what would happen in real life.

The very first thing we need to do, is to make sure that you have a mp_yourmapsname.csc in raw/clientscripts/mp, if you do not have one then you need to create one, once you have created one copy and paste these lines into it, you may need to change the team nationalities as well.

Make sure you replace any reference to mp_yourmapsname with the name of your map, also! When editing files always make sure you make backup copies first.

csc file

#include clientscripts\mp\_utility;

main()
{

	// If the team nationalites change in this level's gsc file,
	// you must update the team nationality here!
	level.allies_team = "marines";
	level.axis_team   = "german";

	// _load!
	clientscripts\mp\_load::main();

        // clientscripts\mp\mp_yourmapsname_fx::main();

	thread clientscripts\mp\_fx::fx_init(0);
	thread clientscripts\mp\_audio::audio_init(0);

	// thread clientscripts\mp\mp_yourmapsname_amb::main();

	// This needs to be called after all systems have been registered.
	thread waitforclient(0);

	println("*** Client : mp_yourmapsname running...");

}

The next thing to check is you have these lines in your zone file, without these lines, especially the top one! Your sounds will not work.

zone file

rawfile,clientscripts/mp/mp_yourmapsname.csc

sound,common,mp_yourmapsname,all_mp
sound,generic,mp_yourmapsname,all_mp
sound,voiceovers,mp_yourmapsname,all_mp
sound,multiplayer,mp_yourmapsname,all_mp
sound,mp_yourmapsname,mp_yourmapsname,all_mp

Adding the line emitter

1. Right click in the 2d screen, scroll down and select script struct.

2. Place the first script struct where you want the line to start.

3. Right click in the 2d screen again and select script struct.

4. Now place the second one where you want the line to end.

5. Now deselect everything by pressing Esc.

Now you need to join them together.

1. High light the first script struct.

2. Now high light the second script struct.

3. With both of them high lighted press 'w'.

You should now see a red line appear with little arrows on it linking the two script structs together, that is your line emitter now created.

4. Press esc to deselect everything and save your map.

Now you need to decide what sound effect you want to use, for this example we are going to use 'brook_00.wav' we also need to add a label to point to the sound effect, so if you look at 'targetname' & 'script_sound' you will see that I have used the label 'brookrun' its better to use a label associated with the SFX sample you are going to use, because its a small stream I have labeled it 'brookrun'.

The next thing to do is to add the key/values to the first script struct which will play a specified sound effect from your 'soundalias' file High light the first script struct, the one with the red arrows pointing away from it and press the 'n' key to bring up the entity window.

These are the four you need to add

   KEY             VALUE

script_label       line_emitter
targetname         brookrun
script_sound       brookrun
script_looping     1

These four are generated automatically

classname          script_struct
target             auto113
angles             0 2.50448e-006 0
struct             -1651 1204.7 24

With the second script_struct these four are generated automatically so there is no need to do anything to this one.

  KEY              VALUE

angles           0 2.50448e-006 0
classname        script_struct
targetname       auto113
struct           -1651 1910 24

Also note that each script_struct should have its own unique targetname & script_sound, this way it doesn't get confused and try to play several different SFX at the same time, as you can imagine, if every script_struct had the same ones and you added a different sound effect for each one in your soundalias it would try to play all of them at the same time.

The label 'brookrun' is the first thing in the line, this is what the script_struct is looking for so it knows to play the right sound effect, once you have chosen your sound effect then you would change the path accordingly.

Now we need to make the 'soundalias' make a file in 'raw/soundaliases called mp_yourmapsname.csv, remember to replace 'yourmapsname' with the name of your map.

Now copy and paste these lines into your soundalias then save it.

name,sequence,file,platform,vol_min,vol_max,pitch_min,pitch_max,dist_min,dist_max,dist_reverb_max,limit_count,limit_type,entity_limit_count,entity_limit_type,bus,priority,spatialized,type,probability,loop,masterslave,loadspec,reverb_falloff_curve,subtitle,compression,randomize_type,secondaryaliasname,chainaliasname,volumefalloffcurve,startdelay,speakermap,reverb_send,lfe percentage,center percentage,platform,envelop_min,envelop_max,envelop percentage,occlusion_level,min_priority,max_priority,min_priority_threshold,max_priority_threshold

# Ambient SFX - Static,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
brookrun,,SFX\amb\brook\brook_00.wav,!wii,0.3,0.4,,,10,250,400,,,,,ambience,90,3d,,,looping,,,curve2,,,,,,curve2,,,,,,,50,100,0.7,0.6,20,80,0.25,1

That is your line emitter all done, Now! If you compile your map you should have a fully working line emitter.

Using a single line emitter to randomly play multiple sounds

Using a line emitter in this way will not change the sound randomly in-game, but what it will do, is each time you load the map it will pick a sound from the list and play it, so as you can imagine this adds a whole new dimension to your map inasmuch you can go to the same location each time the map is loaded and it will be playing a different sound than the last time it was loaded.

To add a line emitter refer to 'Adding sound using a line emitter' at the top of this page, everything is the same untill it comes to editing your 'soundalias' and 'script_structs

The label 'animals' is the first thing in the line, this is what the script_struct is looking for so it knows to play the right sound effect, once you have chosen your sound effects then you would change the path accordingly.

Now we need to make the 'soundalias' make a file in 'raw/soundaliases called mp_yourmapsname.csv, remember to replace 'yourmapsname' with the name of your map.

Now copy and paste these lines into your soundalias then save it.

name,sequence,file,platform,vol_min,vol_max,pitch_min,pitch_max,dist_min,dist_max,dist_reverb_max,limit_count,limit_type,entity_limit_count,entity_limit_type,bus,priority,spatialized,type,probability,loop,masterslave,loadspec,reverb_falloff_curve,subtitle,compression,randomize_type,secondaryaliasname,chainaliasname,volumefalloffcurve,startdelay,speakermap,reverb_send,lfe percentage,center percentage,platform,envelop_min,envelop_max,envelop percentage,occlusion_level,min_priority,max_priority,min_priority_threshold,max_priority_threshold

# Ambient SFX - Static,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
animals,1,SFX\amb\animals\crickets\crickets_03.wav,!wii,1,1,,,10,250,400,,,,,ambience,90,3d,,,looping,,,curve2,,,,,,curve2,,,,,,,50,100,0.7,0.6,20,80,0.25,1
animals,2,SFX\amb\animals\dog\dog_09.wav,!wii,1,1,,,10,250,400,,,,,ambience,90,3d,,,looping,,,curve2,,,,,,curve2,,,,,,,50,100,0.7,0.6,20,80,0.25,1
animals,3,SFX\amb\birds\random\bird_00.wav,!wii,1,1,,,10,250,400,,,,,ambience,90,3d,,,looping,,,curve2,,,,,,curve2,,,,,,,50,100,0.7,0.6,20,80,0.25,1
animals,4,SFX\amb\animals\odd_bug\odd_bug_00.wav,!wii,1,1,,,10,250,400,,,,,ambience,90,3d,,,looping,,,curve2,,,,,,curve2,,,,,,,50,100,0.7,0.6,20,80,0.25,1

That is your line emitter all done, Now! If you compile your map you should have a fully working line emitter.

To hear the different sound fx you would have to leave the game and reload it then go back to the bush, also! because it is selecting a sound from a list of four there is always the possibility it will load the same sound the next time you go into your map, its hit and miss I'm afraid :-)

Final note (Important)

One thing to remember is! when adding sounds to your soundalias DO NOT use the same line for your script_struct sound and your line emitter sound, it will not work.

Script_struct

cric,1,SFX\amb\animals\crickets\crickets_00.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1

Line emitter

brookrun,,SFX\amb\brook\brook_00.wav,!wii,0.3,0.4,,,10,250,400,,,,,ambience,90,3d,,,looping,,,curve2,,,,,,curve2,,,,,,,50,100,0.7,0.6,20,80,0.25,1

As you can see! From !wii onwards the two lines are totally different.


arachnofang 00:05, 5 July 2010 (UTC)