Call of Duty 5: Sounds with Struct: Difference between revisions

From COD Modding & Mapping Wiki
Jump to navigation Jump to search
mNo edit summary
 
(12 intermediate revisions by 2 users not shown)
Line 6: Line 6:
Its actually very easy and straight forward, we are going to start by adding one sound to your map then we will move on to adding several sounds.
Its actually very easy and straight forward, we are going to start by adding one sound to your map then we will move on to adding several sounds.


Make sure you replace any reference to mp_yourmapsname with the name of your map.
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 ==
== csc file ==
Line 12: Line 12:
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.
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.


<pre> #include clientscripts\mp\_utility;
<syntaxhighlight>
#include clientscripts\mp\_utility;


main()
main()
Line 37: Line 38:
println("*** Client : mp_yourmapsname running...");
println("*** Client : mp_yourmapsname running...");


} </pre>
}  
</syntaxhighlight>


== Zone file ==
== Zone file ==
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.
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.


<pre>
<syntaxhighlight>
rawfile,clientscripts/mp/mp_yourmapsname.csc
rawfile,clientscripts/mp/mp_yourmapsname.csc


Line 50: Line 52:
sound,multiplayer,mp_yourmapsname,all_mp
sound,multiplayer,mp_yourmapsname,all_mp
sound,mp_yourmapsname,mp_yourmapsname,all_mp
sound,mp_yourmapsname,mp_yourmapsname,all_mp
</pre>
</syntaxhighlight>


Putting script structs in the right place will make the overall ambience a lot more atmospheric.
Putting script structs in the right place will make the overall ambience a lot more atmospheric.


crickets  = ground
1.Crickets = ground
flies     = in the air
 
birds    = in the trees
2.flies = air
 
3.Birds = trees, air


and so on
and so on
Line 107: Line 111:
Now we need to make the 'soundalias' make a file in 'raw/soundaliases called mp_yourmapsname.csv, once you have done that copy and paste these lines into your soundalias then save it.
Now we need to make the 'soundalias' make a file in 'raw/soundaliases called mp_yourmapsname.csv, once you have done that copy and paste these lines into your soundalias then save it.


<pre>
<syntaxhighlight>
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
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,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
# Ambient SFX - Static,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
cric,,SFX\amb\animals\crickets\crickets_03.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1
cric,,SFX\amb\animals\crickets\crickets_03.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1
</pre>
</syntaxhighlight>


That is your single script_struct all done, Now! If you compile your map you should have a fully working
That is your single script_struct all done, Now! If you compile your map you should have a fully working
script struct playing a sound of a cricket.
script struct playing a sound of a cricket.


== Playing multiple souds from a single script_struct ==
== Playing multiple sounds from a single script_struct ==
 
Please ensure that you have followed steps 2, 3, 4 and 5 at the top of this page, everything is the same untill it comes to editing your soundalias & script struct.
 
Your script struct for this example would have the label "fauna" Like so!
 
<pre>
  KEY                VALUE
 
targetname            fauna
script_sound          fauna
</pre>
 
If you look at the first line and the line below that one you will see there are two differences, the number
one has been added at the beginning of the line and the sound effect is a different one, but all use the same
label 'fauna'.
 
<syntaxhighlight>
fauna,,SFX\amb\birds\owl\owl_00.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1
 
fauna,1,SFX\amb\birds\random\bird_00.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1
    /\                          /\
</syntaxhighlight>


Please ensure that you have followed steps 2, 3, 4 and 5.
And this is how you would play several different sounds using a single script struct, using crickets as an
example, this is what it would look like.
 
<syntaxhighlight>
fauna,1,SFX\amb\birds\owl\owl_00.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1
fauna,2,SFX\amb\birds\random\bird_00.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1
fauna,3,SFX\amb\birds\random\bird_03.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1
fauna,4,SFX\amb\birds\tawny\tawny_03.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1
</syntaxhighlight>
 
So now! Your soundalias would look like this.
 
<syntaxhighlight>
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,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
fauna,1,SFX\amb\birds\owl\owl_00.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1
fauna,2,SFX\amb\birds\random\bird_00.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1
fauna,3,SFX\amb\birds\random\bird_03.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1
fauna,4,SFX\amb\birds\tawny\tawny_03.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1
</syntaxhighlight>
 
 
Thats it! You now know how to add sounds using script_structs, as I said earlier it is fairly easy and straight forward, but I can assure you, when you have done it once you can do it time & time again.


