Change mindetector sound

This commit is contained in:
Glowbal 2016-05-12 19:44:43 +02:00
parent 0652978c86
commit 7cc423d48f
6 changed files with 59 additions and 6 deletions

View File

@ -5,7 +5,7 @@ class ACE_detector {
class ACE_VMM3 {
radius = 2.5;
// sounds[] = {"ace_sweep_high", "ace_sweep_low"};
sounds[] = {"ace_buzz_2", "ace_buzz_1"};
sounds[] = {"ace_detector_1", "ace_detector_2", "ace_detector_3", "ace_detector_4"};
};
class ACE_VMH3: ACE_VMM3 {
};

View File

@ -10,13 +10,40 @@ class CfgSounds {
titles[] = {};
};
class ace_buzz_1 {
name = "ace_buzz_1";
sound[] = {QUOTE(PATHTOF(sounds\buzz_1.ogg)), "db+1", 1};
name = "buzz_2";
sound[] = {QUOTE(PATHTOF(sounds\buzz_2.ogg)), "db+0.5", 0.5};
titles[] = {};
};
class ace_buzz_2 {
name = "ace_buzz_2";
sound[] = {QUOTE(PATHTOF(sounds\buzz_2.ogg)), "db+0.76", 0.7};
titles[] = {};
};
class ace_buzz_3 {
name = "ace_buzz_3";
sound[] = {QUOTE(PATHTOF(sounds\buzz_2.ogg)), "db+1", 1};
titles[] = {};
};
class ace_detector_1 {
name = "ace_detector_1";
sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wav)), "db+1", 1};
titles[] = {};
};
class ace_detector_2 {
name = "ace_detector_2";
sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wav)), "db+1", 0.9};
titles[] = {};
};
class ace_detector_3 {
name = "ace_detector_3";
sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wav)), "db+1", 0.8};
titles[] = {};
};
class ace_detector_4 {
name = "ace_detector_4";
sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wav)), "db+1", 0.7};
titles[] = {};
};
};

View File

@ -8,7 +8,7 @@
private _helperObject = "ACE_LogicDummy" createVehicleLocal (getPos _unit);
_unit setvariable [QGVAR(helperLogic), _helperObject];
[FUNC(detectorLoop), 0.05, [_unit, _type, _config, ACE_time, _helperObject]] call CBA_fnc_addPerFrameHandler;
[FUNC(detectorLoop), 0.01, [_unit, _type, _config, ACE_time, _helperObject]] call CBA_fnc_addPerFrameHandler;
}] call EFUNC(common,addEventhandler);
["minedetector_disabled", {

View File

@ -35,10 +35,31 @@ if !([_unit, _type] call FUNC(isDetectorEnabled)) exitwith {
if (ACE_player == _unit && {currentWeapon _unit == _type}) then {
private _detected = [_unit, _detectorConfig] call FUNC(getDetectedObject);
_detected params ["_hasDetected", "_object", "_distance"];
if (_hasDetected && (ACE_time - _lastPlayed > 0.9)) then {
private _distanceTiming = switch (true) do {
case (_distance >= 2): {1};
case (_distance >= 1.25): {0.85};
case (_distance >= 0.75): {0.7};
default {0.5};
};
if (_hasDetected && (ACE_time - _lastPlayed > _distanceTiming)) then {
_args set [3, ACE_time];
_detectorConfig params ["_type", "_radius", "_detectableTypes", "_sounds"];
private _sound = _sounds select (_distance >= 1.2);
private _sound = switch (true) do {
case (_distance >= 2): {_sounds select 3};
case (_distance >= 1.25): {_sounds select 2};
case (_distance >= 0.5): {_sounds select 1};
default {_sounds select 0};
};
if ((_distance >= 1.2)) then {
if (_distance >= 2) then {
_sounds select 2;
} else {
_sounds select 1;
};
} else {
_sounds select 0;
};
[_unit, _sound, true] call FUNC(playDetectorSound);
};
};

View File

@ -25,6 +25,11 @@ if (!alive _unit) exitwith {
};
private _helperObject = _unit getvariable [QGVAR(helperLogic), objNull];
if (!isNull _helperObject) then {
deleteVehicle _helperObject;
};
_helperObject = "ACE_LogicDummy" createVehicleLocal (getPos _unit);
if !(isNull _helperObject) then {
_helperObject attachto [_unit,[0,0,-3],""];
[_helperObject, _unit] say3D _detectorSound;

Binary file not shown.