From 4a6506513cd2d1e14d0da25b0cee8b8ce0556a51 Mon Sep 17 00:00:00 2001 From: He-Man Date: Fri, 13 Sep 2019 14:53:47 +0200 Subject: [PATCH] NL Weapons - Scripts --- .../event_handlers/EPOCH_HandleDamage.sqf | 89 ++++++++++--------- .../epoch_config/Configs/CfgEpochClient.hpp | 2 + 2 files changed, 50 insertions(+), 41 deletions(-) diff --git a/Sources/epoch_code/compile/event_handlers/EPOCH_HandleDamage.sqf b/Sources/epoch_code/compile/event_handlers/EPOCH_HandleDamage.sqf index 75f72d8a..ada6fb4c 100644 --- a/Sources/epoch_code/compile/event_handlers/EPOCH_HandleDamage.sqf +++ b/Sources/epoch_code/compile/event_handlers/EPOCH_HandleDamage.sqf @@ -18,60 +18,67 @@ if !(_source isEqualTo _unit) then { switch _projectile do { case "B_EnergyPack": { EPOCH_HandleDamageTimeOut = diag_ticktime + 0.1; - if (currentweapon _source isEqualTo "pvcrifle_01_epoch") then { - if !(lifeState _unit == "INCAPACITATED") then { - EPOCH_HandleDamageTimeOut = diag_ticktime + 1; - _unit setUnconscious true; - EPOCH_UnconsciousTime = diag_ticktime + 60 + (random 120); - ["You are Knocked out for a while...",5] call Epoch_Message; - }; - } - else { - if (_source distance _unit > 10) exitwith {}; - if !(missionnamespace getvariable ["EPOCH_OldRevive",false]) then { - _attachments = handgunItems _source; - if ("Heal_EPOCH" in _attachments) then { - if (lifeState _unit == "INCAPACITATED") exitwith { - EPOCH_HandleDamageTimeOut = diag_ticktime + 1; - _unit setUnconscious false; - _unit playMoveNow 'AmovPercMstpSnonWnonDnon'; + if (_source distance _unit > 10) exitwith {}; + if !(missionnamespace getvariable ["EPOCH_OldRevive",false]) then { + _attachments = handgunItems _source; + if ("Heal_EPOCH" in _attachments) then { + if (lifeState _unit == "INCAPACITATED") exitwith { + EPOCH_HandleDamageTimeOut = diag_ticktime + 1; + _unit setUnconscious false; + _unit playMoveNow 'AmovPercMstpSnonWnonDnon'; + }; + _highestDMG = 0; + _currentHIT = -1; + _currentDMG = 0; + { + _currentDMG = _x; + if (_currentDMG > _highestDMG) then{ + _highestDMG = _currentDMG; + _currentHIT = _forEachIndex; }; - _highestDMG = 0; - _currentHIT = -1; - _currentDMG = 0; - { - _currentDMG = _x; - if (_currentDMG > _highestDMG) then{ - _highestDMG = _currentDMG; - _currentHIT = _forEachIndex; - }; - }forEach((getAllHitPointsDamage _unit) param[2,[]]); - if (_highestDMG > 0) then { - _newDMG = 0; - [_unit,[[_currentHIT,_newDMG]]] call EPOCH_client_repairVehicle; - } else { - if ((damage _unit) > 0) then { - [_unit,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2]; - }; + }forEach((getAllHitPointsDamage _unit) param[2,[]]); + if (_highestDMG > 0) then { + _newDMG = 0; + [_unit,[[_currentHIT,_newDMG]]] call EPOCH_client_repairVehicle; + } else { + if ((damage _unit) > 0) then { + [_unit,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2]; }; }; - if ("Defib_EPOCH" in _attachments) then { - if !(alive _unit) then { - EPOCH_HandleDamageTimeOut = diag_ticktime + 1; - [_unit,_source,Epoch_personalToken] remoteExec ["EPOCH_server_revivePlayer",2]; - }; + }; + if ("Defib_EPOCH" in _attachments) then { + if !(alive _unit) then { + EPOCH_HandleDamageTimeOut = diag_ticktime + 1; + [_unit,_source,Epoch_personalToken] remoteExec ["EPOCH_server_revivePlayer",2]; }; }; }; }; - case "B_KnockOut": { + case "shell_12g_bb"; + case "bbag_pvc"; + case "xbow_tranq"; + case "tranq_dart": { if !(lifeState _unit == "INCAPACITATED") then { EPOCH_HandleDamageTimeOut = diag_ticktime + 1; _unit setUnconscious true; - EPOCH_UnconsciousTime = diag_ticktime + 60 + (random 120); + (["CfgEpochClient", "UnconsciousTime", [60,180]] call EPOCH_fnc_returnConfigEntryV2) params [["_mintime",60],["_maxtime",180]]; + EPOCH_UnconsciousTime = diag_ticktime + _mintime + (random (_maxtime - _mintime)); ["You are Knocked out for a while...",5] call Epoch_Message; }; }; + case "B_Swing"; + case "B_Stick"; + case "B_Hatchet": { + if !(lifeState _unit == "INCAPACITATED") then { + if ((random 100) < (["CfgEpochClient", "UnconsciousChance", 30] call EPOCH_fnc_returnConfigEntryV2)) then { + EPOCH_HandleDamageTimeOut = diag_ticktime + 1; + _unit setUnconscious true; + (["CfgEpochClient", "UnconsciousTime", [60,180]] call EPOCH_fnc_returnConfigEntryV2) params [["_mintime",60],["_maxtime",180]]; + EPOCH_UnconsciousTime = diag_ticktime + _mintime + (random (_maxtime - _mintime)); + ["You are Knocked out for a while...",5] call Epoch_Message; + }; + }; + }; }; }; _damage diff --git a/Sources/epoch_config/Configs/CfgEpochClient.hpp b/Sources/epoch_config/Configs/CfgEpochClient.hpp index 7e3d3c9a..6b9fcd30 100644 --- a/Sources/epoch_config/Configs/CfgEpochClient.hpp +++ b/Sources/epoch_config/Configs/CfgEpochClient.hpp @@ -19,6 +19,8 @@ class CfgEpochClient debug = "true"; // true = enable extra rpt debug lines, false to disable UseOldRevive = "false"; // Revive / Heal Player has been changed to use "HandleDamage" Eventhandler. If scripts are breaking it for you, set it to true (not recommended!) + UnconsciousChance = 30; // Change in percent to get unconscious by a hit with an Axe / Sledge / Sword + UnconsciousTime[] = {60,180}; // Min / Max time for unconscious after you got a hit from a non lethal weapon / Axe / Sledge / Sword antagonistRngChance = 100; // increase number to reduce chances and reduce to increase. Default 100 NuisanceMulti = 0.5; // Multi for Nuisance increase on shooting - higher Nuisance effect at least antagonist spawn change. (0-1, default 0.5)