Jump to content
  • 0

car sound when unlocking your vehicle


Eugene

Question

Hi all.

by the requests of people...

I show how it done on my local server (with my folder paths), replace it with yours.

1. Find your desirable sound and convert it to OGG format - in my example it is signalka.OGG. Place this file in to MPMission folder : D:\SteamGamesLibrary\SteamApps\common\arma 2 operation arrowhead\MPMissions\DayZ_Epoch_24.Napf\signalka.ogg

 

2. add to D:\SteamGamesLibrary\SteamApps\common\arma 2 operation arrowhead\MPMissions\DayZ_Epoch_24.Napf\description.ext  reference to  new sound file : http://pastebin.com/P1FYvLjy

 

3. Almost all of you use scripts like selfbloodbags , then you have script fn_selfActions.sqf in your MPMission,

3.1. Extract scripts lock_veh.sqf and unlock_veh.sqf from dayz_code.pbo to  (in my case it D:\SteamGamesLibrary\SteamApps\common\arma 2 operation arrowhead\MPMissions\DayZ_Epoch_24.Napf\Scripts )

3.2. in your MPMissions fn_selfActions.sqf replace references to extracted scripts (lock_veh.sqf and unlock_veh.sqf).

Part of new fn_selfActions.sqf :   http://pastebin.com/QgHM4k5e

 

4. Modify extracted scripts lock_veh.sqf and unlock_veh.sqf like this:

lock: http://pastebin.com/v7EiUerT

unlock: http://pastebin.com/n8JYivtq

 

5. start server.

 

Additional bonus - car lights will be flash when car lock\unlock

 

 

 

PS: sorry for my english.

 

Link to comment
Share on other sites

Recommended Posts

  • 0

For me the sound distance is still not working correctly. I think the CfgSound parameters in description.ext are not described properly.

I found some posts in other forums where I can see that it's also possible to have 4 values in description.ext for the soundfile.

If I add a 4th one, e.g. 40 (which should be the distance in meters) where you do not hear the sound anymore, it works...but now the sound if I'am very near is not as loud as before.

 

For me it seams the _sounddist variable in the RE call does nothing. I can set it to 20, 10, 40 and the sound can always be heard about 100m far. But it should be possible somehow to change this via a script and not hard-define it in description.ext which cannot be changed anymore later on (?). E.g. if someone is in a car, 40m distance, or is NOT in a car I possibly want to change how loud the sound plays...this would be possible anymore if this can only be set in description,ext.

 

Anyone figured it out how this could be controlled more precisely?

Link to comment
Share on other sites

  • 0

Just a quick question..

 

My server is new and I'm adding scripts from the ground up. I followed your instructions to the letter and so far the lock & unlock lights work but no sound.. I have no custom sounds enabled prior to this script is there something I have to add to get the ogg file to work.

 

Anyone know how to get this working ?

Link to comment
Share on other sites

  • 0

Can i limited this to only work on SUVs?

 

Why not..

 

local_lockUnlock.sqf

private ["_vehicle","_status"];
_vehicle = _this select 0;
_status = _this select 1;
_alarmCar = typeOf _vehicle in ["SUV_TK_CIV_EP1","SUV_Blue","SUV_Green","SUV_Yellow","SUV_Red","SUV_White","SUV_Pink","SUV_Charcoal","SUV_Orange","SUV_Silver","SUV_Camo"];

if (local _vehicle) then {
	if (_status) then {
		_vehicle setVehicleLock "LOCKED";
		if (_alarmCar) then {
			[nil, _vehicle, rSAY, "lock", 20] call RE;
			player action ["lightOn", _vehicle];
			sleep 0.5;
			player action ["lightOff", _vehicle];
		};
	} else {
		_vehicle setVehicleLock "UNLOCKED";
		if (_alarmCar) then {
			[nil, _vehicle, rSAY, "lock", 20] call RE;
			player action ["lightOn", _vehicle];
			sleep 0.5;
			player action ["lightOff", _vehicle];
		};
	};
};
Link to comment
Share on other sites

  • 0

i have problems with sounds i have radio + sounds from carlock


