Jump to content
Sign in to follow this  
edbusana

Sound player DEAD - playSound ou playSound3D

Recommended Posts

I'm script to make a sound when a player (MP) is dead.

Probelam that the player can be on the other side of the map that the sound is still heard.

What would be the way to fix this problem by setting so that the sound was heard only in 50 meters or sound can also be only the dead player

description.ext

class CfgSounds
{
 sounds[] = {Vent,Vent2,Para,Dead};

class Vent {name="Vent";sound[]={ATM_airdrop\data\Vent.ogg,db-11,1.0};titles[] = {};};
class Vent2 {name="Vent2";sound[]={ATM_airdrop\data\Vent2.ogg,db-11,1.0};titles[] = {};};
class Para {name="Para";sound[]={ATM_airdrop\data\parachute.ogg,db-11,1.0};titles[] = {};};
class Dead {name="Dead";sound[]={sounds\dead.ogg,db-11,1.0};titles[] = {};};	
};

Init player:

this addMPEventHandler ["MPKilled",{_this execVM "deathScript.sqf"}];

deathScript.sqf

playSound "Dead";

Edited by edbusana

Share this post


Link to post
Share on other sites
add

if (!local (_this select 0)) exitWith {};

before

playSound "Dead";

added to the file deathScript.sqf but the sound is not output.

I tested the preview editor and new server host

if (!local (_this select 0)) exitWith {};

before

playSound "Dead";

Share this post


Link to post
Share on other sites
Remove "before"

he sound is working again.

The sound was not the problem in work, in fact I wanted to limit only to the dead player or very next players.

What is happening is that if a player dies at 5km away another player hears the sound also.

Share this post


Link to post
Share on other sites
he sound is working again.

The sound was not the problem in work, in fact I wanted to limit only to the dead player or very next players.

What is happening is that if a player dies at 5km away another player hears the sound also.

if (!local (_this select 0) || _this select 0 distance player > 20) exitWith {};

should work.

Share this post


Link to post
Share on other sites
if (!local (_this select 0) || _this select 0 distance player > 20) exitWith {};

should work.

Well, it worked. That's what I was looking for.

Thx austin_medic

Share this post


Link to post
Share on other sites

First of all you need to make sure your sound is mono, not stereo.

Then I add an logic to the object and make it use say3d.

_deadPlayer = _this select 0;
_object = "Logic" createVehicleLocal [0,0,0];
_object attachTo [_deadPlayer ,[0,0,1.5]];
_object say3D "yoursound";
[_object] spawn {
 sleep 2;
 deleteVehicle (_this select 0);
};

Share this post


Link to post
Share on other sites

I am austin_medic the script working.

Became the mono sound to stereo. If necessary revert the audio.

Now I see the link L3TUC3 and test the script.

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  

×