Jump to content

[Release] Custom Kill Messages


0verHeaT

Recommended Posts

Description

 

Get all kill notification nicely displayed in the left upper corner. This will include the picture of the gun and the shot distance.

 

The format will look like that:

 

[killer] ['image'] [victim] ['distance in meters']

 

To see how it will look like in game:

f-msg542161580017a355.jpg

 

UPDATE

  • fixed bug where dead players spawn near their bodies with their old gear
  • message will only appear when a player is shot by someone else
  • if an attacker killed another player with a vehicle the message will show the picture of the vehicle instead of the gun

 

Download and installation

 

http://github.com/0verHeaT/kill_msg

 

 

Step by Step Guide (if you have already other mods)

 

(Has been removed! Please use my Github!)

 

Done.

Link to comment
Share on other sites

Description

 

Get all kill notification nicely displayed in the left upper corner. This will include the picture of the gun and the shot distance.

 

The format will look like that:

 

[killer] ['image'] [victim] ['distance in meters']

 

To see how it will look like in game:

f-msg542161580017a355.jpg

 

 

Download and installation

 

http://github.com/0verHeaT/kill_msg

Copy and replace the server_playerDied.sqf in 'day_server/compile'.

 

But if i have allready this 2 custom files, if i replase it some another mod stop work

Link to comment
Share on other sites

Works it all the Time? Mine doesnt work all the time only ~50% the time

 

EDIT: May take this note Kill Messages doesnt work all the Time, due to the Server sometimes doesnt get the PKILL

 

Thats right. Any kill message will only be displayed when the server gets the PKILL.

(e.g. the DZE_DeathMsgGlobal does also not work all the time..)

Link to comment
Share on other sites

Not too sure if this will work, but for more of a better feel (or server owners which run a less militarized server).

_pic = gettext(configFile >> 'cfgWeapons' >> (currentWeapon _killer) >> 'picture');
_kill_txt = _kill_txt + format ["%1 was killed with %3 from %4m",_victimName, _killerName, _pic, _distance];

customkillMessage = [_kill_txt];
publicVariable "customkillMessage";

Well... It might work.

Link to comment
Share on other sites

17:07:39 Error in expression <>%1 </t>",_killerName,_pic,_victimName,(ceil _distance)];
_kill_txt = _kill_txt >
17:07:39   Error position: <ceil _distance)];
_kill_txt = _kill_txt >
17:07:39   Error ceil: Type String, expected Number
17:07:39 File z\addons\dayz_server\compile\server_playerDied.sqf, line 40
Link to comment
Share on other sites

 

17:07:39 Error in expression <>%1 </t>",_killerName,_pic,_victimName,(ceil _distance)];
_kill_txt = _kill_txt >
17:07:39   Error position: <ceil _distance)];
_kill_txt = _kill_txt >
17:07:39   Error ceil: Type String, expected Number
17:07:39 File z\addons\dayz_server\compile\server_playerDied.sqf, line 40

 

 

Looks like your '_distance' is not correctly defined.

It has to be defined like that in order to work:

_distance = _victim getVariable["AttackedFromDistance", "nil"];
Link to comment
Share on other sites

I do have it defined. It's an awesome script, btw! My  server_playerDied.sqf is in the spoiler below...

 

private ["_characterID","_minutes","_newObject","_playerID","_infected","_victim","_victimName","_killer","_killerName","_weapon","_distance","_message","_loc_message","_key","_death_record","_pic","_kill_txt"];

//[unit, weapon, muzzle, mode, ammo, magazine, projectile]
_characterID = _this select 0;
_minutes = _this select 1;
_newObject = _this select 2;
_playerID = _this select 3;
_infected = _this select 4;
if (((count _this) >= 6) && {(typeName (_this select 5)) == "STRING"} && {(_this select 5) != ""}) then {
_victimName = _this select 5;
} else {
_victimName =  if (alive _newObject) then {name _newObject;} else {"";};
};
_victim = _newObject;
_newObject setVariable ["bodyName", _victimName, true];
 
_killer = _victim getVariable["AttackedBy", "nil"];
_killerName = _victim getVariable["AttackedByName", "nil"];
 
