Jump to content
  • 0

Request - Detailed kill messages for Overwatch


DangerRuss

Question

Im probably gonna hit a dead end here but Im really not sure where else to ask. It seems a lot of the opendayz.net community has come over to here....  Anyways, I know on epoch you can set the kill messages to true in the init, however, in vanilla dayz/overwatch and some other mods you need a custom server_playerdied.sqf.

I used to use this one

#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"

private["_characterID","_minutes","_newObject","_playerID","_key","_playerName","_playerID","_myGroup","_group","_victim", "_killer", "_weapon", "_message",                          "_distance","_loc_message","_victimName","_killerName","_killerPlayerID"];
//[unit, weapon, muzzle, mode, ammo, magazine, projectile]
_characterID = 	_this select 0;
_minutes =		_this select 1;
_newObject = 	_this select 2;
_playerID = 	_this select 3;
_playerName = 	name _newObject;

_victim removeAllEventHandlers "MPHit";

_victim = _this select 2;
_victimName = _playerName;

_killer = _victim getVariable["AttackedBy", "nil"];
_killerName = _victim getVariable["AttackedByName", "nil"];

// when a zombie kills a player _killer, _killerName and _weapon will be "nil"
// we can use this to determine a zombie kill and send a customized message for that. right now no killmsg means it was a zombie.
if (_killerName != "nil") then
{
	_weapon = _victim getVariable["AttackedByWeapon", "nil"];
	_distance = _victim getVariable["AttackedFromDistance", "nil"];

	if (_victimName == _killerName) then 
	{
	 	_message = format["%1 killed himself",_victimName];
	 	_loc_message = format["PKILL: %1 killed himself", _victimName];
	}
	else 
	{
		_killerPlayerID = getPlayerUID _killer;
	 	_message = format["%1 was killed by %2 with weapon %3 from %4m",_victimName, _killerName, _weapon, _distance];
	 	_loc_message = format["PKILL: %1 (%5) was killed by %2 (%6) with weapon %3 from %4m", _victimName, _killerName, _weapon, _distance, _playerID,         _killerPlayerID];
	};

	diag_log _loc_message;
	[nil, nil, rspawn, [_killer, _message], { (_this select 0) globalChat (_this select 1) }] call RE;

	// Cleanup
	_victim setVariable["AttackedBy", "nil", true];
	_victim setVariable["AttackedByName", "nil", true];
	_victim setVariable["AttackedByWeapon", "nil", true];
	_victim setVariable["AttackedFromDistance", "nil", true];
};

//dayz_disco = dayz_disco - [_playerID];
_newObject setVariable["processedDeath",time];
_newObject setVariable ["bodyName", _playerName, true];

/*
diag_log ("DW_DEBUG: (isnil _characterID): " + str(isnil "_characterID"));
if (isnil "_characterID") then {
diag_log ("DW_DEBUG: _newObject: " + str(_newObject));	
	};
*/

if (typeName _minutes == "STRING") then 
{
	_minutes = parseNumber _minutes;
};

if (_characterID != "0") then 
{
	_key = format["CHILD:202:%1:%2:",_characterID,_minutes];
	//diag_log ("HIVE: WRITE: "+ str(_key));
	_key call server_hiveWrite;
} 
else 
{
	deleteVehicle _newObject;
};

#ifdef PLAYER_DEBUG
format ["Player UID#%3 CID#%4 %1 as %5 died at %2", 
	_newObject call fa_plr2str, (getPosATL _newObject) call fa_coor2str,
	getPlayerUID _newObject,_characterID,
	typeOf _newObject
];
#endif

/*
_eh = [_newObject] spawn {
	_body = _this select 0;
	_method = _body getVariable["deathType","unknown"];
	_name = _body getVariable["bodyName","unknown"];
	waitUntil{!isPlayer _body;sleep 1};
	_body setVariable["deathType",_method,true];
	_body setVariable["bodyName",_name,true];
	diag_log ("PDEATH: Player Left Body " + _name);
};
*/
//dead_bodyCleanup set [count dead_bodyCleanup,_newObject];

sleep 600;
deleteVehicle _newObject;

Which used to work, but would often cause people to spawn at their bodies fully geared.  EIther way, this script no longer works after the steam update. If someone could maybe tweak this for me somehow, I would probably love you forever. Thanks for any help.

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

dunno about the global chat, try this is there as well and see if it works at all...

 

    [nil,nil,"per",rTITLETEXT,_message,"PLAIN DOWN"] call RE;

 

diag_log _loc_message;
	[nil, nil, rspawn, [_killer, _message], { (_this select 0) globalChat (_this select 1) }] call RE;

completely replacing the bottom half of this with yours?

Link to comment
Share on other sites

  • 0

Just put it under your global chat call and see if that section is working at all...

Im afraid I dont completely understand until I See it...

would this be correct? Im sorry I dont have a test server and fucking up my server means pissing off a lot of players. So if Im gonna test something, I at least want to write it correctly haha.

diag_log _loc_message;
    [nil, nil, rspawn, [_killer, _message], { (_this select 0) globalChat (_this select 1) }] call RE;

    [nil,nil,"per",rTITLETEXT,_message,"PLAIN DOWN"] call RE;
Link to comment
Share on other sites

  • 0

yup. that one i gave you should put it across the screen for all players.

my other problem with that particular script, was people not actually dying from time to time. They would respawn at their body fully geared. Just for an example, here is my default overwatch server_playerdied.sqf

#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"

private ["_characterID","_minutes","_newObject","_playerID","_key"];
//[unit, weapon, muzzle, mode, ammo, magazine, projectile]

_characterID = 	_this select 0;
_minutes =	_this select 1;
_newObject = 	_this select 2;
_playerID = 	_this select 3;
_playerName = 	name _newObject;

_newObject setVariable["processedDeath",diag_tickTime];
_newObject setVariable ["bodyName", _playerName, true];

if (typeName _minutes == "STRING") then 
{
	_minutes = parseNumber _minutes;
};

if (_characterID != "0") then 
{
	_key = format["CHILD:202:%1:%2:",_characterID,_minutes];
	//diag_log ("HIVE: WRITE: "+ str(_key));
	_key call server_hiveWrite;
} 
else 
{
	deleteVehicle _newObject;
};

#ifdef PLAYER_DEBUG
format ["Player UID#%3 CID#%4 %1 as %5 died at %2", 
	_newObject call fa_plr2str, (getPosATL _newObject) call fa_coor2str,
	getPlayerUID _newObject,_characterID,
	typeOf _newObject
];
#endif

//dead_bodyCleanup set [count dead_bodyCleanup,_newObject];
Link to comment
Share on other sites

  • 0

I've seen that bug in a few mods, no clue how to fix it, i think i heard one time that it was an issue where you die but it doesnt mark your database that that player instance is dead, so when they relog they log in on their body with their old gear. It also seemed to happen if you log to lobby and back too fast. (part of the reason i think Epoch has a countdown after death).

Link to comment
Share on other sites

  • 0

bump , my original at the very top works but I receive this RPT error.

18:22:39 WARNING: Function 'name' - C. Blackburn  is dead
 18:22:39 Error in expression <ect 3;
 _playerName =     name _newObject;

 _victim removeAllEventHandlers "MPHit";
 >
 18:22:39   Error position: <_victim removeAllEventHandlers "MPHit";
 >
 18:22:39   Error Undefined variable in expression: _victim
 18:22:39 File z\addons\dayz_server\compile\server_playerDied.sqf, line 11
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Discord

×
×
  • Create New...