Jump to content
Sign in to follow this  
ZNorQ

My custom resource addon with sounds..

Recommended Posts

I'm creating 8 to 10 MP COOP missions, and there are alot of resources (pictures, sounds, etc) that is utilitzed in some/all of these. That is, some of the same sounds / pics are used in several of the missions. So I decided to create a custom resource addon called "nsf4_resources.pbo" which will contain all these recyclable resources.

The resource addon contains the file $PBOPREFIX$, which in turn contains "nsf4\res" (without the quotes, ofcourse). There isn't a "return" either.

The folder structure in the resource is as followed;

- bat

- gfx

- sfx

Now, these should be pretty much self-explanatory, but I'll explain anyway; Any resource that are re-used goes in these - and they are scripts (bat), graphics (gfx) and sounds (sfx).

The problem for me is that I can't seem to make the sounds work. There is a specific sound - "radio_squark.ogg" that is located in sfx, and this is the class definition in description.ext;

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class CfgSounds {

sounds[] = {Radio_Squark};

class Radio_Squark {

name="Radio Squark";

sound[]={"\nsf4\res\sfx\radio_squark.ogg", db+20, 1.0};

titles[] = {};};

};

When playing the sounds, I use this command; playSound "Radio_Squark";

Now, keep in mind that if I create a "sfx" folder in the mission folder itself, and update the class config to reference to this folder instead of the resource - it works!

Also, I have a flag in the gfx folder in the resource file - and I use this command to apply it to a flagpole; this setFlagTexture "\nsf4\res\gfx\flags\nsfflag.jpg". This also works, so the path seems fine...

Can anybody spot the error?

ZNorQ

Share this post


Link to post
Share on other sites

try removing

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">sounds[] = {Radio_Squark};

if thats not the error, its the pboprefix. there is a thread about it, with pathes .. etc. dunno at the moment.

but first try the sounds[] array removal.

regards

rocko

Share this post


Link to post
Share on other sites

second:

if you define sounds in the "addon" you dont need to define the sounds in the description.ext.

if you just copy the sounds into your addon without a sounds config the description.ext wont access the sound files in your addon.

you need to define the sounds in you config.cpp /.bin

then you can easily call the sounds with say or playsound command

edit:

your resources for sounds would look like this in your config.cpp

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgSounds {

class Radio_Squark {

name="Radio Squark";

sound[]={"\nsf4\res\sfx\radio_squark.ogg", db+20, 1.0};

titles[] = {};};

};

but interesting graphics work this way but no sounds

Share this post


Link to post
Share on other sites

Ricki,

Thanks for your feedback, but I just can't make it work. At one point I was starting to wonder if ArmA loaded the resource file at all in the startup, but I can verify that it does, because I'm also using a flag texture that is only located in the resource file - and that works. (The path to the flag texture is \nsf4\res\gfx\flags\nsfflag.jpg.)

Considering that the pbo file itself is called nsf4_resources.pbo, and the $PBOPREFIX$ file contains nsf4\res, it seems to me that the $PBOPREFIX$ path reference works, ie., references starting with \nsf4\res\ seems to be valid..

This is the whole content of config.cpp in nsf4_resources.pbo (Perhaps I'm missing some elements?);

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgSounds {

  class Radio_Squark {

     name="Radio Squark";

     sound[]={"\nsf4\res\sfx\radio_squark.ogg", db+20, 1.0};

     titles[] = {0,""};

  };

};

This is the file- and folder structure in the resource pbo;

 bat

 gfx

   flags

     nsfflag.jpg

 sfx

   radio_squark.ogg

(There are other files, but those are of no relevance in this example..)

Kenneth aka ZNorQ

Share this post


Link to post
Share on other sites

hi

just for interest:

[did you try leaving the pboprefix and renaming the .pbo file only to nfs4 ?

wondering WHAT will happen if you do like the above.]

the problem itself:

maybe if you have a pboprefix and call \nfs4\res

only add in config.cpp

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">sound[] = {"\sfx\rad...ogg", NUMBER, NUMBER};

Share this post


Link to post
Share on other sites
hi

just for interest:

[did you try leaving the pboprefix and renaming the .pbo file only to nfs4 ?

wondering WHAT will happen if you do like the above.]

the problem itself:

maybe if you have a pboprefix and call \nfs4\res

only add in config.cpp

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">sound[] = {"\sfx\rad...ogg", NUMBER, NUMBER};

I don't believe this... No go... banghead.gif

I removed the $PBOPREFIX$ file, and I renamed the source folder to nsf4, created a pbo file (nsf4.pbo), put that in the addon folder and restarted ArmA.. (I deleted the old nsf4_resources.pbo that was located in the addons folder before starting ArmA)..

Updated version of config.cpp in nsf4.pbo;

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgSounds {

class Radio_Squark {

name="Radio Squark";

sound[]={"sfx\radio_squark.ogg", db+20, 1.0};

titles[] = {0,""};

};

};

PS! As for the path reference to the sound file, I've tried all these versions with the above configuration;

\nsf4\sfx\radio_squark.ogg

nsf4\sfx\radio_squark.ogg

\sfx\radio_squark.ogg

Another thing, I use kegetys'es createPBO app., and I guess there is no need to binarize the config.cpp before creating a pbo file?

ZNorQ

Share this post


Link to post
Share on other sites

no, no need to binarize, until it's working  xmas_o.gif

here is a link to a pboprefix discussion

link

Share this post


Link to post
Share on other sites
no, no need to binarize, until it's working xmas_o.gif

Hehe, well, just checking every thinkable possibility... I'm just about to throw my brand new PC and the monitor out the window! biggrin_o.gif

I guess I'll just have to include all the resources in each mission... What a waste... sad_o.gif

I'm so sure its a stupid mistake on my account, but I've been trying to figure this mess out for so many hours now...

Thanks anyway..

ZNorQ

Share this post


Link to post
Share on other sites
here is a link to a pboprefix discussion

link

Well, the way I've used it now - as described in that thread, conforms with what results I've gotten by using it in my resource file. I base that on the flag texture that actually work. (\nsf4\res\gfx\flags\nsfflag.jpg) The nsf4\res is taken from the PBOPREFIX file...

Why the sound can't be found, is beyond me.. I've de-pbo'ed the original sound pbo file from the game to see if the sounds have to be under a certain folder (as I think it did in OFP), but I can see no proof of this...

ZNorQ

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  

×