// when a zombie kills a player _killer, _killerName && _weapon will be "nil"
// we can use this to determine a zombie kill && send a customized message for that. right now no killmsg means it was a zombie.
if ((typeName _killer) != "STRING") then
{
_weapon = _victim getVariable["AttackedByWeapon", "nil"];
_distance = _victim getVariable["AttackedFromDistance", "nil"];<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Defined here,Overheat :)
 
if ((owner _victim) == (owner _killer)) then 
{
_message = format["%1 killed himself",_victimName];
_loc_message = format["PKILL: %1 killed himself", _victimName];
}
else
{
_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];
};
 
diag_log _loc_message;
 
_pic = gettext(configFile >> 'cfgWeapons' >> (currentWeapon _killer) >> 'picture');
_kill_txt = format ["<t align='left' size='0.9'>%1 </t>",_killerName,_pic,_victimName,(ceil _distance)];
_kill_txt = _kill_txt + format ["<img size='1.0' align='left' image='%2'/>",_killerName,_pic,_victimName,(ceil _distance)];
_kill_txt = _kill_txt + format ["<t align='left' size='0.9'> %3 </t>",_killerName,_pic,_victimName,(ceil _distance)];
_kill_txt = _kill_txt + format ["<t align='left' size='0.9'>[%4m]</t>",_killerName,_pic,_victimName,(ceil _distance)];
 
customkillMessage = [_kill_txt];
publicVariable "customkillMessage";
 
if(DZE_DeathMsgGlobal) then {
[nil, nil, rspawn, [_killer, _message], { (_this select 0) globalChat (_this select 1) }] call RE;
};
 
if(DZE_DeathMsgSide) then {
[nil, nil, rspawn, [_killer, _message], { (_this select 0) sideChat (_this select 1) }] call RE;
};
if(DZE_DeathMsgTitleText) then {
[nil,nil,"per",rTITLETEXT,_message,"PLAIN DOWN"] call RE;
};
 
// build array to store death messages to allow viewing at message board in trader citys.
_death_record = [
_victimName,
_killerName,
_weapon,
_distance,
ServerCurrentTime
];
PlayerDeaths set [count PlayerDeaths,_death_record];
 
// Cleanup
_victim setVariable["AttackedBy", "nil", true];
_victim setVariable["AttackedByName", "nil", true];
_victim setVariable["AttackedByWeapon", "nil", true];
_victim setVariable["AttackedFromDistance", "nil", true];
};
 
// Might not be the best way...
/*
if (isnil "dayz_disco") then {
dayz_disco = [];
};
*/
 
// dayz_disco = dayz_disco - [_playerID];
_newObject setVariable["processedDeath",diag_tickTime];
 
if (typeName _minutes == "STRING") then
{
_minutes = parseNumber _minutes;
};
 
diag_log ("PDEATH: Player Died " + _playerID);
 
if (_characterID != "0") then
{
_key = format["CHILD:202:%1:%2:%3:",_characterID,_minutes,_infected];
#ifdef DZE_SERVER_DEBUG_HIVE
diag_log ("HIVE: WRITE: "+ str(_key));
#endif
_key call server_hiveWrite;
}
else
{
deleteVehicle _newObject;
};
 

Link to comment
Share on other sites

It works, but your players WILL die and spawn right in front of the dead corpse.. WITH all gear. Trust.. Its not everyone or all the time.. but it will happen. I like the script. Hope there's a fix.

Works fine for me, thanks!

b_560_95_1.png

Link to comment
Share on other sites

ok, the fix is as follows

 

Change

_pic = gettext(configFile >> 'cfgWeapons' >> (currentWeapon _killer) >> 'picture');
_kill_txt = format ["<t align='left' size='0.9'>%1 </t>",_killerName,_pic,_victimName,(ceil _distance)];
_kill_txt = _kill_txt + format ["<img size='1.0' align='left' image='%2'/>",_killerName,_pic,_victimName,(ceil _distance)];
_kill_txt = _kill_txt + format ["<t align='left' size='0.9'> %3 </t>",_killerName,_pic,_victimName,(ceil _distance)];
_kill_txt = _kill_txt + format ["<t align='left' size='0.9'>[%4m]</t>",_killerName,_pic,_victimName,(ceil _distance)];

