Jump to content
Sign in to follow this  
Spartan4ever

Playing custom directional sound

Recommended Posts

Hello guys, so first of all i'd like to apologize if the following post is a bit hard to understand, because english isn't my mothertongue and plus it is a long time i didnt wrote in that language...

So past the formalities, id like to ask something.

I'm editing a training mission for my clan and i'd like to play a sound that can be heard by those who are in the base but not like if the soldier's player had the sound in his earplugs but something more distant...

My intention is to set a scene that will be like militaries running around while singing a song.

Share this post


Link to post
Share on other sites

You can make object play a sound so you will hear that sound at different volume related to the distance:

http://community.bistudio.com/wiki/say

Italian translation:

Se sei italiano, puoi usare quel comando per far partire il suono dalla posizione di un oggetto o di un soldato, in modo che senti il suono in base alla distanza.

Inviato dal mio GT-I9300 con Tapatalk 4

Edited by Antorugby

Share this post


Link to post
Share on other sites

Im not very proeficient with editing, so if someone could explain me how to code that thing that would be kind, i get that i have to put the code into the init field of a unit? does empty units work also?

Share this post


Link to post
Share on other sites

First of all you should place the sound file in your mission folder, the file should be. Ogg.

Then you create a description.ext with this inside:

 class CfgSounds

{

sounds[yoursoundname] = {};

class yousoundname

{

name = "yoursoundname";

sound[] = {"yoursoundname.ogg", 1, 1};

};

};

[code]

Then you put in a trigger that you choose to activate how you want this in the activation field:

nameofyourobject say "yoursoundname"

Remember that you have to save the mission after you edited the description.ext to make the change effective.

The object can be a unit or even an empty object I guess.

Inviato dal mio GT-I9300 con Tapatalk 4

Share this post


Link to post
Share on other sites

I gotta put [ code ] or [ /code ] (without the spaces) at the end? just to be sure...

(Edit: )

I putted this:

 class CfgSounds
{
sounds[uSMC_Cad] = {};
class USMC_Cad
{
name = "USMC_Cad";
sound[] = {"USMC_Cad.ogg", 1, 1};
};
};
[/c o d e] 

Should work isn't it?

(2nd Edit: )

Now on loading the mission i get:

---------------------------
Arma 3
---------------------------
File C:\Users\Remi\Documents\Arma 3 - Other Profiles\-=]ToS[=-Ser%2eSpartan\missions\Tossic_Training.Altis\description.ext, line 0: Config: .: 'c' encountered instead of ']'
---------------------------
OK   
---------------------------

I guess i fucked somewhere.

(3rd Edit: )
I figured out the problem for this error the code is:

[code] class CfgSounds
{
sounds[] = { USMC_Cad };
class USMC_Cad
{
name = "USMC_Cad";
sound[] = {"USMC_Cad.ogg", 1, 1};
};
};

buuut, now im getting another error while IG (at least my game doesnt crashes anymore):

No entry 'C:\Users\Remi\Documents\Arma 3 - Other Profiles\-=]ToS[=-Ser%2eSpartan\missions\Tossic_Training.Altis\description.ext/CfgSounds/USMC_Cad.titles'.

I guess i have to put a title somewhere but at least the sound plays.

Now here come the second question: How do i make it repeat infinite times? (when the music stops it restarts from the beginning and so on)

Edited by Spartan4ever

Share this post


Link to post
Share on other sites

Try pasting this:

class CfgSounds
{
sounds[] = {};


class USMC_Cad
{
	name = "USMC_Cad";
	sound[] = {"USMC_Cad.ogg", 1,1};
	titles[] = {};
};
};

Share this post


Link to post
Share on other sites

To me it seems that the say and say3D are not working properly right now. I tried making a guy whistle but you could actually hear it from veeeeeryyy far away. and lowering the volume made it just quieter but had no effect to the distance.

Share this post


Link to post
Share on other sites

This code works fine, you dont hear anything if too far away, and sound gets louder as you come closer to the bunker emitting it.

Now i'm searching how to make it loop, anyone?

Share this post


Link to post
Share on other sites

Try this in a script:

 
while {true} do
{
nameofyourobject say "yoursoundname";
sleep 60; //You have to use the length of your sound in seconds
};

And then in the trigger activation you call your script with this:

Soundscript = [] execVM "nameofypurscript.sqf"

Inviato dal mio GT-I9300 con Tapatalk 4

Share this post


Link to post
Share on other sites

Love ya man! Works like a charm.

Also thank you Das Attorney for removing me that annoying error msg.

Edited by Spartan4ever

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
Sign in to follow this  

×