Jump to content
avengerarts

Tutorial: How to make an object play sound or music? (Radio_FM)

Recommended Posts

1- place a unit (player).

2- place an object, let's say FM Radio.

save the scenario, then go to its folder "\documents\arma 3\missions\name_of_your_scenario"

3- Create music folder "music" and put your music file or the sound file inside this folder.

4- Create "description.ext" file in that folder which is you scenario folder. open it and paste this:

class CfgSounds {
	sounds[] = {};
	
class sound1 
	{
	name = "sound1";	
	sound[] = {"music\YOURSOUNDFILE.ogg",1,1,18,1,1,1,0};	//The 18 indicates the distance at which the sound will be heard;
	titles[] = {};
	};
};

Go back to the editor "eden" and double click the object and write this in its init field:

this say3D "sound1";

That's it.

Many thanks to Feuerex who helped me a lot with his videos.

Press "Like" button if you like this post.

Resources:

The mission file.

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

If you want it to loop you can add this line below to your desired object's init field.

 

nul = [this] spawn {while {true} do {(_this select 0) say3D "sound1"; sleep 150;};};

150 at the end is how long the track/sound you are playing is. When the countdown hits 0 it'll repeat the whole script, thus putting it on a loop.

 

I decided to share this here because for some reason I had difficulty finding out how to do this and there might be others out there with the same problem.

 

Special thanks to avengerarts for making this thread in the first place!

Kind regards,

MrCrazyDude115

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites
9 hours ago, avengerarts said:

//The 18 indicates the distance at which the sound will be heard;

What are the rest of the params? 

1,1,1,0};

Share this post


Link to post
Share on other sites
1 minute ago, killzone_kid said:

What are the rest of the params? 


1,1,1,0};

 

To be honest, I don't know! but the first one is the volume "1"

 

9 hours ago, avengerarts said:

{"music\YOURSOUNDFILE.ogg",1,1,18,1,1,1,0};

 

Share this post


Link to post
Share on other sites

In multiplayer, don't forget to remoteExec say3D.

And here is the very good point of this command: you just need relative path (or class in cfgSounds).

NB: playSound3D is limited by the need of an absolute path for finding the sound. This fails in some cases whatever method you intend to extract the "mission root" (just because the returned path sometimes looks like _curMPmission.yourworld, instead of something like c:\users\...\arma3 - other Profiles\mpmissions\yourmission.yourworld).

  • 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

×