Jump to content
Sign in to follow this  
sgt_hawkins

Localized Sound

Recommended Posts

Ok I need a answer of how to create a trigger where when you enter the trigger you hear a sound and when you exit the trigger the sound fades away. Is there a simple solution to this?

Edited by Sgt_Hawkins

Share this post


Link to post
Share on other sites

Oh ! I'm gonna wait for an answer of your question ! More precisely, is it possible to tune the sound level of a "sound object" ? Like hearing a wolf 150meters away ! :D

Share this post


Link to post
Share on other sites

Not sure if you can make it fade away...

As for M4Mkey... when you define a custom sound in your description.ext, you can set it's sound level there up or down.

Share this post


Link to post
Share on other sites

description.ext ? what's that ? xD I'm talking about original ambient sounds from the game. Not custom sounds :)

Share this post


Link to post
Share on other sites

idk if you can then. description.ext is a file you can make when you create a mission, mostly optional, but required to give your characters specific names/identities/faces/voices etc, and to include custom sounds/voice-overs

Share this post


Link to post
Share on other sites

I figured this one out too.....Seems i do that alot lately The sound I was referring too was a forest fire sound..The mission has a forest fire and I wanted the fire to fade when you left the forest....

Here is what I did. I created a Invisible Heli Named it fire...

I created a trigger put this in the Activation :

dmy=[fire' date= "forest_fire", 3.95 , -1] execvm "j_boysoundLoop.sqf";
(Note: The name of my sound I want to fade is forest_fire....obviously)

And then i used a script from "johnnboy" Make a sqf named JBOY_soundLoop.sqf and insert this

// JBOY_soundLoop.sqf

// Version 0.6

// by johnnboy

//

// Will play the same sound over and over' date=' until object is dead, or times out.

//

// Sample call:

// dmy=[objectToSay,soundName,soundLength,maxPlays'] execvm "JBOY_soundLoop.sqf";

// dmy=[car1, "fireBurning", 3.2 , 10000] execvm "JBOY_soundLoop.sqf";

//

// Parameters:

// 1: Object that will 'say' the sound.

// 2: Name of the sound to play (from your description.ext file).

// 3: Length of sound in seconds.

// 4: Maximum times to play the loop. Use -1 if you want it to be infinite.

// *****************************************************************************

// Change History:

// v0.6 Added Wolfrugs good suggestions:

// - Don't play sound if no player nearby.

// - Add -1 as _maxPlays parameter that is infinite.

// v0.5 Created.

_obj = _this select 0;

_sound = _this select 1;

_lengthInSeconds = _this select 2;

_maxPlays = _this select 3;

// We won't play the sound if player is further than this away.

_toggleOffDistance = 250;

_i = 0;

while { (alive _obj) and ((_i < _maxPlays) or (_maxPlays == -1)) } do

{

if ((_obj distance player) < _toggleOffDistance) then

{

_obj say _sound;

};

sleep _lengthInSeconds;

_i = _i + 1;

};

Thats how i got it to work...There might have been a easier way but I don't care it works...

Share this post


Link to post
Share on other sites

The script works, but it doesnt turn the sound off when I walk more than 15 meters away, which is what I set the _toggleOffDistance too.

Share this post


Link to post
Share on other sites

You can't adjust sound levels (db range) without messing with description.ext and define your own sound classes.

Sounds played with playSound (anonymous) and music, are not "localized". I think everything else is (unsure about environmental sounds, what class they fall under atm). Check the effects button in a trigger, and just set trigger activation to true. To stop the sound temporarily, move the trigger away. To stop it forever, delete the trigger.

The beauty of triggers is that they can be moved around like that. De-pbo dubbing.pbo and sounds.pbo in the addons folder, and have a blast :)

Description.ext. You'll have to go there sooner or later, trust me :)

Share this post


Link to post
Share on other sites

Regarding the sound not turning off when you walk further away than the desired distance, all that does is stop the next loop from occuring. You can't stop a sound while it's playing until it comes to its natural end UNLESS you delete its source (but then you have to add it back if you want it to play again)

Share this post


Link to post
Share on other sites
Regarding the sound not turning off when you walk further away than the desired distance, all that does is stop the next loop from occuring. You can't stop a sound while it's playing until it comes to its natural end UNLESS you delete its source (but then you have to add it back if you want it to play again)

yeah, I figured this out right after I posted lol.

and I'm good and familier with description.ext ;)

what I'm gonna do is play around with it and have the radio play music instead of sound, then fade the sound when the player walks away, and fade it up when they walk close. should work . . .

