mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
Heal / Revive - Usage of HandleDamage EH
This commit is contained in:
parent
7648181ac4
commit
23c464970b
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
Author: He-Man - EpochMod.com
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
|
||||||
|
Description:
|
||||||
|
HandleDamage Eventhandler for A3 Epoch
|
||||||
|
|
||||||
|
Licence:
|
||||||
|
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
|
||||||
|
|
||||||
|
Github:
|
||||||
|
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/EPOCH_HandleDamage.sqf
|
||||||
|
*/
|
||||||
|
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
|
||||||
|
if !(_source isEqualTo _unit) then {
|
||||||
|
switch _projectile do {
|
||||||
|
case "B_EnergyPack": {
|
||||||
|
if (_source distance _unit > 10) exitwith {};
|
||||||
|
if (missionnamespace getvariable ["EPOCH_OldRevive",false]) exitwith {};
|
||||||
|
if ((missionnamespace getvariable ["EPOCH_HandleDamageTimeOut",diag_ticktime]) > diag_ticktime) exitwith {}; // prevent multiple actions here
|
||||||
|
EPOCH_HandleDamageTimeOut = diag_ticktime + 0.1;
|
||||||
|
_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;
|
||||||
|
};
|
||||||
|
}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];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
case "B_KnockOut": {
|
||||||
|
_unit setUnconscious true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
_damage
|
@ -41,6 +41,7 @@ switch true do {
|
|||||||
_attachments = handgunItems player;
|
_attachments = handgunItems player;
|
||||||
_heal = false;
|
_heal = false;
|
||||||
if (_cursorTarget isKindOf "Man") then {
|
if (_cursorTarget isKindOf "Man") then {
|
||||||
|
if !(missionnamespace getvariable ["EPOCH_OldRevive",false]) exitwith {};
|
||||||
if ("Heal_EPOCH" in _attachments) then {
|
if ("Heal_EPOCH" in _attachments) then {
|
||||||
_heal = true;
|
_heal = true;
|
||||||
};
|
};
|
||||||
|
21
Sources/epoch_code/customs/EPOCH_custom_EH_HandleDamage.sqf
Normal file
21
Sources/epoch_code/customs/EPOCH_custom_EH_HandleDamage.sqf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
Author: He-Man - EpochMod.com
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
|
||||||
|
Description:
|
||||||
|
Custom A3 Epoch HandleDamage Eventhandler
|
||||||
|
|
||||||
|
Licence:
|
||||||
|
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
|
||||||
|
|
||||||
|
Github:
|
||||||
|
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/custom/EPOCH_custom_EH_HandleDamage.sqf
|
||||||
|
*/
|
||||||
|
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_damage
|
@ -89,6 +89,9 @@ EPOCH_maxBuildingHeight = ["CfgEpochClient", "maxBuildingHeight", 100] call EPOC
|
|||||||
EPOCH_MaxBuildingTilt = ["CfgEpochClient", "MaxBuildingTilt", 180] call EPOCH_fnc_returnConfigEntryV2;
|
EPOCH_MaxBuildingTilt = ["CfgEpochClient", "MaxBuildingTilt", 180] call EPOCH_fnc_returnConfigEntryV2;
|
||||||
Epoch_NuisanceMulti = ["CfgEpochClient", "NuisanceMulti", 0.5] call EPOCH_fnc_returnConfigEntryV2;
|
Epoch_NuisanceMulti = ["CfgEpochClient", "NuisanceMulti", 0.5] call EPOCH_fnc_returnConfigEntryV2;
|
||||||
|
|
||||||
|
// Use Eventhandler "Fired" on Reviver instead of Eventhandler "HandeDamage" on Client to be revived for Heal / Revive Player
|
||||||
|
EPOCH_OldRevive = ["CfgEpochClient", "UseOldRevive", false] call EPOCH_fnc_returnConfigEntryV2;
|
||||||
|
|
||||||
//ON INIT and RESPAWN
|
//ON INIT and RESPAWN
|
||||||
call EPOCH_clientInit;
|
call EPOCH_clientInit;
|
||||||
|
|
||||||
|
@ -101,6 +101,7 @@ class CfgClientFunctions
|
|||||||
{
|
{
|
||||||
class getInMan {};
|
class getInMan {};
|
||||||
class getOutMan {};
|
class getOutMan {};
|
||||||
|
class HandleDamage {};
|
||||||
class InventoryClosed {};
|
class InventoryClosed {};
|
||||||
class InventoryOpened {};
|
class InventoryOpened {};
|
||||||
};
|
};
|
||||||
@ -232,6 +233,7 @@ class CfgClientFunctions
|
|||||||
class custom_EH_FiredNear {};
|
class custom_EH_FiredNear {};
|
||||||
class custom_EH_GetInMan {};
|
class custom_EH_GetInMan {};
|
||||||
class custom_EH_GetOutMan {};
|
class custom_EH_GetOutMan {};
|
||||||
|
class custom_EH_HandleDamage {};
|
||||||
class custom_EH_Hit {};
|
class custom_EH_Hit {};
|
||||||
class custom_EH_InventoryClosed {};
|
class custom_EH_InventoryClosed {};
|
||||||
class custom_EH_InventoryOpened {};
|
class custom_EH_InventoryOpened {};
|
||||||
|
@ -18,6 +18,8 @@ class CfgEpochClient
|
|||||||
ArmAVersion = 176;
|
ArmAVersion = 176;
|
||||||
debug = "true"; // true = enable extra rpt debug lines, false to disable
|
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!)
|
||||||
|
|
||||||
antagonistRngChance = 100; // increase number to reduce chances and reduce to increase. Default 100
|
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)
|
NuisanceMulti = 0.5; // Multi for Nuisance increase on shooting - higher Nuisance effect at least antagonist spawn change. (0-1, default 0.5)
|
||||||
|
|
||||||
@ -199,7 +201,7 @@ class CfgEpochClient
|
|||||||
displayAddEventHandler[] = {"keyDown","keyUp"};
|
displayAddEventHandler[] = {"keyDown","keyUp"};
|
||||||
keyDown = "(_this call EPOCH_KeyDown)";
|
keyDown = "(_this call EPOCH_KeyDown)";
|
||||||
keyUp = "(_this call EPOCH_KeyUp)";
|
keyUp = "(_this call EPOCH_KeyUp)";
|
||||||
addEventHandler[] = {"Respawn","Put","Take","InventoryClosed","InventoryOpened","FiredMan","Killed","HandleRating","HandleScore","GetInMan","GetOutMan","Hit","SeatSwitchedMan","FiredNear"};
|
addEventHandler[] = {"Respawn","Put","Take","InventoryClosed","InventoryOpened","FiredMan","Killed","HandleRating","HandleScore","HandleDamage","GetInMan","GetOutMan","Hit","SeatSwitchedMan","FiredNear"};
|
||||||
Respawn = "(_this select 0) call EPOCH_clientRespawn";
|
Respawn = "(_this select 0) call EPOCH_clientRespawn";
|
||||||
Put = "(_this select 1) call EPOCH_interact;_this call EPOCH_PutHandler;_this call Epoch_custom_EH_Put";
|
Put = "(_this select 1) call EPOCH_interact;_this call EPOCH_PutHandler;_this call Epoch_custom_EH_Put";
|
||||||
Take = "(_this select 1) call EPOCH_interact;_this call EPOCH_UnisexCheck;_this call Epoch_custom_EH_Take";
|
Take = "(_this select 1) call EPOCH_interact;_this call EPOCH_UnisexCheck;_this call Epoch_custom_EH_Take";
|
||||||
@ -209,7 +211,7 @@ class CfgEpochClient
|
|||||||
Killed = "_this call EPOCH_fnc_playerDeath;_this call Epoch_custom_EH_Killed";
|
Killed = "_this call EPOCH_fnc_playerDeath;_this call Epoch_custom_EH_Killed";
|
||||||
HandleRating = "0";
|
HandleRating = "0";
|
||||||
HandleScore = "";
|
HandleScore = "";
|
||||||
HandleDamage = "";
|
HandleDamage = "_this call EPOCH_HandleDamage;_this call EPOCH_custom_EH_HandleDamage";
|
||||||
HandleHeal = "";
|
HandleHeal = "";
|
||||||
Dammaged = "";
|
Dammaged = "";
|
||||||
Hit = "_this call EPOCH_custom_EH_Hit";
|
Hit = "_this call EPOCH_custom_EH_Hit";
|
||||||
|
@ -13,12 +13,13 @@
|
|||||||
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_player/EPOCH_server_revivePlayer.sqf
|
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_player/EPOCH_server_revivePlayer.sqf
|
||||||
*/
|
*/
|
||||||
//[[[cog import generate_private_arrays ]]]
|
//[[[cog import generate_private_arrays ]]]
|
||||||
private ["_loadabs","_loadout","_CorpseCrypto","_PlayerCrypto","_attachments","_cIndex","_class","_currwh","_deleteprimary","_deletesecondary","_dir","_droppedPrimary","_droppedSecondary","_droppedWeapons","_equipped","_group","_garbage","_location","_newPlyr","_playerGroup","_playerUID","_token","_type","_vars","_wMags","_wMagsArray","_weapon","_wh","_kIndex","_reviver","_reviverCStats","_reviverKarma","_reviverKarmaAdj"];
|
private ["_caller","_loadabs","_loadout","_CorpseCrypto","_PlayerCrypto","_attachments","_cIndex","_class","_currwh","_deleteprimary","_deletesecondary","_dir","_droppedPrimary","_droppedSecondary","_droppedWeapons","_equipped","_group","_garbage","_location","_newPlyr","_playerGroup","_playerUID","_token","_type","_vars","_wMags","_wMagsArray","_weapon","_wh","_kIndex","_reviver","_reviverCStats","_reviverKarma","_reviverKarmaAdj"];
|
||||||
//[[[end]]]
|
//[[[end]]]
|
||||||
params ["_player","_reviver",["_token","",[""]] ];
|
params ["_player","_reviver",["_token","",[""]] ];
|
||||||
|
_caller = if (remoteExecutedOwner == (owner _reviver)) then {_reviver} else {_player};
|
||||||
if !([_reviver, _token] call EPOCH_server_getPToken) exitWith{};
|
if !([_caller, _token] call EPOCH_server_getPToken) exitWith{};
|
||||||
if (isNull _player) exitWith{};
|
if (isNull _player) exitWith{};
|
||||||
|
if !(isplayer _reviver) exitWith{};
|
||||||
if (_player distance _reviver > 20) exitWith{};
|
if (_player distance _reviver > 20) exitWith{};
|
||||||
|
|
||||||
if (!local _player) then {
|
if (!local _player) then {
|
||||||
|
Loading…
Reference in New Issue
Block a user