Jump to content
Fipler

Playing Music over addaction

Recommended Posts

Hi lads, so iam currently working on a Vietnam Mission for me and my Bois and i would like to be able to play some music tracks over the addaction menu, but i dont know how for the love of God how to do it.

I have the tracks prepared in my description.ext which looks like that:

 

class CfgMusic
{
    tracks[]={};
 
    class Vietnam
    {
        name = "Vietnam";
        sound[] = {"\sound\Fortunate Son", db+0, 1.0};
    };
    class All right now
    {
        name = "All right now";
        sound[] = {"\sound\Free - All Right Now.ogg", db+0, 1.0};
    };
};

 

Iam wondering if that is allright and if yes how i make it that i can play the music over addaction.

Thx for the help in advance.

Share this post


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

Hi lads, so iam currently working on a Vietnam Mission for me and my Bois and i would like to be able to play some music tracks over the addaction menu, but i dont know how for the love of God how to do it.

I have the tracks prepared in my description.ext which looks like that:

 

class CfgMusic
{
    tracks[]={};
 
    class Vietnam
    {
        name = "Vietnam";
        sound[] = {"\sound\Fortunate Son", db+0, 1.0};
    };
    class All right now
    {
        name = "All right now";
        sound[] = {"\sound\Free - All Right Now.ogg", db+0, 1.0};
    };
};

 

Iam wondering if that is allright and if yes how i make it that i can play the music over addaction.

Thx for the help in advance.

 

Not 100% sure but I guess filenames with spaces get the space replaced with %20, so you need to replace spaces with underscores:

sound[] = {"\sound\Free_-_All_Right_Now.ogg", db+0, 1.0};

Might give that a try.

 

Cheers

Share this post


Link to post
Share on other sites

Cheers mate, thx for the tipp didnt even knew that nut what do i have to put in the Init file to be able to play the music over the addaction menu?

 

Share this post


Link to post
Share on other sites

Hey @Fipler, welcome to the forums!

I just want to be sure on what you mean here. "Addaction" lets you add an interaction option (the list you get when scrolling with the mouse wheel) for a player, when they are looking at a specific ingame object.

Here's a quick example:

this addAction [("<t color='#FFFFFF'>" + ("Play Music") + "</t>"),{playMusic "Vietnam";},"",1,true,true,"","(_target distance _this) < 5"]; 

^ Paste this into an object's init.

For details on how the syntax works, I refer you to the Bohemia Interactive Wiki:
https://community.bistudio.com/wiki/addAction
https://community.bistudio.com/wiki/playMusic

If you wanted to start the music another way, such as the radio commands (which you get when you press Backspace, eg when calling artillery), then I would just make a trigger in the editor, choose radio from the dropdown menu for activation type, and put-
 

playMusic "Vietnam";

In it's activation field.

Hope that answers your question! 

  • Like 1

Share this post


Link to post
Share on other sites

You need to use the addAction command to play music with playMusic. For example:

sqf
Copy the code
this addAction ["Play Vietnam", {playMusic "Vietnam";}];
Make sure the path and format of the audio file are correct.

Share this post


Link to post
Share on other sites

If it's MP:

this addAction ["Play Vietnam", {["Vietnam"] remoteExec ["playMusic", _caller];}];


I was wrong.

Share this post


Link to post
Share on other sites
1 hour ago, Northup said:

If it's MP:

this addAction ["Play Vietnam", {["Vietnam"] remoteExec ["playMusic", _caller];}];

😕

the addAction code is already local to the caller (GA LE). You don't need to remoteExec playMusic on caller.

Share this post


Link to post
Share on other sites
On 12/22/2024 at 7:47 AM, pierremgi said:

😕

the addAction code is already local to the caller (GA LE). You don't need to remoteExec playMusic on caller.

Derp. Youre right. My bad. Thanks for the correction @pierremgi

 

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

×