Jump to content
Sign in to follow this  
HatchetJesus

Simulate sound of firefight

Recommended Posts

Hi, I'm hoping for ideas of how to simulate the sounds of a firefight.

Scenario:

the Player is x meters away from a town when he hears a firefight going off from the center. When player comes closer the sound stops.

I could just set up some AI's with some simple commands. But I rather not have them drain performance or make the nearby AI react.

I want only the sound of a battle.

Share this post


Link to post
Share on other sites

Search through the mission files of the campaign. Maybe you can get something good out of it :)

You should check all the ogg files, those are the sounds.

The campaign pbo is located here: *yourarma3directory*\Addons\missions_f_epa.pbo

Share this post


Link to post
Share on other sites

Dunno if it helps but triggers can have "Effects". Insert a trigger and click "effects" on the bottom of the trigger settings dialog. Maybe you could use some of them - there is effects for explosions, firefights etc. Or you could make your own ogg file and play it during the mission.

regards.Väinämöinen

Share this post


Link to post
Share on other sites

I have a script that I found online, I think it's an extract from the campaign, I'll post it in a couple of hours.

Here it is:

initAmbientSound.sfq

waitUntil {!isNull player};
_unit = _this select 0;


private ["_explosions"];

_explosions =
[
"BattlefieldExplosions1_3D",
"BattlefieldExplosions2_3D",
"BattlefieldExplosions5_3D"
];

private ["_fireFights"];

_fireFights =
[
"BattlefieldFirefight1_3D",
"BattlefieldFirefight2_3D"
];

{
[_forEachIndex, _explosions, _fireFights] spawn
{
	private ["_index","_explosions", "_fireFights"];

	_index = _this select 0;

	scriptName format ["initAmbientSounds.sqf: random sound playing - [%1]", _index];

	_explosions = _this select 1;
	_fireFights = _this select 2;

	while {true} do
	{
		sleep (1 + random 59);

		private ["_sound"];
		_sound = if (random 1 < 0.5) then
		{
			_explosions call BIS_fnc_selectRandom
		}
		else
		{
			_fireFights call BIS_fnc_selectRandom
		};

		playSound _sound;
	};
};
}
forEach [0,1,2];

Just call the script in a trigger and kill it when you don't want it to work anymore.

Inviato dal mio GT-I9300 utilizzando Tapatalk

Edited by Antorugby

Share this post


Link to post
Share on other sites

hi Antorugby,

Interesting script which I like to use in one of my missions. But it seems there is a loop which prevents it from ending, how do you kill the sqf once it's running?

Share this post


Link to post
Share on other sites
hi Antorugby,

Interesting script which I like to use in one of my missions. But it seems there is a loop which prevents it from ending, how do you kill the sqf once it's running?

Run the script like this:

BattleSound = [] execVM "nameofthescript.sqf"

And when you wanna kill it try with

 
terminate BattleSound 

But I'm not sure if it's gonna work, so you can try another method.

First line of the script add

 BattleSound = true 

Then change the

 while {true} 

to

 while {BattleSound}

and when you don't want the script to run anymore just use a trigger or something else declaring:

 BattleSound = false 

Hope I explained myself, just woke up and brain isn't running so well.

Inviato dal mio GT-I9300 utilizzando Tapatalk

Share this post


Link to post
Share on other sites

Be careful with the while command. It is recommended to use several sleep commands to slow it down a bit or it can stress your cpu depending on how big the code in the while is.

Share this post


Link to post
Share on other sites

Hi,

Thanks for those comments. They make sense

Now I will do some experimentation.

Share this post


Link to post
Share on other sites

You could also set up a trigger - under effects/sound are battlefield sounds. Distant explosions / gunfire etc. Seems like it loopes automatically.

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  

×