== Custom sounds ==
== Custom sounds ==
Line 140: Line 189:


[http://www.soft82.com/download/Windows/WavePad Get Windows Wavepad]
[http://www.soft82.com/download/Windows/WavePad Get Windows Wavepad]
== 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
<syntaxhighlight>
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
</syntaxhighlight>
Line emitter
<syntaxhighlight>
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
</syntaxhighlight>
As you can see! From !wii onwards the two lines are totally different.
[[User:Arachnofang|arachnofang]] 00:07, 5 July 2010 (UTC)
[[Category:Call of Duty 5]]
[[Category:Sounds]]
[[Category:Audio]]
[[Category:Advanced Editing]]

Latest revision as of 17:40, 7 February 2012

This tutorial describe an alternative method to add Sound in a map using Radiant and a few scripts.

Playing a single sound using a script_struct

The way I'm going to show you how to use script_structs is basically the same way they did it in mp_castle. Its actually very easy and straight forward, we are going to start by adding one sound to your map then we will move on to adding several sounds.

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

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.

#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...");

}

Zone file

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.

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

Putting script structs in the right place will make the overall ambience a lot more atmospheric.

1.Crickets = ground

2.flies = air

3.Birds = trees, air

and so on

For this example we are going to use 'crickets_03.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 'cric' its better to use a label associated with the SFX sample you are going to use, because its crickets I want to use, I have labeled it 'cric'.

Adding the script struct

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

2. Place the script struct where you want the sound effect to play from.

The next thing to do is to add the key/values to the script struct which will play a specified sound effect from your 'soundalias' file.

High light the script struct and press the 'n' key to bring up the entity window.

These are the five you need to add

   KEY                  VALUE

script_label          random
targetname            cric
script_sound          cric
script_wait_min       10
script_wait_max       20

These two are generated automatically

classname            script_struct
origin               334.3 335.3 25

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 'cric' 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.

Soundalias

Now we need to make the 'soundalias' make a file in 'raw/soundaliases called mp_yourmapsname.csv, once you have done that 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,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
cric,,SFX\amb\animals\crickets\crickets_03.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1

That is your single script_struct all done, Now! If you compile your map you should have a fully working script struct playing a sound of a cricket.

Playing multiple sounds from a single script_struct

Please ensure that you have followed steps 2, 3, 4 and 5 at the top of this page, everything is the same untill it comes to editing your soundalias & script struct.

Your script struct for this example would have the label "fauna" Like so!

   KEY                VALUE

targetname            fauna
script_sound          fauna

If you look at the first line and the line below that one you will see there are two differences, the number one has been added at the beginning of the line and the sound effect is a different one, but all use the same label 'fauna'.

fauna,,SFX\amb\birds\owl\owl_00.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1

fauna,1,SFX\amb\birds\random\bird_00.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1
     /\                          /\

And this is how you would play several different sounds using a single script struct, using crickets as an example, this is what it would look like.

fauna,1,SFX\amb\birds\owl\owl_00.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1
fauna,2,SFX\amb\birds\random\bird_00.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1
fauna,3,SFX\amb\birds\random\bird_03.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1
fauna,4,SFX\amb\birds\tawny\tawny_03.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1

So now! Your soundalias would look like this.

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,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
fauna,1,SFX\amb\birds\owl\owl_00.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1
fauna,2,SFX\amb\birds\random\bird_00.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1
fauna,3,SFX\amb\birds\random\bird_03.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1
fauna,4,SFX\amb\birds\tawny\tawny_03.wav,!wii,1,1,1,1,500,800,1200,,,,,ambience,60,3d,,0.8,,,,curve3,,,,,,curve2,,,,,,,,,,0.5,30,50,0.2,1


Thats it! You now know how to add sounds using script_structs, as I said earlier it is fairly easy and straight forward, but I can assure you, when you have done it once you can do it time & time again.

Custom sounds

If you use custom sounds they need to be a certain format,

pcm uncompressed
44100hz 8bits mono

Also! You will need to make a folder called 'custom'

raw/sound/SFX/custom

Any custom sounds you use are to go in this folder, the main reason is to keep your custom sounds seperate from the stock ones, this makes it less confusing as you will always know where your custom sounds are.

Personally I use a program called Wavepad.

Get Windows Wavepad

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:07, 5 July 2010 (UTC)