Share this post


Link to post
Share on other sites

Just use negative db and it should fade properly. Values from db-30 to db-50 is not uncommon. Adjust, check "reach", and repeat. Positive db means you have to be x distance away from the soundsource before sound starts attenuating.

Share this post


Link to post
Share on other sites

How do I add sounds to the 'Trigger' sounds menu? The voice and environment groups are not localised. Also, that script doesn't work for me, just doesn't play the sounds for some reason, even though they work when played by the triggers. I basically want to have 3 different ambient sounds looping, coming from different sources so you hear a different mix depending on where you are standing. Anyone know a solution? None of this seems to work.

Share this post


Link to post
Share on other sites

This is exactly what I want to create too, but this script is not working for me either.

Share this post


Link to post
Share on other sites

It is not working for me either. I wonder if it is because it was written for Arma instead of arma2 ??

Any demo example of this working will be highly appreciated by many of us! :)

Share this post


Link to post
Share on other sites
How do I add sounds to the 'Trigger' sounds menu?

So I point you guys to description.ext, but it doesn't have the info... Doh!!! You need to add CfgSFX class, not within CfgSounds but next to it as a standalone class. Example:

class CfgSFX
{
sounds[] = {};
//This works in OA, I'm using it myself, but you'll have to provide the actual sound.
class fx_well {name = "fx_well";sounds[]={sound1};sound1[]={"sounds\fx_well.ogg",1,1,50,1,0,0,0};empty[]= {"",0,0,0,0,0,0,0};};
//This works in Arma2, but untested in OA. Shows how one can use several sounds.
class fx_forestbird
{
	name = "fx_forestbird";
	sounds[]={sound1,sound2,sound3,sound4,sound5,sound6,sound7,sound8};
	sound1[]={"soundfx\fx_ForestBird-001.ogg",1,1,60,0.1,4,8,16};
	sound2[]={"soundfx\fx_ForestBird-002.ogg",1,1,60,0.1,4,8,16};
	sound3[]={"soundfx\fx_ForestBird-003.ogg",1,1,60,0.1,4,8,16};
	sound4[]={"soundfx\fx_ForestBird-004.ogg",1,1,60,0.1,4,8,16};
	sound5[]={"soundfx\fx_ForestBird-005.ogg",1,1,60,0.1,4,8,16};
	sound6[]={"soundfx\fx_ForestBird-006.ogg",1,1,60,0.1,4,8,16};
	sound7[]={"soundfx\fx_ForestBird-007.ogg",1,1,60,0.1,4,8,16};
	sound8[]={"soundfx\fx_ForestBird-008.ogg",1,1,60,0.1,4,8,16};
	empty[]= {"",0,0,0,0,0,0,0};
};
};

Note that I'm finding trigger based sounds so problematic I'm considering throwing the game out the window. Every time I mess with it, a completely new problem seem to emerge. Latest problem being that if in a respawn game I die while near the trigger, the sound is never heard again. The trigger is still there, but not the sound.

That empty[] thing? I don't think anybody has ever been able to decrypt that.

Share this post


Link to post
Share on other sites

I don't know. I haven't tried it. Nor will I. You can't do proper loops with say commands in the first place, and adding sleep (can become anything under load) doesn't help the situation. Which is why I prefer to stick with CfgSFX and triggers where you can have perfect loops going (as long as the sample is perfect).

Share this post


Link to post
Share on other sites

When your mission is saved with the above added to description.ext, the classes will show up in the trigger effects list, under the trigger tab. If you created triggers dynamically via scripting, you have to use:

_trigger setSoundEffect ["", "", "", "fx_well";

If you get an error message with that (I haven't tried in OA without it yet), use:

_trigger setSoundEffect ["NoSound", "", "", "fx_well";

instead, where NoSound is a normal cfgSound class but without an actual soundfile to play. Was an issue with Arma2.

Share this post


Link to post
Share on other sites

I tried this awhile back and had to get Loyalguard's help on it, I was happy just to get it to play, some of it probably got fixed by now but at the time many of the commands did not seem to work as advertised, particularly the sound fade.

Resently I've been wondering if you couldn't use a breakto or breakout in the script to at least turn the sound off at a distance?

Share this post


Link to post
Share on other sites

You have my DominOA mission, right? Go to the bigger establishments i.e. Chardarakt or Garmsar, and check. There should be some sound effects there using the trigger and setSoundEffect method.

Share this post


Link to post
Share on other sites

did anyone manage to get it to work so the sound fades away if one increases the distance to the sound source?

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  

×