Call of Duty 5: Sounds with Struct: Difference between revisions
Arachnofang (talk | contribs) |
Arachnofang (talk | contribs) |
||
Line 119: | Line 119: | ||
* line 2 | * line 2 | ||
=== | === sub chapter 2 === | ||
* '''BOLD''' | * '''BOLD''' |
Revision as of 17:11, 2 July 2010
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.
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.
crickets = ground flies = in the air birds = in the trees
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.
sub chapter 1
- line 1
- line 2
sub chapter 2
- BOLD
- Italic
Chapter 2
And so it goes ....