I'm just shocked, on a website, there are no lessons about sounds.
We need to fix this.
Sound mp3 with the use of ambientPlay (music plays continuously until the very end with a repeat, there is no default music).
The music file must be in mp3 format
In the folder raw/soundaliases we create the file mp_tutorial.csv. In it we insert this:
- name,sequence,file,vol_min,vol_max,vol_mod,pitch_min,pitch_max,dist_min,dist_max,channel,type,probability,loop,masterslave,loadspec,subtitle,compression,secondaryaliasname,volumefalloffcurve,startdelay,speakermap,reverb,lfe percentage
- #Ambiance
- ambient_mp_tutorial,,ambient/amb_tutorial.mp3,0.99,,,,,,,local,streamed,,looping,,mp_tutorial
The sound should be put in the folder raw/sound/ambient/
Now go to mp_tutorial.gsc file and change in the line ambientPlay value in parentheses to "ambient_mp_tutorial" Should look like this:
- ambientPlay("ambient_mp_tutorial");
Now open the zone file in the compiler
And we add:
- sound,mp_tutorial,,all_mp
- sound,common,mp_tutorial,!all_mp
- sound,generic,mp_tutorial,!all_mp
- sound,voiceovers,mp_tutorial,!all_mp
- sound,multiplayer,mp_tutorial,!all_mp
- sound,mp_tutorial,mp_tutorial,!all_mp
Instead of mp_tutorial - the name of the map, respectively
The penultimate step is to go to usermaps / mp_tutorial and create the sound / ambient folders, copy the song there and archive this folder as a zip archive named mp_tutorial.iwd
The last step is to remove the default music:
It's best to create a separate .GSC file, well, call it eg: _killmusic.
We paste in it what is written below:
- main()
- {
- wait 1;
- if(isDefined(game) && isDefined(game["music"]) && isDefined(game["music"]["suspense"]))
- for(i = 0;i < game["music"]["suspense"].size;i++)
- game["music"]["suspense"][i] = "null";
- }
Naturally do not forget, the new .GSC files of your scripts should be:
if multiplayer, then in the directory: raw / maps / mp / _killmusic.gsc.
if a single-user mode, then in the directory: raw / maps / _killmusic.gsc.
Now in the main mp_tutorial.gsc file, you need to add this line:
- maps\mp\_killmusic::main();
It should look something like this:
- main()
- {
- maps\mp\_killmusic::main();
- maps\mp\_load::main();
- ambientPlay("ambient_mp_tutorial");
- game["allies"] = "sas";
- game["axis"] = "opfor";
- game["attackers"] = "axis";
- game["defenders"] = "allies";
- game["allies_soldiertype"] = "woodland";
- game["axis_soldiertype"] = "woodland";
- setdvar("r_specularcolorscale", "1");
- setdvar("compassmaxrange", "2700");
- }
Alles anzeigen
Now open the zone file again in the compiler
And we add:
- rawfile,maps/mp/_killmusic.gsc
Now we can compile the fast game file and add them to usermaps / mp_tutorial.
And accordingly we add this whole thing to some MOD, and through the mod we launch the map, and we enjoy our music.