I want to re-write the humanity system (with some success already)!
First i overwrite the cliend-side fn_damageHandler.sqf, and removed following part:
/* _canHitFree = player getVariable ["freeTarget",false]; _isBandit = (player getVariable["humanity",0]) <= -5000; _isPZombie = player isKindOf "PZombie_VB"; if (!_canHitFree && !_isBandit && !_isPZombie) then { //Process Morality Hit _myKills = 0 max (1 - (player getVariable ["humanKills",0]) / 5); _humanityHit = -100 * _myKills * _damage; if (_humanityHit != 0) then { [_source,_humanityHit] spawn { private ["_source","_humanityHit"]; _source = _this select 0; _humanityHit = _this select 1; PVDZE_send = [_source,"Humanity",[_source,_humanityHit,30]]; publicVariableServer "PVDZE_send"; }; }; }; */
I believe this is some epoch "wannabe" random humanity crap (never understood why).
Now in server_playerDied.sqf i added following:
(...) if ((owner _victim) == (owner _killer)) then { (...) _message = format["%1 killed himself",_victimName]; _loc_message = format["PKILL: %1 killed himself", _victimName]; } else { //custom humanity private ["_vichumanity","_killerhumanity"]; _vichumanity = _victim getVariable ["humanity",0]; _killerhumanity = _killer getVariable ["humanity",0]; //bandit/hero // level1 +/- 5000 // level2 +/- 10000 // level3 +/- 20000 // a hero who kills a hero, same loss of humanity at any time if((_vichumanity > 4999)) then { if(_killerhumanity > 4999) then { // lvl1 hero kille by lvl3 hero _killerhumanity = _killerhumanity - 800; _killer setVariable ["humanity",_killerhumanity,true]; _vichumanity = _vichumanity - 300; _victim setVariable ["humanity",_vichumanity,true]; }; }; //custom humanity _message = format["%1 was killed by %2 with weapon %3 from %4m",_victimName, _killerName, _weapon, _distance]; _loc_message = format["PKILL: %1 was killed by %2 with weapon %3 from %4m", _victimName, _killerName, _weapon, _distance]; }; (...)
Tested with 2 Players, both had exactly 5000 humanity.
Victim was killed by Killer.
Victim humanity: 4700 (should be 4700)
Killer humanity: 2987 (should be 4200)
I dont get it, where else does epoch screw up the humanity?
Anyone got any idea?