Jump to content
jrobdesign@hotmail.com

Aircraft breathing custom sound help

Recommended Posts

Hi all, 

 

I'm pretty new to scripting, so apologies in advance for any stupid questions. I usually rely on the forums and copying and pasting anything I need, but was unable to find anything to help me on this one.

 

Basically, I am trying to recreate breathing sounds for a pilot while inside an aircraft. Ideally, I would like to have the breathing become louder/faster when pulling high g turns however at this stage i'm just happy with a breathing sound.

 

So, I have the sounds ready, converted to .ogg, set them up in the description.ext file, and I am able to get them working by calling them in a trigger or in the players init file, so i know the sounds are working.

 

The problem is I am now unable to get the sound to loop. I would also like the sound to only play when the player is in an aircraft.

 

Can anyone help me out with how I would get this to work? Should I be using the player to call the sound or the aircraft? and how do i get it to loop?

 

And then on to my next question, how would I go about getting the sound to play louder/faster when pulling turns? I know that some of the aircraft mods (F-14 Standalone, F-16 Standalone for eg) have a sound that plays when pulling turns to simulate the sound of the wind (i think), so wondering if it would be possible to do something like this for the player's breathing. I am unsure if this would be a different sound that is used, or if it is just the same cockpit ambience noise but intensified when pulling a turn.

 

IF anyone could help that would be sweet. Cheers

Share this post


Link to post
Share on other sites

I wouldn't know how to calculate the G-forces enacted on the player (hopefully someone else can do maths). The following would be placed in your initPlayerLocal.sqf:

 

fnc_addPilotMaskSound =
{
	params [["_unit",objNull,[objNull]]];
	
	if (isNull _unit) exitWith { diag_log "fnc_addPilotMaskSound: Unit provided was undefined!"; };
	
	private _timeStandard = 5; //adjust as necessary
	private _classesOfHelmets = ["myHelmetClassname","myOtherHelmet"]; //adjust as necessary
	//private _threshold = someCalcuation/constantNumber; //adjust as necessary when you find out how to calc gForce
	private _mySoundClass = "mySoundClassname"; //adjust as necessary
	
	while {alive _unit} do
	{
		private _inPlane = (vehicle _unit) isKindOf "Plane";
		private _hasHelmet = (headgear _unit) in _classesOfHelmets;
		private _timeBetweenBreath = _timeStandard;
		
		if (_inPlane) then
		{
			if (_hasHelmet) then
			{
				/*
					private _gForce = someHow get gForce calculations;
					
					if (_gForce > _threshold) then 
					{ 
						_timeBetweenBreath = somethingLessThanPreviouslyDefined; 
					};
				*/
				playSound _mySoundClass;
			};
		};
		sleep _timeBetweenBreath;
	};
};

[player] spawn fnc_addPilotMaskSound;

player addEventHandler
[
	"Respawn",
	{
		params ["_newUnit"];
		[_newUnit] spawn fnc_addPilotMaskSound;
	}
];

 

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

×