Jump to content
Sign in to follow this  
pogoman979

sound file path in cfgsounds

Recommended Posts

ok i want to turn some of the songs from arma2 defined by cfgmusic into sounds, ie define them in my mission under cfgsounds. unfortunately the location of the sound file being defined is relative to the mission, meaning if i want to turn any of the songs from arma2 into sounds i have to copy them into my mission directory, which is obviously undesirable due to their size.

my question is: is there any way to make the filepath in

sound[] = {"filepath", db-100, 1.0};

look outside of the mission file and in the addons directory?

in case your wondering i want to do this so i can make a radio/vehicle "say" the songs so that the sound is directional and distance based, not everywhere which is what happens when using playmusic.

Share this post


Link to post
Share on other sites

Use a path consisting of the name of the pbofile + the path inside the pbo.

Just the same way as you would do to load models or textures.

something like this "\missions\uebercoolmission02\music\damngoodstuff.ogg"

Heh I've had some BF-Vietnam style radio system for choppers in ArmA1. But I used custom music for that, using the files from the game is not a bad idea.

Share this post


Link to post
Share on other sites

yeah i tried that but because the path is relative to the mission pbo, putting in "\missions\uebercoolmission02\music\damngoodstuff.ogg" would search for a folder called "missions" in your mission pbo, instead of looking in the addons directory like it usually does for models and textures etc.

remember this is all being done in cfgsounds which is defined in the description file, where pathnames are read differently compared to in a normal script file.

Share this post


Link to post
Share on other sites

Hmm right.

Well what you can use, are any music or soundfiles that already have classnames defined.

Aside from that.... I'm not sure if there is any way around this problem.

Share this post


Link to post
Share on other sites

You could fake it with fadeMusic, but I found this command to be awkward in OFP, I don't know how it works now in ArmA though. But yes, it would still be much better to make define them in CfgSounds.

Share this post


Link to post
Share on other sites

hmmm, i might give fademusic a try but it sounds like it would be overly complicated for what i'm trying to achieve. ah well, thanks for the help anyway guys.

---------- Post added at 11:41 AM ---------- Previous post was at 10:13 AM ----------

ok for anyone who is interested, i've made a script using the fademusic command that basically does what the "say" command does for sounds. of course it isnt perfect, the sound dropoff is linear and theres no sound occlusion, but its a start.

ok create a script called for example radio.sqf that contains this code:

_a = 0;
_t = 0;
_r = _this select 0;
_s = _this select 1;
_l = _this select 2;
_d = _this select 3;

while{true}do

{

if(player distance _r <= _d and _a == 0)then{playmusic _s; _a = 1; _t = time};

if(time > _t + _l and _a == 1)then{_a = 0};

_dplayer = player distance _r;

_v = 1 - (_dplayer/_d);

if(_v >= 0)then{0 fademusic _v};
if(musicvolume > 0 and _v < 0 and _a == 1)then{0 fademusic 0};

sleep 0.5;

};

and then place this in the init field of the unit you want to play the music:

nul = [this, "Ambient06_Khe_Sanh_Riff", 215, 30] execVM "radio.sqf";

where "Ambient06_Khe_Sanh_Riff" is whatever arma song u wanted to use, 215 is the length of the song, and 30 is the max distance you want the player to be able to hear the music.

Edited by pogoman979

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  

×