Jump to content
novainfuse

CfgMusic & CfgSound won't work

Recommended Posts

I've searched for this answer all day, but all the results I've found don't seem to actually get this to work. 

 

I currently have a music folder with a stero .ogg file inside titled "villagemusic". I want this to play when the players hit a trigger. 

 

This is currently my description which has been taken from the wiki (I have also tried it with 

 

class CfgMusic
{
	tracks[]={villagemusic,entermusic};

	class villagemusic
	{
            name = "villagemusic";
            sound[] = {\music\villagemusic.ogg, db+10, 0};
            titles[] = {2,"entering village"};
	};
	class entermusic
	{
		name = "entermusic";
		sound[] = {"\music\entermusic.ogg", db+10, 1.0};
	};
};

However, when I go into game and try and run it from the playmusic command I get one of two results: 1) Nothing happens. No message, the trigger fires (it's linked to other create tasks) but no music is player; or, 2) I get a message saying "Can't find sound/music villagemusic."

 

Is there something I'm doing wrong here? I want to pull my hair out...this is something so simple but it's causing me so much grief. 

 

This was all done on testing in singleplayer, however, I was told that as this was for multiplayer game I need to run it through a script. Well, in my music folder is an SQF file titled playvillagemusic, with the code: playMusic "villagemusic";

I am then trying to run it from the trigger with remoteExec ["playvillagemusic"]; 

 

This is also in my init for the above MP fix: 

villagemusic = compile (preprocessFileLineNumbers "\music\playvillagemusic.sqf");

 

JUST TO CONFIRM: The music still will not play when I try it without the script (eg. The singleplayer method of just running a playmusic command). I am 100% sure that it is the right file, and that the music file is within my music subfolder. I have also tried grouping everything under Cfgsounds (and changing all the commands to fit), but again, this does not seem to fix the problem. My volume is up full, and I have also tried using the fademusic command.

 

I will name my first son or daughter after anyone who can help me get this to work.

Share this post


Link to post
Share on other sites
sound[] = {\music\villagemusic.ogg, db+10, 0};

Put the path into quotation marks and also try to set 0 to 1.0

Share this post


Link to post
Share on other sites

When putting this into the description.ext of the mission file, doesn't the path have to start with @ ? At least I remember reading that.

Share this post


Link to post
Share on other sites
6 hours ago, R3vo said:

sound[] = {\music\villagemusic.ogg, db+10, 0};

Put the path into quotation marks and also try to set 0 to 1.0

 

I've tried adding in the quotation marks, and also changing the 0. I'm not getting a missing message, but the music isn't starting when I hit the trigger still.

 

2 hours ago, lexx said:

When putting this into the description.ext of the mission file, doesn't the path have to start with @ ? At least I remember reading that.

 

Is that before the slash? I'll try and see what it does.

 

Edit: Just tried this and it didn't work.

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/Description.ext#CfgSounds

Try the example on the Wiki, it worked, last time I tried it. :P

6 hours ago, lexx said:

When putting this into the description.ext of the mission file, doesn't the path have to start with @ ? At least I remember reading that.

Quote

NOTE: Since Arma 3 v1.49.131710 it is possible to define AddOn sounds in mission config. In order to make engine look for the sound in AddOn, the sound path must start with @ (instead of \) for example:

Quote

Is that before the slash? I'll try and see what it does.

You do not need the \ as the sounds are in the mission folder I assume.

Share this post


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

https://community.bistudio.com/wiki/Description.ext#CfgSounds

Try the example on the Wiki, it worked, last time I tried it. :P

 

 

That was for CfgSound. Trying to get music picking up the file. However, I did try the CfgSound before (pulled that one straight from the wiki) and it wasn't managing to start the sound file.

Share this post


Link to post
Share on other sites

Your thread title is:

" CfgMusic & CfgSound won't work "

But here:

https://community.bistudio.com/wiki/Description.ext#CfgMusic

You are doing something wrong, I shall test the examples on the Wiki now and update my post shortly.

 

EDIT:

class CfgSounds
{
	sounds[] = {};
	class sound
	{
		name = "Some Sound";
		sound[] = {"@a3\Ui_F_Curator\Data\Sound\CfgSound\visionMode", 0.8, 1, 100};
		titles[] = {1, "Sound plays"};
	};
};

class CfgMusic
{
	sounds[] = {};
	class music
	{
		name = "Some Music";
		sound[] = {"audio\music.ogg", db+10, 1.0};
		titles[] = {1, "Music plays"};
	};
};
playSound "sound";
playMusic "music";

Works fine.

Share this post


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

Your thread title is:

" CfgMusic & CfgSound won't work "

But here:

https://community.bistudio.com/wiki/Description.ext#CfgMusic

You are doing something wrong, I shall test the examples on the Wiki now and update my post shortly.

 

EDIT:


class CfgSounds
{
	sounds[] = {};
	class sound
	{
		name = "Some Sound";
		sound[] = {"@a3\Ui_F_Curator\Data\Sound\CfgSound\visionMode", 0.8, 1, 100};
		titles[] = {1, "Sound plays"};
	};
};

class CfgMusic
{
	sounds[] = {};
	class music
	{
		name = "Some Music";
		sound[] = {"audio\music.ogg", db+10, 1.0};
		titles[] = {1, "Music plays"};
	};
};

playSound "sound";
playMusic "music";

Works fine.

 

I literally just copied the example that you put above for the CfgMusic and put it in my description (even made a new file called audio, as you have done, and renamed my sound file to music). It is still not working. Can you tell me how you got it to work? I simply have it activating off a trigger, but still nothing...

Share this post


Link to post
Share on other sites

Could you upload your mission file for others to take a look?

 

If you followed HazJ's template and it still isn't working for you, maybe there is a problem with your .ogg files. Are they formatted properly?

Of course, never overlook the obvious....your music volume is activated in game options?

 

This is also a very good guide for all things related to sound....

http://ofp.toadlife.net/downloads/tutorials/tutorial_sound/tutorial_sound.html 

Share this post


Link to post
Share on other sites
8 minutes ago, Evil Organ said:

Could you upload your mission file for others to take a look?

 

If you followed HazJ's template and it still isn't working for you, maybe there is a problem with your .ogg files. Are they formatted properly?

Of course, never overlook the obvious....your music volume is activated in game options?

 

This is also a very good guide for all things related to sound....

http://ofp.toadlife.net/downloads/tutorials/tutorial_sound/tutorial_sound.html 

 

Yeah it's at maximum (it was the first thing I thought of). 

 

I changed a couple of the files around, but this is with the copied template from above: https://mega.nz/#F!bxACnRRB!IYiHUVUOwBtBWYwNE0pvcA 

 

That is also the version with the aforementioned MP fix inside. I will also check out that link to see if I'm missing anything.

 

 

 

 

Share this post


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

Ran a test in VR with your exitmusic.ogg file, everything checks out fine. Sample mission

 

The arma magic seems to not be strong with me tonight. Thank you for your test.

 

I tried copying everything, however, when I open up a trigger I don't have the option to select the song (as you have done in your test mission). I tried to run it manually with a playmusic, and to no avail once more.

 

Literally all I can think of that might be causing this is that it's in the mpmission folder? But I assumed that didn't have any affect on the actual mission file? Edit: And I just tried putting it into an SP folder and the playMusic is still not working, nor is the file showing up in the tirgger as you have in your test mission.

Share this post


Link to post
Share on other sites
Quote

nor is the file showing up in the tirgger as you have in your test mission.

That is a clear hint that the description.ext is not properly read.

Actually the very first thing when I loaded your mission into the editor was this error message:

co_24_jip_codenamemuteki.Altis\description.ext, line 6: '.': ';' encountered instead of '='

So your description.ext stops "loading" there (well, the problem it's actually on line 5, but still).

So, this is wrong:

Quote

#include "downloadData.hpp";

Remove the ; and it all works fine..
Never use "end-of-line" with single line preprocessor command. Line breaks don't work like that with them in general, and furthermore don't work at all with #include

  • Like 1

Share this post


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

That is a clear hint that the description.ext is not properly read.

Actually the very first thing when I loaded your mission into the editor was this error message:


co_24_jip_codenamemuteki.Altis\description.ext, line 6: '.': ';' encountered instead of '='

So your description.ext stops "loading" there (well, the problem it's actually on line 5, but still).

So, this is wrong:

Remove the ; and it all works fine..
Never use "end-of-line" with single line preprocessor command. Line breaks don't work like that with them in general, and furthermore don't work at all with #include

 

I just removed the ";" at the end of the line. Thank you for telling me about that, I will remember it for the future.

 

Although the music name is now showing up in the trigger (!), whenever I step into it (after selection it to trigger on blufor or player) the music still does not seem to be firing. 

Share this post


Link to post
Share on other sites

Weird, it worked when I tested with the description.ext and stuff in the files you posted a couple of messages above, the music played (entermusic.ogg) and so on.
Put something like hint "DING!" in the trigger activation field to make sure it gets triggered :shrug:

You could also post the latest CfgMusic entry.

Share this post


Link to post
Share on other sites

Yeah I don't understand why it's not working... I have it showing up in the trigger and it is selected. I tried the hint thing and it was showing up as triggering.

 

Here is the description:

 

overviewText = "Codename Muteki";
overviewTextLocked = "Codename Muteki";
overviewPicture = "codenamemutekiloading.paa";
author = "NovaInfuse";
#include "downloadData.hpp"

class CfgMusic
{
	sounds[] = {entermusic};
	class music
	{
		name = "entermusic";
		sound[] = {"sound\entermusic.ogg", db+10, 1.0};
		titles[] = {1, "Music plays"};
	};
};

 

And then I have also uploaded the files once more to show that I have adjusted the file structure... 

 

https://mega.nz/#F!r8AUyaoL!9VkKkokvN1vNJOIVII19WA

 

 

Share this post


Link to post
Share on other sites

Well this is indeed odd, works for me just fine :shrug:

The only difference is that as I don't have all those thousand addons/mods the scenario requires so I'm testing this with my own almost empty scenario (just a dude and a trigger playing the music).
Try saving an empty scenario, move all the files except mission.sqm into that new scenario folder, load the empty scenario (just to make sure the description.ext is "read in") and test again. If that works then it's something awry somewheres else than your description.ext...

  • Like 1

Share this post


Link to post
Share on other sites

Agreed. ^^

My sample mission from earlier works fine for me too, just a blufor guy inside a trigger listening to entermusic.

 

@novainfuse have you enabled "entermusic" in the Trigger Effects box?.....

6VWjrcB.jpg

 

Share this post


Link to post
Share on other sites

https://1drv.ms/u/s!ArYSs9w5RSIDhDv2D6LsHmeiMFNI

Example mission. Press Esc and put the following in debug console to test them.

playSound "sound"; // do this one first
playMusic "music"; // then do this after - just so you can hear it better

 

Share this post


Link to post
Share on other sites
8 hours ago, h - said:

Well this is indeed odd, works for me just fine :shrug:

The only difference is that as I don't have all those thousand addons/mods the scenario requires so I'm testing this with my own almost empty scenario (just a dude and a trigger playing the music).
Try saving an empty scenario, move all the files except mission.sqm into that new scenario folder, load the empty scenario (just to make sure the description.ext is "read in") and test again. If that works then it's something awry somewheres else than your description.ext...

 

Okay. So. I just woke up and tested this. I created a new empty mission (no add ons) and I make the trigger, with the music etc. That worked fine. That was with 0 add ons but the same scripts. So, I'm going to assume from that that it would be something to do with the addons I am using? Is there a sure-fire way to check this, or do I need to load each one and see when the music stops? (Edit update - See below)

 

6 hours ago, HazJ said:

https://1drv.ms/u/s!ArYSs9w5RSIDhDv2D6LsHmeiMFNI

Example mission. Press Esc and put the following in debug console to test them.


playSound "sound"; // do this one first
playMusic "music"; // then do this after - just so you can hear it better

 

 

Yep, tried it, that works perfectly.

 

8 hours ago, Evil Organ said:

Agreed. ^^

My sample mission from earlier works fine for me too, just a blufor guy inside a trigger listening to entermusic.

 

@novainfuse have you enabled "entermusic" in the Trigger Effects box?.....

6VWjrcB.jpg

 

 

Yes I did. I make sure to select it and press okay. I assumed there wasn't something else I needed to do with it?

 

Edit: 

 

I just created a new mission (see above) and decided to go in there with that list of addons that I have. When I walked into the trigger everything went fine. New mission, full addonlist = the music plays.

 

From that (once I've put on my Sherlock hat) it seems that these is SOMETHING in the actual mission file which is causing sound/music to not be played? 

https://mega.nz/#!vp4wVb5J!ut5GP92byf9alj7FFr7EOqXNyuO2qoqbAiFqyx6MLAE

 

I will be going through the .sqm later and removing all of the mods that aren't needed for our server/mission making. However, there were previously some scripts I had on the map (e.g. the sushi breach script fix version) which I ended up removing. Once the folders and in-game code is deleted, will there be any remanents of it? Want to make sure I'm ticking all the boxes here. 

Edited by novainfuse

Share this post


Link to post
Share on other sites
7 hours ago, novainfuse said:

 

From that (once I've put on my Sherlock hat) it seems that these is SOMETHING in the actual mission file which is causing sound/music to not be played? 

You could try simply merging the whole scenario into a new empty one and moving all the data (excluding the mission.sqm of course) into that new folder to see if that fixes it :shrug:

Share this post


Link to post
Share on other sites
3 hours ago, h - said:

You could try simply merging the whole scenario into a new empty one and moving all the data (excluding the mission.sqm of course) into that new folder to see if that fixes it :shrug:

 

Oh, how would I go about that? Isn't all the data and assets saved via the mission.sqm? I might be misunderstanding you though.

Share this post


Link to post
Share on other sites

- In the editor make sure you have an empty scenario (New Scenario), press CTRL+M (or select Scenario -> Merge) and select your troublesome scenario from the list and press Merge, and OK to the subsequent prompt.
- All the stuff in the merged scenario will be merged into the currently open scenario except any of the physical external files. Also no entity is set as player anymore so you need to remedy that and then save the scenario.

- Then move the scripts and stuff from the troublesome scenario folder into this new scenario folder, load the new scenario (to make sure description.ext is "read") and test.

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

×