Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
Maguila.gm

Make radio play a song

Recommended Posts

I am trying to place a radio and make it to play a 3D music, however i was unsuccessfull. Can someone correct my code pls.

My attempt:

Create a description.ext file and write this:

class CfgMusic {
    tracks[] = {};
    class track1 {
        name = "song1";
        sound[] = {"\music\song1.ogg", db+0, 1.0};
    };

Then create a playMusic.sqf file and do this:

// Get the radio object
_radio = _this select 0;

// Parameters for the sound
_params = ["track1", 100, 1];

// Call the function to play the sound globally in 3D
[_radio, _params] call CBA_fnc_globalSay3d;

then in the radio initialization i wrote the following:

this execVM "playMusic.sqf";

 

Share this post


Link to post
Share on other sites

Description.ext: 

class CfgSounds 
{
	sounds[] = {};
	
	class Track01
	{
		name = "Track01";
		sound[] = {"\Music\song1.ogg", db+10, 1.0};
		titles[] = { 0, "*HEADBANGING*" };		// subtitles
		titlesFont = "LCD14";		// OFP:R - titles font family
		titlesSize = 0.05;			// OFP:R - titles font size

		forceTitles = 1;			// Arma 3 - display titles even if global show titles option is off (1) or not (0)
		titlesStructured = 1;		// Arma 3 - treat titles as Structured Text (1) or not (0)
	};	
};

In init of radio object:

this say3D "Track01";


Example Mission:
https://drive.google.com/file/d/15NAzb88tuGvRh8ZK2O4LOy8m0z9Dgcv6/view?usp=sharing

Could also name the radio "radio1" and, in initServer:

radio1 say3D "Track01";

Just remember to remove the line from radio1's init if doing it that way.
 

  • Like 1

Share this post


Link to post
Share on other sites
Sign in to follow this  

×