Humanity fix for shooting player zeds and bandits

Prevents loss of humanity from shooting player zombies and bandits. Adds
a cap to humanity loss per shot depending on the players murders, where
the cap is zero. This preventing the shooter from getting positive
humanity, which could be exploited to farm humanity using 2 players.
This commit is contained in:
Armifer
2013-11-08 20:26:12 -05:00
parent 073db698d5
commit 0e77c78809

View File

@@ -5,7 +5,7 @@ scriptName "Functions\misc\fn_damageHandler.sqf";
- Function
- [unit, selectionName, damage, source, projectile] call fnc_usec_damageHandler;
************************************************************/
private ["_unit","_humanityHit","_myKills","_hit","_damage","_isPlayer","_unconscious","_wound","_isHit","_isInjured","_type","_hitPain","_isCardiac","_isHeadHit","_isMinor","_scale","_canHitFree","_rndPain","_rndInfection","_hitInfection","_lowBlood","_isPZombie","_source","_ammo","_unitIsPlayer"];
private ["_unit","_humanityHit","_myKills","_hit","_damage","_isPlayer","_unconscious","_wound","_isHit","_isInjured","_type","_hitPain","_isCardiac","_isHeadHit","_isMinor","_scale","_canHitFree","_rndPain","_rndInfection","_hitInfection","_lowBlood","_isPZombie","_source","_ammo","_unitIsPlayer","_isBandit"];
_unit = _this select 0;
_hit = _this select 1;
_damage = _this select 2;
@@ -59,18 +59,23 @@ if (_unitIsPlayer) then {
_source setVariable["startcombattimer",1];
};
_canHitFree = player getVariable ["freeTarget",false];
_isBandit = (player getVariable["humanity",0]) <= -5000;
_isPZombie = player isKindOf "PZombie_VB";
if (!_canHitFree) then {
_myKills = 200 - (((player getVariable ["humanKills",0]) / 30) * 100);
if (!_canHitFree and !_isBandit and !_isPZombie) then {
//Process Morality Hit
_humanityHit = -(_myKills * _damage);
_myKills = 0 max (1 - (player getVariable ["humanKills",0]) / 5);
_humanityHit = -100 * _myKills * _damage;
//["PVDZE_plr_HumanityChange",[_source,_humanityHit,30]] call broadcastRpcCallAll;
if (_humanityHit != 0) then {
PVDZE_plr_HumanityChange = [_source,_humanityHit,30];
publicVariable "PVDZE_plr_HumanityChange";
};
};
};
};
};
//PVP Damage
_scale = 200;