Modified the Defibrillator revive code to take energey instead. No item needed. Added a heal function if the player is over 50% food and drink.

This commit is contained in:
Zepheris 2020-02-18 18:01:55 -07:00
parent fef4441fd7
commit f6987dddc9
3 changed files with 50 additions and 4 deletions

View File

@ -17,6 +17,27 @@ private ["_item","_energyneeded","_totalDefis","_CurDefiArr"];
params ["_unit"];
if (isplayer _unit) then {
_energyneeded = 100;
if (EPOCH_playerEnergy - _energyneeded > 0) then {
_output = ["Energy", -_energyneeded] call EPOCH_giveAttributes;
_unit spawn {
player playMove 'AinvPknlMstpSnonWrflDnon_medic0';
player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd';
uisleep 8;
if (alive player && isplayer _this) then {
[_this,player,Epoch_personalToken] remoteExec ['EPOCH_server_revivePlayer',2];
};
};
} else {
['Not enough energy to revive',5] call Epoch_Message;
};
}
else {
['This Player can not be revived',5] call Epoch_Message;
};
/*
if (isplayer _unit) then {
_item = 'ItemDefibrillator';
if (_item in magazines player) then {
@ -54,4 +75,5 @@ if (isplayer _unit) then {
}
else {
['This Player can not be revived',5] call Epoch_Message;
};
};
*/

View File

@ -46,7 +46,7 @@ if !(alive player && alive _playerObject && !isPlayer _playerObject) then {
// wait for loadAbs to sync
waitUntil {_loadAbs isEqualTo (loadAbs _playerObject)};
_goggles = goggles _playerObject;
// switch to new playerObject
@ -56,7 +56,8 @@ if !(alive player && alive _playerObject && !isPlayer _playerObject) then {
deleteVehicle _prevPlayerObject;
// set token and can revive to false
Epoch_canBeRevived = false;
//Updated by Zepheris Epoch_canBeRevived = true;
Epoch_canBeRevived = true;
Epoch_personalToken = _personalToken;
// reset blood Pressure to warning level
@ -92,4 +93,3 @@ if !(alive player && alive _playerObject && !isPlayer _playerObject) then {
} else {
deleteVehicle _playerObject;
};

View File

@ -10,3 +10,27 @@ if (_forceUpdate || EPOCH_forceUpdate) then {
EPOCH_forceUpdateNow = false;
call _fnc_forceUpdate;
};
//HeMan health regen values are for 50%
_ReduceHealth = 0;
if (EPOCH_playerThirst > 1250) then {
_ReduceHealth = _ReduceHealth + EPOCH_playerThirst*0.00001;
};
if (EPOCH_playerHunger > 2500) then {
_ReduceHealth = _ReduceHealth + EPOCH_playerHunger*0.00001;
};
_highestDMG = damage player;
_alldmg = ((getAllHitPointsDamage player) param [2,[]]);
{
_currentDMG = _x;
if (_currentDMG > _highestDMG) then{
_highestDMG = _currentDMG;
};
} forEach _alldmg;
if (_highestDMG > 0) then {
_MaxNewDmg = (_highestDMG - _ReduceHealth) max 0;
player setdamage ((damage player) min _MaxNewDmg);
{
player setHitIndex [_foreachindex,_x min _MaxNewDmg];
} foreach _alldmg;
};