Killmsgs when AI kills a player (EPOCH)

Torndeco

Valued Member!
@DayZ_Epoch_Server\addons\dayz_server\compile\fnc_plyrHit.sqf

Code:
private ["_victim", "_attacker","_weapon","_distance","_damage","_sargecheck","_attacker_name"];
_victim = _this select 0;
_attacker = _this select 1;
_damage = _this select 2;
_sargecheck = (_attacker getVariable ["Sarge",0] != 1);
 
if (!isPlayer _victim || ((!isPlayer _attacker)  and (!_sargecheck)) ) exitWith {};
if ((name _victim) == (name _attacker)) exitWith {};
 
_weapon = weaponState _attacker;
if (_weapon select 0 == "Throw") then
{
    _weapon = _weapon select 3;
}
else
{
    _weapon = _weapon select 0;
};
 
_distance = _victim distance _attacker;
 
if (_sargecheck) then {
    switch (name _attacker) do
    {
        case "Rincewind":
        {
            _attacker_name = "AI Sniper";
        };
        case "Cohen the Barbarian":
        {
            _attacker_name = "AI Bandit";
        };
        case "Sarge":
        {
            _attacker_name = "AI Soldier Leader";
        };
        case "Face66":
        {
            _attacker_name = "AI Soldier";
        };
        case "Max Hero":
        {
            _attacker_name = "AI Survivor Leader";
        };
        case "John Bambi":
        {
            _attacker_name = "AI Survivor";
        };
        default
        {
            diag_log format ["DEBUG - Unknown SARGE AI - %1", _attacker];
            _attacker_name = "AI";
        };
    };
} else {
    _attacker_name = name _attacker
};
 
diag_log format["PHIT: %1 was hit by %2 with %3 from %4m with %5 dmg", _victim, _attacker, _weapon, _distance, _damage];
 
_victim setVariable["AttackedBy", _attacker, true];
_victim setVariable["AttackedByName", _attacker_name, true];
//_victim setVariable["AttackedByWeapon", (currentWeapon _attacker), true];
_victim setVariable["AttackedByWeapon", _weapon, true];
_victim setVariable["AttackedFromDistance", _distance, true];

This will also work for normal ai spawned in by Cherno Missions etc... once they have the variable Sarge set.

Also u must have enabled killmsgs

--------------

Should be easy enough todo with other mods with killmsgs...
 
can you use this for DZAI and just change

if (_sargecheck) then {
switch (name _attacker) do
{


to


if (_DZAIcheck) then {
switch (name _attacker) do
{



or change

_sargecheck = (_attacker getVariable ["Sarge",0] != 1);

to

_sargecheck = (_attacker getVariable ["DZAI",0] != 1);

thanks
 
Back
Top