VN_ms_fnc_tracker_onPlayerFired
Revision as of 22:35, 5 January 2021 by Lou Montana (talk | contribs) (Text replacement - " {{Function" to "Category:TODO {{Function")
← back to Functions | Introduced in S.O.G. Prairie Fire v1.00 by Wyqer, veteran29 |
|
Description
/* Author: Wyqer, veteran29 Date: 2019-07-14 Description: Handles fired event to notify patrolling units etc. Parameter(s): AS PER "FIRED" EH, see: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Fired Returns: NOTHING */ params [ "_unit", "_weapon", "_muzzle", "", "_ammo", "", "_projectile" ]; // TODO if (_weapon == "throw") exitWith { #ifdef VN_DEBUG systemChat "TODO Tracker grenade handler"; #endif }; private _shotTimeout = _unit getVariable ["vn_tracker_shotTimeout", 0]; if (diag_tickTime < _shotTimeout) exitWith {}; // do not allow to trigger this too frequently, might need tweaking _unit setVariable ["vn_tracker_shotTimeout", diag_tickTime + 20]; private _muzzleAttachement = _unit weaponAccessories _muzzle param [0, ""]; // get ammo audible distance private _audibleFire = vn_ms_tracker_audibleFireCache getVariable (_muzzleAttachement+_ammo); if (isNil "_audibleFire") then { private _audibleFireAmmo = getNumber (configFile >> "CfgAmmo" >> _ammo >> "audibleFire"); private _audibleFireMuzzle = getNumber (configFile >> "CfgWeapons" >> _muzzleAttachement >> "ItemInfo" >> "AmmoCoef" >> "audibleFire"); // If there is no entry for this muzzle / there is no attachment assume default coef of 1 if (_audibleFireMuzzle == 0) then {_audibleFireMuzzle = 1}; _audibleFire = _audibleFireAmmo * _audibleFireMuzzle; vn_ms_tracker_audibleFireCache setVariable [(_muzzleAttachement+_ammo), _audibleFire]; }; // difficulty coeficient with default in case our scripts are used outside of campaign private _difficultyCoef = 1 + (missionNamespace getVariable ["vn_difficulty", 1]); // audible distance after applying all coeficients private _audibleSoundDist = _audibleFire * _difficultyCoef * VN_MS_AUDIBLE_FIRE_COEF; #ifdef VN_DEBUG systemChat format ["Gunshot dist - %1: %2, %3", (_ammo+_muzzleAttachement), _audibleFire, _audibleSoundDist]; #endif // broadcast the noise to server if (isMultiplayer) then {(Placeholder description extracted from the function header by LM_exportFunctionsToWiki.sqf)
Syntax
- Syntax
- [] call vn_ms_fnc_tracker_onPlayerFired;
- Return value
- Nothing
Examples
- Example 1
-