28 lines
765 B
Plaintext
28 lines
765 B
Plaintext
#include "..\script_component.hpp"
|
|
|
|
params [["_object", objNull, [objNull]]];
|
|
if (isNull _object) exitWith {};
|
|
if (_object isKindOf "CAManBase") exitWith {};
|
|
|
|
// we're broadcasting a playSound3D command to all clients,
|
|
// so this only be run on the server
|
|
if (!isServer) exitWith {};
|
|
|
|
private _playSound = selectRandomWeighted [true,GVAR(chanceToPlayZap),false,(100-GVAR(chanceToPlayZap))];
|
|
if (_playSound) then {
|
|
private _sound = selectRandom ["zap1","zap2","zap3","zap4"];
|
|
playSound3D [
|
|
format [
|
|
"%1.wss",
|
|
getMissionPath ("framework\emp\sounds\" + _sound)
|
|
],
|
|
_object,
|
|
false,
|
|
getPosASL _object,
|
|
1, // volume
|
|
1, // pitch
|
|
GVAR(zapAudibleDistance), // max distance heard
|
|
0, // time offset sec
|
|
false // NOT local, send to all clients
|
|
];
|
|
}; |