class CfgSounds
{
    sounds[] =
    {
        carLock,track1,track2
    };
    class carLock
    {
        name="carLock";
        sound[]={carlock.ogg,0.9,1};
        titles[] = {};
    };
    class track1
    {
        name="track1";
        sound[]={"sound\track1.ogg",0.05,1};
        titles[]={};
    };
    class track2
    {
        name="track2";
        sound[]={"sound\track2.ogg",0.05,1};
        titles[]={};
    };
    class track3
    {
        name="track3";
        sound[]={"sound\track3.ogg",0.05,1};
        titles[]={};
    };
    class track4
    {
        name="track4";
        sound[]={"sound\track4.ogg",0.05,1};
        titles[]={};
    };
};

its ok????



 

Link to comment
Share on other sites

  • 0

 

in your custom compiles.sqf change
local_lockUnlock =			compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_lockUnlock.sqf";

to

local_lockUnlock =			compile preprocessFileLineNumbers "custom\local_lockUnlock.sqf";

in local_lockUnlock.sqf

private ["_vehicle","_status","_sounddist"];
_vehicle = _this select 0;
_status = _this select 1;
_sounddist = 20;

if (local _vehicle) then {
	if(_status) then {
		_vehicle setVehicleLock "LOCKED";
		_vehicle setVariable ["R3F_LOG_disabled",true,true]; // if you have R3F TOW/LIFT
		player action ["lightOn", _vehicle];
		_nul = [objNull, _vehicle, rSAY, "lock", _sounddist] call RE;
		sleep 0.5;
		player action ["lightOff", _vehicle];
	} else {
		_vehicle setVehicleLock "UNLOCKED";
		_vehicle setVariable ["R3F_LOG_disabled",false,true];// if you have R3F TOW/LIFT
		player action ["lightOn", _vehicle];
		_nul = [objNull, _vehicle, rSAY, "lock", _sounddist] call RE;
		sleep 0.5;
		player action ["lightOff", _vehicle];
	};
};

copy all and paste in yours

 

in description.ext set this 

class lock
    {
    name="lock";
    sound[]={sounds\lock.ogg,0.2,1};
    titles[] = {};
};

between the other sounds like this

class CfgSounds 
{
  sounds[] = {drink_water,playerSnoring,hero,danceMusic,siren,fastrope,lock};   
  class drink_water 
  {
    name="drink_water";
    sound[]={sounds\drink_water.ogg,0.2,1};
    titles[] = {};
  };
  class playerSnoring 
  {
    name="playerSnoring";
    sound[]={sounds\snoring.ogg,0.5,1};
    titles[] = {};
 };
  class fastrope
    {
    name="fastrope";
    sound[]={sounds\fastrope.ogg,0.9,1};
    titles[] = {};
	};
  class lock
    {
    name="lock";
    sound[]={sounds\lock.ogg,0.2,1};
    titles[] = {};
};
  class hero
    {
    name="hero";
    sound[]={sounds\hero.ogg,0.9,1};
    titles[] = {};
};
   class siren
    {
    name="siren";
    sound[]={sounds\siren.ogg,0.9,1};
    titles[] = {};
};
};

thats it

 

Guys do you know how to do this with latest version 1.0.5.1?

 

I tried to follow the steps above but in description.ext there's no CfgSounds - where did they move it to? I cannot find it in GitHub repo or on my local computer using grep command...

Link to comment
Share on other sites

  • 0

Hi guys, was looking around, couldn't find anyone else with the problem, I've tried defining the variable but it still shows up occasionally 

 

12:22:18 Error in expression < = [objNull, _vehicle, rSAY, "carLock", _sounddist] call RE;

_vehicle setVariab>
12:22:18   Error position: <_sounddist] call RE;

_vehicle setVariab>
12:22:18   Error Undefined variable in expression: _sounddist
12:22:18 File mpmissions\__cur_mp.chernarus\custom\code\local_lockUnlock.sqf, line 15

Here is my lock file

private ["_vehicle","_status","_nul","_sounddist"];
_vehicle = _this select 0;
_status = _this select 1;

