Jump to content
Alucard_Voss

Custom environment sound

Recommended Posts

Can someone explain me how or is it even possible to change the sound of environment when you are on a map, i have seen it in some of the maps but i could not find any tutorials on that. Any help is good help !

Share this post


Link to post
Share on other sites

Here's some code:

enableEnvironment false; // disables all environment sounds defined by the map's config
[position] playSound3D "yourSoundname / path/to/your/sound.ogg";

playsound3D positions the sound so its volumes increases/decreases depending on distance. Valuable.

Another solution to this: write your own config for a map that replaces all MAP's defined sounds. Not an easy task. Look for terrain config tutorials on Google or here, on BIF.

Share this post


Link to post
Share on other sites
Here's some code:

enableEnvironment false; // disables all environment sounds defined by the map's config
[position] playSound3D "yourSoundname / path/to/your/sound.ogg";

playsound3D positions the sound so its volumes increases/decreases depending on distance. Valuable.

Another solution to this: write your own config for a map that replaces all MAP's defined sounds. Not an easy task. Look for terrain config tutorials on Google or here, on BIF.

However, your code there shows that it will play only once and the directory after sound name is invalid, you will have to put a sleep action and then the soundtrack's length in order for it to loop.

What you mean is by this:

//All this can be put in the init.sqf, if theres no init.sqf in your mission folder, create one
//The script below can be done in another file other than init such as "mysound.sqf"
//To create such as "mysound.sqf", put in your init.sqf: [] execVM "mysound.sqf";

enableEnvironment false; // disables all environment sounds defined by the map's config
//If you want the sound to be played in a position, do the below script
[position] playSound3D "yourSoundname";

//If you just want the sound to play in a loop that plays forever around you, do this below
while {true} do {
playSound3D "yourSoundname";
sleep 0; //"0" represents what length the track is, so replace the 0 with your soundtrack's length
};

//Below must not be placed in init.sqf or mysound.sqf, this is ONLY for description.ext
//If there's no description.ext such as init.sqf again, create a new text and rename to description.ext

//description.ext
class CfgSounds
{
   class My_Sound1 //class name, not a real name to be used like in the editor, but like a nametag
   {
       name="Beautiful Birds Singing Away "; //name of sound you are going to use such as in: playSound3D "yourSoundName";
       sound[]={\my sound folder\mysound1.ogg,1,1}; //Directory of sound
       titles[]={};
   };
};

Share this post


Link to post
Share on other sites

Bornholm is a custom map. Ambient sounds are written into the map config and the engine will automatically play them. Scripting is not required

Kinda weird that a master coder didn't know that

However, if you are trying to change the sounds played in a map that already exists, then you will need to use some kind of loop similar to the example above

Share this post


Link to post
Share on other sites
On 3/31/2015 at 5:32 AM, Ranwer135 said:

However, your code there shows that it will play only once and the directory after sound name is invalid, you will have to put a sleep action and then the soundtrack's length in order for it to loop.

What you mean is by this:

 


//All this can be put in the init.sqf, if theres no init.sqf in your mission folder, create one
//The script below can be done in another file other than init such as "mysound.sqf"
//To create such as "mysound.sqf", put in your init.sqf: [] execVM "mysound.sqf";

enableEnvironment false; // disables all environment sounds defined by the map's config
//If you want the sound to be played in a position, do the below script
[position] playSound3D "yourSoundname";

//If you just want the sound to play in a loop that plays forever around you, do this below
while {true} do {
playSound3D "yourSoundname";
sleep 0; //"0" represents what length the track is, so replace the 0 with your soundtrack's length
};

//Below must not be placed in init.sqf or mysound.sqf, this is ONLY for description.ext
//If there's no description.ext such as init.sqf again, create a new text and rename to description.ext

//description.ext
class CfgSounds
{
   class My_Sound1 //class name, not a real name to be used like in the editor, but like a nametag
   {
       name="Beautiful Birds Singing Away "; //name of sound you are going to use such as in: playSound3D "yourSoundName";
       sound[]={\my sound folder\mysound1.ogg,1,1}; //Directory of sound
       titles[]={};
   };
};
 

 

 

Sooo.... here I am reviving a 3 year old post :D

 

Am I supposed to write the position that I want the sound to be played at, like this?

[23558.902, 21130.393, 0] playSound3D "Radio2";

 

Share this post


Link to post
Share on other sites
5 hours ago, smirlianos said:

[23558.902, 21130.393, 0] playSound3D "Radio2";

 

I "think" so. Probable need an extension on your sound file though. Ex. "radio2.ogg";

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×