Jump to content
Sign in to follow this  
thetrooper

Custom sound, superb, repeat?

Recommended Posts

Hi all, got this custom sound going on when in a building (by a trigger). Two questions.

1. it's 20 seconds long and ends. How do I get it to loop?

2. After I exit the trigger (exit building) I want it to stop. Possible set up another trigger to do it?

I'm thinking something to go into Deactivation box?

Edited by TheTrooper
last line added

Share this post


Link to post
Share on other sites

It's a long sound so put it in cfgMusic in description.ext

http://community.bistudio.com/wiki/description.ext#cfgMusic

and:

addMusicEventHandler ["MusicStop", {[] spawn {playMusic "myCustomSnd"}}];

http://community.bistudio.com/wiki/addMusicEventHandler

It means you will not be able to use other music tho, so alternative is to loop it in a script with a sleep 20;

Share this post


Link to post
Share on other sites

It's easy to edit and make it shorter. But needs to loop over and over as long as player is in the building. Not sure how to get it to loop though. It's more of an environment sound

Share this post


Link to post
Share on other sites

Script that checks a trigger

while {true} do 
{
if ({isPlayer _x} count list triggerName >0) then
{
playSound3D ["a3\sounds_f\sfx\radio\ambient_radio2.wss", player]; sleep 9;
};

};

Share this post


Link to post
Share on other sites

:confused:I'm thinking in triggers the environment control is a loop, can I not make into something like that?

Share this post


Link to post
Share on other sites

Well if you want to do it all in the editor without scripts you just search for "arma sound loop" and hey presto you get several different answers?

Share this post


Link to post
Share on other sites

place a trigger in your map and name it example_trigger . on activation put this

_s=[]execvm"yourmissionsubfolder\soundexample.sqf";

place an object where you want the sound comes and name it .

then copy this code and paste it in a file and name it soundexample.sqf in your mission folder

_sound = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString;
_play = _sound + "sounds\yoursoundname.ogg";// your sound path goes here
_source = nameofyoursourceobject; // here put the name of source object
while {true} do 
{
if ({isPlayer _x} count list example_trigger >0) then
{
playSound3D [_play, _sound, true, getPos _source, 10, 1, 20];
};
//10 is the db of you sound , 1 i dont know :-)) 20 is the distance in meters for sound fade
hint"radio on";//some hint if you like
sleep 179;// total time of your sound >>important<<
};

you must change lines , 2,3 and 11 for your sound setup.

this is tested and works fine for that you want to do.

thats Mattar say in post above , but the playsound3d is not working like that

---------- Post added at 20:32 ---------- Previous post was at 20:30 ----------

for single player is ok... for multi i think it need more commands because this way, all players can call the same sound same time and the playsound3d is not local sound call...

Edit: if you put the sqf file in the root of your mission folder , then in your trigger put only the sqf filename like this

_s=[]execvm"soundexample.sqf";

Edited by dragonsyr

Share this post


Link to post
Share on other sites

Doesn't seem to be working. got to be the

nameofyoursourceobject. 

not too sure what goes here?

Share this post


Link to post
Share on other sites

replace this with the name of your object (you must add an object on map with a name of your choice.) if you dont like that then comment this line , and replace the _source on playsound3d command line, with player or other ,i dont know exactly what you want....

---------- Post added at 21:14 ---------- Previous post was at 21:09 ----------

if you put an object in the middle of the building and use it as source for your sound , Then you have something like ambient sound effect... try it..

Share this post


Link to post
Share on other sites

place any object name it then add

this hideobject true;

to its init

then whatever you named it is your

nameofsourceobject

and it will be invisible!

But still give you sound :yay:

Share this post


Link to post
Share on other sites

Hey all, I have tried this too. I used this link to get custom music in mission. I think it will help you. the one problem I have is I cannot get it to fade out once unit leaves trigger.

If anyone can help thanks.

The code for the description.ext file:

class CfgMusic

{

tracks[]={};

class music1

{ name = ""; sound[] = {\music\FILENAME1.ogg, db+1, 1.0};

};

class music2

{ name = ""; sound[] = {\music\FILENAME2.ogg, db+1, 1.0};

};

};

"1 fadeMusic 0;" is not working for me.

Share this post


Link to post
Share on other sites

@JAndrews1 . check your trigger settings.

also i dont know if this command works in A3 .

i see in here that The fadesound command doesn't work, in Arma 2 1.05.

and is for Operation Flashpoint Version: 1.00....

Edited by dragonsyr

Share this post


Link to post
Share on other sites
@JAndrews1 . check your trigger settings.

also i dont know if this command works in A3 .

i see in here that The fadesound command doesn't work, in Arma 2 1.05.

and is for Operation Flashpoint Version: 1.00....

So in trigger I have set to presence with blufor, once

Cond. this

Act = 1 fadeMusic 1; playMusic "music1"

Dea = 1 fadeMusic 0;

