Jump to content
Sign in to follow this  
dark_spectre

[A3_stable]_Adding Environmental Audio to a COOP mission

Recommended Posts

Hello again all!

I come seeking wisdom in the ways of adding some environmental audio to my multiplayer missions.

In my example mission I am spawning flocks of poultry, sheep, and goat via 'Animal Modules' to flesh out a farming village to add both ambiance and moving thermal signatures to discriminate against upon recon. But the ambiance part is lost if we hear nothing as we approach. It breaks immersion.

I have edited and converted several audio files containing examples of the various animals in the wild and converted them to .ogg at the correct sampling and bit rates, placing them in a folder called "/ambient" within my mission folder.

   /ambient/poultry.ogg
   /ambient/sheep.ogg
   /ambient/goat.ogg

I have of course searched on YouTube and found a couple of older tutorials that illustrated how to add audio to a trigger that will fade in and out in accordance with your proximity to it. I could not however get it to work, which has brought me here to you.

So I suppose the burning questions are:

1. Is this possible to do in a COOP MP environment?

(I noted for example that playMusic only played music for the unit/squad leader for whom the trigger was linked and not the entire group. So this was out as a hack fix)

2. And if so, how would one such as myself go about configuring such a trigger?

I just want to create a farm that looks (check) but also 'sounds' like a farm.

(Smell optional :P )

As always, your help would be greatly appreciated.

SPECTRE

Edited by Dark_Spectre

Share this post


Link to post
Share on other sites

Here's a BI combat ambience script. Should give you an idea of how to achieve your goal.

waitUntil {!isNull player};

_explosions = ["BattlefieldExplosions1_3D","BattlefieldExplosions2_3D","BattlefieldExplosions5_3D"];
_fireFights = ["BattlefieldFirefight1_3D","BattlefieldFirefight2_3D"];

{
   [_forEachIndex, _explosions, _fireFights] spawn {
       private ["_index","_explosions", "_fireFights"];
       _index = _this select 0;
       _explosions = _this select 1;
       _fireFights = _this select 2;

	while {true} do { 
           sleep (1 + random 20);
           private ["_sound"];
               _sound = if (random 1 < 0.5) then {
                   _explosions call BIS_fnc_selectRandom
			} else {
                   _fireFights call BIS_fnc_selectRandom
               };
           if (!underWater player) then {playSound _sound;};
       };
   };
} forEach [0,1,2]; 

Share this post


Link to post
Share on other sites

here was a reply from reddit from BeerDrinkingRobot:

There several ways to play sound. I think the best would be to use say3d because we can get positional audio. I'm using nearEntities to get alive animals within 200 meters. You can play with the random probability to change how annoying you want them to be :)

init.sqf

#define ANIMAL_TYPES    ["Goat_random_F", "Sheep_random_F", "Hen_random_F"]
#define ANIMAL_SOUNDS   ["x_goat", "x_sheep", "x_chicken"]
#define RANDOM_SPEAK_PROB   0.1
#define RANDOM_SLEEP_TIME   0.3
#define RANGE_MAX           200


[] spawn {
   if (isDedicated) exitWith {}; //Make sure to add this to the example mission, I forgot it
   while {true} do {
       {
           _animals = (position player) nearEntities [_x, RANGE_MAX];
           _soundType = ANIMAL_SOUNDS select _forEachIndex;
           {
               if ((random 1) < RANDOM_SPEAK_PROB) then {sleep 1;  _x say3d _soundType;};
               sleep (random RANDOM_SLEEP_TIME);
           } forEach _animals;
       } forEach ANIMAL_TYPES;
   };
};

description.ext

class CfgSounds
{
   sounds[] = {};
   class x_chicken
   {
       name = "x_chicken";// how the sound is referred to in the editor (e.g. trigger effects)
       sound[] = {"ambient\chicken.ogg", 1, 1};// filename, volume, pitch
       titles[] = {};
   };  
   class x_goat
   {
       name = "x_goat";// how the sound is referred to in the editor (e.g. trigger effects)
       sound[] = {"ambient\goat.ogg", 1, 1};// filename, volume, pitch
       titles[] = {};
   };  
   class x_sheep
   {
       name = "x_sheep";// how the sound is referred to in the editor (e.g. trigger effects)
       sound[] = {"ambient\sheep.ogg", 1, 1};// filename, volume, pitch
       titles[] = {};
   };
};

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  

×