if (local _vehicle) then {
    if(_status) then {
        _vehicle setVehicleLock "LOCKED";
        _nul = [objNull, _vehicle, rSAY, "carLock", _sounddist] call RE;
    //    _vehicle setVariable ["BTC_Cannot_Lift",true,true];
        _vehicle setVariable ["R3F_LOG_disabled",true,true];
    //    _vehicle setVariable ["MF_Tow_Cannot_Tow",true,true];
        titleText ["LOCKED = Can not be lifted or towed away","PLAIN DOWN"]; titleFadeOut 4;
    } else {
        _vehicle setVehicleLock "UNLOCKED";
        _nul = [objNull, _vehicle, rSAY, "carLock", _sounddist] call RE;
    //    _vehicle setVariable ["BTC_Cannot_Lift",false,true];
        _vehicle setVariable ["R3F_LOG_disabled",false,true];
    //    _vehicle setVariable ["MF_Tow_Cannot_Tow",false,true];
        titleText ["UNLOCKED = Can be lifted or towed away","PLAIN DOWN"]; titleFadeOut 4;
    };
};
Link to comment
Share on other sites

  • 0

You don't have _sounddist defined anywhere. Use this, where 20 is the distance.

private ["_vehicle","_status"];
_vehicle = _this select 0;
_status = _this select 1;

if (local _vehicle) then {
    if(_status) then {
        _vehicle setVehicleLock "LOCKED";
    //    _vehicle setVariable ["BTC_Cannot_Lift",true,true];
        _vehicle setVariable ["R3F_LOG_disabled",true,true];
    //    _vehicle setVariable ["MF_Tow_Cannot_Tow",true,true];
        titleText ["LOCKED = Can not be lifted or towed away","PLAIN DOWN"]; titleFadeOut 4;
    } else {
        _vehicle setVehicleLock "UNLOCKED";
    //    _vehicle setVariable ["BTC_Cannot_Lift",false,true];
        _vehicle setVariable ["R3F_LOG_disabled",false,true];
    //    _vehicle setVariable ["MF_Tow_Cannot_Tow",false,true];
        titleText ["UNLOCKED = Can be lifted or towed away","PLAIN DOWN"]; titleFadeOut 4;
    };
    [nil, _vehicle, rSAY, "carLock", 20] call RE;
};
Link to comment
Share on other sites

  • 0

 

Sound which is in my case "lock" has to be defined in description.ext under class CfgSounds. You can set audible range in CfgSounds and after that range sound starts fading, the farther you go from the vehicle. Here is how I do it in local_lockUnlock.sqf. This way you don't need to be the "owner" of the car to play that sound, like it's in OP and doesn't play the sound before you get on driver seat once.

private ["_vehicle","_status","_sounddist"];
_vehicle = _this select 0;
_status = _this select 1;

if (local _vehicle) then {
	if(_status) then {
		_vehicle setVehicleLock "LOCKED";
		_vehicle setVariable ["R3F_LOG_disabled",true,true];
		player action ["lightOn", _vehicle];
		_nul = [objNull, _vehicle, rSAY, "lock", 50] call RE;
		sleep 0.5;
		player action ["lightOff", _vehicle];
		titleText ["LOCKED = Can not be lifted or towed","PLAIN DOWN"]; titleFadeOut 4;
	} else {
		_vehicle setVehicleLock "UNLOCKED";
		_vehicle setVariable ["R3F_LOG_disabled",false,true];
		player action ["lightOn", _vehicle];
		_nul = [objNull, _vehicle, rSAY, "lock", 50] call RE;
		sleep 0.5;
		player action ["lightOff", _vehicle];
		titleText ["UNLOCKED = Can be lifted or towed","PLAIN DOWN"]; titleFadeOut 4;
	};
};

I used this script and now players cannot unlock cars they buy when they have the keys,only admin lock/unlock works. Any ideas?

Link to comment
Share on other sites

  • 0

Can someone share description.ext for this? I can't find any CfgSounds there in fact there is no 'sounds' anywhere in MPMission folder at all?

 

You need to create your own CfgSounds section in the existing description.ext if it doesn't already exist.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×
×
  • Create New...