In youtube vid he is using trigger on stratis. So it must have worked at some point. The music plays once unit enters trigger, the music just does not fade once unit leaves zone.

Share this post


Link to post
Share on other sites

I did a test and everything is working properly...

trigger 50*50 blufor repeat... ONACT 1 fademusic 1; playmusic "music1";

ONDEA 1 fademusic 0;

---------- Post added at 19:51 ---------- Previous post was at 19:35 ----------

on DEA put this

1 fademusic 0;hint"trigger deactivated";sleep2;
to see if the trigger working Edited by dragonsyr

Share this post


Link to post
Share on other sites

thanks for doing that. I have a trigger 4000*4000 for music during heli flight. I wouldn't think that would matter though. I will try that second DEA line next time. thanks for your time. does the sleep2; have anything to do with the fademusic ?

Share this post


Link to post
Share on other sites

not at all.. is only for the hint delay

---------- Post added at 19:58 ---------- Previous post was at 19:56 ----------

you must be out of the trigger to make your sound fade.......

---------- Post added at 20:00 ---------- Previous post was at 19:58 ----------

4000*4000 covers almost all the map of stratis !!

---------- Post added at 20:07 ---------- Previous post was at 20:00 ----------

make the same trigger 50*50 with a unit out of range and test it to see how this works

Share this post


Link to post
Share on other sites

Hey. well its on Altis and I will try a smaller zone.

Just tried it again, dumb thing is not fading out for me.

Edited by JAndrews1

Share this post


Link to post
Share on other sites
I did a test and everything is working properly...

trigger 50*50 blufor repeat... ONACT 1 fademusic 1; playmusic "music1";

ONDEA 1 fademusic 0;

---------- Post added at 19:51 ---------- Previous post was at 19:35 ----------

on DEA put this to see if the trigger working

I see you have it set to blufor repeat.... could I just have it for "once" that's the only difference I see.

Share this post


Link to post
Share on other sites

got ya. Except still not working. I used an invisible H as my object. I'm guessing player is the '_source'?

Tried this

_sound = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString;
_play = _sound + "sounds\yoursoundname.ogg";// your sound path goes here
_source = invisibleH; // here put the name of source object
while {true} do 
{
if ({isPlayer _x} count list example_trigger >0) then
{
playSound3D [_play, _sound, true, getPos _source, 10, 1, 20];
};
//10 is the db of you sound , 1 i dont know :-)) 20 is the distance in meters for sound fade
hint"radio on";//some hint if you like
sleep 179;// total time of your sound >>important<<
};  

-------------------------------------------------------------------------------

Background of what I'm trying to do.

I have a sound want to loop when player in building.

Player goes in building, a ambient sound occures in building (talking). Player leaves it stops or fades. trigger on repeat, to happen whenever player walks into building.

Share this post


Link to post
Share on other sites

i have this on my mission and works ....

no, the player is not the source. if you want to make the player play the sound , change to this

playSound3D [_play, player, true, getPos player, 10, 1, 20];

---------- Post added at 12:28 ---------- Previous post was at 12:25 ----------

i this script you must set your sound path.......

---------- Post added at 12:38 ---------- Previous post was at 12:28 ----------

note that if you use playsound3d to objects with motion you will see that the sound heard by the point you call the script and as long as you leave that point, the sound goes out. I do not know how you can do the sound to follow the movement of the object / vehicle

---------- Post added at 12:42 ---------- Previous post was at 12:38 ----------

this is the reason that i use as _source static objects

---------- Post added at 12:48 ---------- Previous post was at 12:42 ----------

try also this

playSound3D [_play, _source, true, getPos _source, 10, 1, 20];

this works also .....tested

---------- Post added at 12:53 ---------- Previous post was at 12:48 ----------

have your sound in description.ext like this?

class CfgSounds {

sounds[] = {mysound};

class mysound {name="mysound";sound[]={"\sounds\mysound.ogg",db+5,1.0};titles[] = {};};

};

---------- Post added at 13:05 ---------- Previous post was at 12:53 ----------

in a few hours i can send you a sample mission for this.... now i cant...

Share this post


Link to post
Share on other sites

ok. check pm for mission... is working and you dont need to set the sound in description.ext.... tested and working without cfgsounds setup.

you need the cfgsounds setup if you want to play the same audio file other way .... like this

player playsound "mysound";
Edited by dragonsyr

Share this post


Link to post
Share on other sites

hey Dragon... I am having issues with 1 fadeMusic 0; in my DEA for trigger. the music starts with trigger, however does not fade out. any ideas?

class CfgMusic

{

tracks[]={};

class music1

{ name = ""; sound[] = {\music\FILENAME1.ogg, db+1, 1.0};

};

};

"1 fadeMusic 0;" is not working for me.

Share this post


Link to post
Share on other sites

are you sure that the trigger deactivate????????????

---------- Post added at 17:20 ---------- Previous post was at 17:18 ----------

add a hint in your trigger DEA , and test the trigger

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  

×