to

_pic = gettext(configFile >> 'cfgWeapons' >> (currentWeapon _killer) >> 'picture');
_kill_txt = format ["<t align='left' size='0.9'>%1 </t>",_killerName,_pic,_victimName,_distance];
_kill_txt = _kill_txt + format ["<img size='1.0' align='left' image='%2'/>",_killerName,_pic,_victimName,_distance];
_kill_txt = _kill_txt + format ["<t align='left' size='0.9'> %3 </t>",_killerName,_pic,_victimName,_distance];
_kill_txt = _kill_txt + format ["<t align='left' size='0.9'>[%4m]</t>",_killerName,_pic,_victimName,_distance];

Ceil is trying to round up a string _distance as it's not a number, so incorrect syntax, by removing ceil you remove the rounding up and you get no error

Link to comment
Share on other sites

It works, but your players WILL die and spawn right in front of the dead corpse.. WITH all gear. Trust.. Its not everyone or all the time.. but it will happen. I like the script. Hope there's a fix.

 

This issue occurs due to a syntax error in the  fnc_plyrHit.sqf. 

19:33:24 "PHIT: B 1-1-C:1 (XXX) REMOTE was hit by B 1-1-D:1 (XXX) REMOTE with DMR from 0m with 0.1625 dmg"
19:33:24 Error in expression <;

_weapon = weaponState _attacker;
if (_weapon select 0 == "Throw") then 
{
_we>
19:33:24   Error position: <_weapon select 0 == "Throw") then 
{
_we>
19:33:24   Error Nicht definierte Variable in Ausdruck: _weapon
19:33:24 File z\addons\dayz_server\compile\fnc_plyrHit.sqf, line 12 

 

As you can see the distance is here defined as a string due to this bug.

This will lead to the ceil error.

 

In my case i could fix this by replacing the current fnc_plyrHit.sqf with this:

private ["_victim", "_attacker","_weapon","_distance","_damage"];
_victim = _this select 0;
_attacker = _this select 1;
_damage = _this select 2;

if (!isPlayer _victim || !isPlayer _attacker) exitWith {};
if ((owner _victim) == (owner _attacker)) exitWith {
	_victim setVariable["AttackedBy", _victim, true];
};

_weapon = gettext (configFile >> 'cfgWeapons' >> (currentWeapon _attacker) >> 'displayName');

_vehicle = typeOf (vehicle _attacker); 
if ((getText (configFile >> "CfgVehicles" >> _vehicle >> "vehicleClass")) in ["CarW","Car","CarD","Armored","Ship","Support","Air","ArmouredW","ArmouredD","SupportWoodland_ACR"]) then {
	_weapon = getText (configFile >> "CfgVehicles" >> _vehicle >> "displayName");
};

_distance = _victim distance _attacker;

diag_log format["PLAYERHIT: %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", (name _attacker), true];
//_victim setVariable["AttackedByWeapon", (currentWeapon _attacker), true];
_victim setVariable["AttackedByWeapon", _weapon, true];
_victim setVariable["AttackedFromDistance", _distance, true]; 

 

 

Now you won't get any errors on the fnc_plyrHit.sqf and the ceil command works correctly now.

Link to comment
Share on other sites

Hey Dude, 

iam trying to get kill messages so many days.
No script works! We need one, cause we are a pve server....

So i think, something in my files are broken, can you check it or send me yours?
I thinks the basic files are damaged anywhere.....

 

anywhere more files to check?

 

Greeting, Sebi

 

fnc_plyrHit.txt

init.txt

server_playerDeaths.txt

server_playerDied.txt

Link to comment
Share on other sites

Hey Dude, 

iam trying to get kill messages so many days.

No script works! We need one, cause we are a pve server....

So i think, something in my files are broken, can you check it or send me yours?

I thinks the basic files are damaged anywhere.....

 

anywhere more files to check?

 

Greeting, Sebi

 

attachicon.giffnc_plyrHit.txt

attachicon.gifinit.txt

attachicon.gifserver_playerDeaths.txt

attachicon.gifserver_playerDied.txt

 

 

Can i ask why they are .txt and not .sqf?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×
×
  • Create New...