a3_vemf_reloaded/exile_vemf_reloaded/sqf/aiKilled.sqf

138 lines
4.2 KiB
Plaintext
Raw Normal View History

2016-05-10 12:19:40 +00:00
/*
2016-07-02 14:24:53 +00:00
Author: IT07
2016-05-10 12:19:40 +00:00
Description:
2016-06-11 21:13:36 +00:00
executed upon AI unit death
2016-05-10 12:19:40 +00:00
Params:
_this: ARRAY
_this select 0: OBJECT - the killed AI
_this select 1: OBJECT - killer
Returns:
nothing
*/
2016-07-02 14:24:53 +00:00
(_this select 0) params [
["_t", objNull, [objNull]],
["_nt", "", [""]]
];
(_this select 1) params [
["_k", objNull, [objNull]],
["_nk", "", [""]]
];
if (isPlayer _k) then
2016-05-10 12:19:40 +00:00
{
2016-07-02 14:24:53 +00:00
if (_k isKindOf "Man") then // Roadkill or regular kill
2016-05-10 12:19:40 +00:00
{
2016-07-02 14:24:53 +00:00
if (vehicle _k isEqualTo _k) then // If on foot
2016-05-10 12:19:40 +00:00
{
2016-07-02 14:24:53 +00:00
if (vehicle _t isEqualTo _t) then
2016-05-10 12:19:40 +00:00
{
2016-07-02 14:24:53 +00:00
if (("respectReward" call VEMFr_fnc_config) > 0) then
2016-06-11 21:13:36 +00:00
{
2016-07-02 14:24:53 +00:00
[_t, _k] ExecVM "exile_vemf_reloaded\sqf\respect.sqf";
2016-06-11 21:13:36 +00:00
};
2016-07-02 14:24:53 +00:00
[[_t, _nt],[_k, _nk]] ExecVM "exile_vemf_reloaded\sqf\sayKilledWeapon.sqf";
2016-06-20 22:19:29 +00:00
} else
{
2016-07-02 14:24:53 +00:00
if (typeOf (vehicle _t) isEqualTo "Steerable_Parachute_F") then
2016-06-20 22:19:29 +00:00
{
2016-07-02 14:24:53 +00:00
if ("logCowardKills" call VEMFr_fnc_config isEqualTo 1) then
2016-06-20 22:19:29 +00:00
{
2016-07-02 14:24:53 +00:00
["fn_aiKilled", 1, format["A coward (%1 @ %2) killed a parachuting AI", _nk, mapGridPosition _k]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
2016-06-20 22:19:29 +00:00
};
} else
{
2016-07-02 14:24:53 +00:00
if (("respectReward" call VEMFr_fnc_config) > 0) then
2016-06-20 22:19:29 +00:00
{
2016-07-02 14:24:53 +00:00
[_t, _k] ExecVM "exile_vemf_reloaded\sqf\respect.sqf";
2016-06-20 22:19:29 +00:00
};
2016-07-02 14:24:53 +00:00
[[_t, _nt],[_k, _nk]] ExecVM "exile_vemf_reloaded\sqf\sayKilledWeapon.sqf";
2016-06-20 22:19:29 +00:00
};
2016-05-10 12:19:40 +00:00
};
2016-06-20 22:19:29 +00:00
} else // If in vehicle (a.k.a. roadkill)
2016-05-10 12:19:40 +00:00
{
2016-07-02 14:24:53 +00:00
if (("punishRoadKills" call VEMFr_fnc_config) isEqualTo 1) then
2016-06-11 21:13:36 +00:00
{
2016-07-02 14:24:53 +00:00
_pnsh = "respectRoadKillDeduct" call VEMFr_fnc_config;
_crRspct = _k getVariable ["ExileScore", 0];
//diag_log text format["_crRspct of _k (%1) is %2", _k, _crRspct];
_nwRspct = _crRspct - _pnsh;
_k setVariable ["ExileScore", _nwRspct];
ExileClientPlayerScore = _nwRspct;
(owner _k) publicVariableClient "ExileClientPlayerScore";
2016-06-20 22:19:29 +00:00
ExileClientPlayerScore = nil;
2016-07-02 14:24:53 +00:00
[_k, "showFragRequest", [[["ROADKILL..."],["Respect Penalty:", -_pnsh]]]] call ExileServer_system_network_send_to;
format["setAccountMoneyAndRespect:%1:%2:%3", _k getVariable ["ExileMoney", 0], _nwRspct, (getPlayerUID _k)] call ExileServer_system_database_query_fireAndForget;
2016-06-20 22:19:29 +00:00
2016-07-02 14:24:53 +00:00
if (("sayKilled" call VEMFr_fnc_config) isEqualTo 1) then
2016-06-20 22:19:29 +00:00
{
2016-07-02 14:24:53 +00:00
[format["(VEMFr) %1 [Roadkill] %2", _nk, if (("sayKilledName" call VEMFr_fnc_config) > 0) then {_nt} else {"AI"}]] ExecVM "exile_vemf_reloaded\sqf\systemChatToClient.sqf";
2016-06-20 22:19:29 +00:00
};
2016-06-11 21:13:36 +00:00
};
2016-05-10 12:19:40 +00:00
};
2016-06-20 22:19:29 +00:00
} else // If kill from vehicle (NOT a roadkill)
2016-05-10 12:19:40 +00:00
{
2016-07-02 14:24:53 +00:00
if (typeOf (vehicle _t) isEqualTo "Steerable_Parachute_F") then
2016-05-10 12:19:40 +00:00
{
2016-07-02 14:24:53 +00:00
if ("logCowardKills" call VEMFr_fnc_config isEqualTo 1) then
2016-06-20 22:19:29 +00:00
{
2016-07-02 14:24:53 +00:00
["fn_aiKilled", 1, format["A coward (%1 @ %2) killed a parachuting AI", _nk, mapGridPosition _k]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
2016-06-20 22:19:29 +00:00
};
} else
2016-05-10 12:19:40 +00:00
{
2016-07-02 14:24:53 +00:00
_k = effectiveCommander _k;
if (("respectReward" call VEMFr_fnc_config) > 0) then
2016-06-20 22:19:29 +00:00
{
2016-07-02 14:24:53 +00:00
[_t, _k] ExecVM "exile_vemf_reloaded\sqf\respect.sqf";
2016-06-20 22:19:29 +00:00
};
2016-07-02 14:24:53 +00:00
[[_t, _nt],[_k, _nk]] ExecVM "exile_vemf_reloaded\sqf\sayKilledWeapon.sqf";
2016-05-10 12:19:40 +00:00
};
};
2016-06-11 21:13:36 +00:00
};
2016-05-10 12:19:40 +00:00
2016-07-02 14:24:53 +00:00
([["aiCleanup"],["removeLaunchers","aiDeathRemovalEffect","removeHeadGear"]] call VEMFr_fnc_config) params ["_ms0","_ms1","_ms2"];
if (_ms0 isEqualTo 1) then
2016-05-10 12:19:40 +00:00
{
2016-07-02 14:24:53 +00:00
_sw = secondaryWeapon _t;
if not(_sw isEqualTo "") then
2016-05-10 12:19:40 +00:00
{
2016-07-02 14:24:53 +00:00
_t removeWeaponGlobal _sw;
_mssls = getArray (configFile >> "cfgWeapons" >> _sw >> "magazines");
2016-05-10 12:19:40 +00:00
{
2016-07-02 14:24:53 +00:00
if (_x in _mssls) then
2016-06-11 21:13:36 +00:00
{
2016-07-02 14:24:53 +00:00
_t removeMagazineGlobal _x;
2016-06-11 21:13:36 +00:00
};
2016-07-02 14:24:53 +00:00
} forEach (magazines _t);
2016-06-11 21:13:36 +00:00
};
2016-05-10 12:19:40 +00:00
};
2016-07-02 14:24:53 +00:00
if (_ms2 isEqualTo 1) then // If removeHeadGear setting is enabled
2016-05-10 12:19:40 +00:00
{
2016-07-02 14:24:53 +00:00
removeHeadGear _t;
2016-05-10 12:19:40 +00:00
};
2016-07-02 14:24:53 +00:00
if (_ms1 isEqualTo 1) then // If killEffect enabled
2016-05-10 12:19:40 +00:00
{
2016-07-02 14:24:53 +00:00
playSound3D ["A3\Missions_F_Bootcamp\data\sounds\vr_shutdown.wss", _t, false, getPosASL _t, 2, 1, 60];
2016-05-10 12:19:40 +00:00
for "_u" from 1 to 12 do
{
2016-07-02 14:24:53 +00:00
if not(isObjectHidden _t) then
2016-05-10 12:19:40 +00:00
{
2016-07-02 14:24:53 +00:00
_t hideObjectGlobal true;
2016-05-10 12:19:40 +00:00
} else
{
2016-07-02 14:24:53 +00:00
_t hideObjectGlobal false;
2016-05-10 12:19:40 +00:00
};
uiSleep 0.12;
};
2016-07-02 14:24:53 +00:00
_t hideObjectGlobal true;
removeAllWeapons _t;
2016-05-10 12:19:40 +00:00
// Automatic cleanup yaaay
2016-07-02 14:24:53 +00:00
deleteVehicle _t;
2016-05-10 12:19:40 +00:00
};
2016-07-02 14:24:53 +00:00
_t removeAllEventHandlers "MPKilled";