Update new death messages

This commit is contained in:
ebaydayz
2016-09-27 15:08:30 -04:00
parent 58e90da07d
commit 9b13bd0e5e
7 changed files with 115 additions and 66 deletions

View File

@@ -98,7 +98,7 @@
[FIXED] User input is disabled and then gear dialog is closed during safe lock/unlock/pack to block various duping methods. #1341 @RimBlock @ebaydayz
[FIXED] Duplicate objectUIDs occasionally causing vehicles to swap classes or be deleted across restarts @ebaydayz @icomrade #1504
[FIXED] DZE_BuildingLimit now counts buildables only instead of all object types. Thanks jOoPs @ebaydayz
[FIXED] Reworked death messages. Fixed messages not always showing, undefined errors and wrong distance bug. Added bled out, killed by zombie, etc. MPHit event handler (fnc_plyrHit) is no longer needed. @ebaydayz
[FIXED] Rewrote death messages to a PVEH instead of the unreliable MPHit. Added localization, more causes of death and optional dynamicText killfeed. @ebaydayz
[FIXED] Player no longer hears radiation sound when changing clothes. @ebaydayz
[FIXED] Ponds and lakes are now detected correctly in player_goFishing. #1678 @ebaydayz
[FIXED] Players are now ejected and killed when their vehicle is destroyed (Fix applies to all types of vehicles). @icomrade

View File

@@ -1,4 +1,4 @@
private ["_pos","_display","_body","_playerID","_array","_source","_method","_isBandit","_punishment","_humanityHit","_myKills","_humanity","_kills","_killsV","_myGroup","_model"];
private ["_pos","_display","_body","_playerID","_array","_source","_method","_isBandit","_punishment","_humanityHit","_myKills","_humanity","_kills","_killsV","_myGroup","_model","_infected","_distance","_sourceVehicle","_sourceWeapon","_sourceName"];
disableSerialization;
if (deathHandled) exitWith {};
deathHandled = true;
@@ -28,29 +28,28 @@ if (dayz_onBack != "") then {
*/
};
_infected = if (r_player_infected && DZE_PlayerZed) then {1} else {0};
_killerMethod = "unknown";
_killerName = "unknown";
_killerWeapon = "unknown weapon";
_killerDist = 0;
_method = "unknown";
_sourceName = "unknown";
_sourceWeapon = "";
_distance = 0;
if (count _this > 0) then {
_killerObj = _this select 0;
_killerMethod = _this select 1;
if (typeName _killerMethod == "OBJECT") exitWith {_killerMethod = "Respawned"};
_source = _this select 0;
_method = _this select 1;
if (!isNull _killerObj) then {
if (!isNull _body) then {_killerDist = _body distance _killerObj;};
_killerVehicle = vehicle _killerObj;
_killerWeapon = if (_killerVehicle != _killerObj) then {typeOf _killerVehicle} else {currentWeapon _killerObj};
if (alive _killerObj) then {
_killerName = if (isPlayer _killerObj) then {name _killerObj} else {localize "STR_EPOCH_AI"};
if (!isNull _source) then {
if (!isNull _body) then {_distance = round (_body distance _source);};
_sourceVehicle = vehicle _source;
_sourceWeapon = if (_sourceVehicle != _source) then {typeOf _sourceVehicle} else {currentWeapon _source};
if (_sourceWeapon == "Throw") then {_sourceWeapon = (weaponState _source) select 3;};
if (alive _source) then {
_sourceName = if (isPlayer _source) then {name _source} else {localize "STR_EPOCH_AI"};
};
};
if (count _this > 2) then {_killerMethod = "zombie";};
};
//Send Death Notice
diag_log format["Debug death message vars: CharacterID:%1 BodyObject:%3 UID:%4 PlayerName:%5 Infected:%6 KillerName:%7 KillerWeapon:%8 KillerDistance:%9 KillerMethod:%10",dayz_characterID,0,_body,_playerID,_bodyName,_infected,_killerName,_killerWeapon,_killerDist,_killerMethod];
PVDZ_plr_Death = [dayz_characterID,0,_body,_playerID,toArray _bodyName,_infected,toArray _killerName,toArray _killerWeapon,_killerDist,toArray _killerMethod]; //Send name as array to avoid publicVariable value restrictions
diag_log format["Player_Death: Body:%1 BodyName:%2 Infected:%3 SourceName:%4 SourceWeapon:%5 Distance:%6 Method:%7",_body,_bodyName,_infected,_sourceName,_sourceWeapon,_distance,_method];
PVDZ_plr_Death = [dayz_characterID,0,_body,_playerID,toArray _bodyName,_infected,toArray _sourceName,toArray _sourceWeapon,_distance,toArray _method]; //Send name as array to avoid publicVariable value restrictions
publicVariableServer "PVDZ_plr_Death";
_id = [player,20,true,getPosATL player] call player_alertZombies;

View File

@@ -577,6 +577,42 @@ if (!isDedicated) then {
_message call _displayText;
};
dayz_killFeed = {
private ["_distance","_icon","_message","_playerName","_sourceName"];
_playerName = _this select 1;
_sourceName = _this select 2;
_distance = _this select 4;
_icon = _this select 5;
if (_icon == "") exitWith {};
if (diag_ticktime - death_1_time < 10) then {
if (time - death_2_time < 10) then {
if (time - death_3_time < 10) then {
death_4 = death_3;
death_4_time = death_3_time;
} else {
death_4 = "";
};
death_3 = death_2;
death_3_time = death_2_time;
} else {
death_3 = "";
death_4 = "";
};
death_2 = death_1;
death_2_time = death_1_time;
} else {
death_2 = "";
death_3 = "";
death_4 = "";
};
death_1 = format["<t size='0.5'>%1</t><img image='%2'/><t size='0.5'> %3 (%4m)</t>",_sourceName,_icon,_playerName,_distance];;
death_1_time = diag_ticktime;
_message = format ["%1<br />%2<br />%3<br />%4",death_1,death_2,death_3,death_4];
[_message,safeZoneX,safeZoneY,10,0,0,8000] call BIS_fnc_dynamicText;
};
dayz_originalPlayer = player;
// database trader menu

View File

@@ -324,16 +324,35 @@ if (!isDedicated) then {
// EPOCH ADDITION
"PVDZE_deathMessage" addPublicVariableEventHandler {
// do not allow PVDZE_deathMessage in publicvariable.txt, it is only sent from the server machine
private "_weapon";
_message = _this select 1;
_message = switch (_message select 0) do {
case "died": {format [localize "str_player_death_died",_message select 1,localize format["str_death_%1",_message select 2]]};
case "killed": {
_weapon = _message select 3;
switch true do {
case (isClass (configFile >> "CfgWeapons" >> _weapon)): {
_message set [3, getText (configFile >> "CfgWeapons" >> _weapon >> "displayName")];
_message set [5, getText (configFile >> "CfgWeapons" >> _weapon >> "picture")];
};
case (isClass (configFile >> "CfgVehicles" >> _weapon)): {
_message set [3, getText (configFile >> "CfgVehicles" >> _weapon >> "displayName")];
_message set [5, getText (configFile >> "CfgVehicles" >> _weapon >> "picture")];
};
default {_message set [5,""]};
};
if (DZE_DeathMsgDynamicText) then {_message call dayz_killFeed};
format [localize "str_player_death_killed",_message select 1,_message select 2,_message select 3,_message select 4]
};
case "suicide": {format [localize "str_player_death_suicide",_message select 1]};
};
switch (toLower DZE_DeathMsgChat) do {
// Use FunctionsManager logic unit (BIS_functions_mainscope) to send chat messages so no side or quotation marks are shown
case "global": {BIS_functions_mainscope globalChat _message;};
case "side": {BIS_functions_mainscope sideChat _message;};
case "global": {objNull globalChat _message;};
case "side": {objNull sideChat _message;};
case "system": {systemChat _message;};
};
if (DZE_DeathMsgCutText) then {_message call dayz_rollingMessages;};
if (DZE_DeathMsgDynamicText) then {/* add later */};
diag_log format["DeathMessage: %1",_message];
};
// flies and swarm sound sync

View File

@@ -22,6 +22,15 @@ Message_3 = "";
Message_1_time = 0;
Message_2_time = 0;
Message_3_time = 0;
//Kill Feed
death_1 = "";
death_2 = "";
death_3 = "";
death_4 = "";
death_1_time = 0;
death_2_time = 0;
death_3_time = 0;
death_4_time = 0;
//OpenTarget timer
OpenTarget_Time = 0;

View File

@@ -13800,48 +13800,26 @@
<English>radiation</English>
<German>Strahlung</German>
<Russian>излучение</Russian>
<Spanish>radiación</Spanish>
<Czech>záření</Czech>
</Key>
<Key ID="str_death_crushed">
<English>being crushed</English>
<German>zerquetscht</German>
<Russian>раздавлен</Russian>
<Spanish>ser aplastado</Spanish>
<French>être écrasé</French>
<Czech>rozdrcení</Czech>
</Key>
<Key ID="str_player_death_zombie">
<English>%1 was killed by a zombie</English>
<German>%1 wurde von einem Zombie getötet.</German>
<Russian>%1 был убит зомби</Russian>
<Spanish>%1 murió a manos de un zombi</Spanish>
<French>%1 a été tué par un zombie</French>
<Czech>%1 byl zabit zombie</Czech>
</Key>
<Key ID="str_player_death_suicide">
<English>%1 committed suicide</English>
<German>%1 Selbstmord</German>
<Russian>%1 покончил с собой</Russian>
<Spanish>%1 se suicidó</Spanish>
<French>%1 suicidé</French>
<Czech>%1 spáchal sebevraždu</Czech>
</Key>
<Key ID="str_player_death_message">
<Key ID="str_player_death_died">
<English>%1 died from %2</English>
<German>%1 starb durch %2</German>
<Russian>%1 умер от %2</Russian>
<Spanish>%1 murió de %2</Spanish>
<French>%1 %2 de mort</French>
<Czech>%1 zemřelo %2</Czech>
</Key>
<Key ID="str_player_death_killed">
<English>%1 was killed by %2 with a %3 from %4m</English>
<German>%1 wurde von %2 mit einer %3 von %4m getötet</German>
<Russian>%1 был убит игроком %2 с %3 с расстояния %4м</Russian>
<Spanish>%1 murió a manos de %2 con un %3 de %4m</Spanish>
<French>%1 a été tué par %2 avec un %3 de %4m</French>
<Czech>%1 byl zabit %2 na %3 z %4m</Czech>
</Key>
<Key ID="STR_PITCH_DESERT_TENT">
<English>Pitch Desert Dome Tent</English>

View File

@@ -1,6 +1,6 @@
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
private ["_characterID","_minutes","_newObject","_playerID","_key","_pos","_infected","_killerName","_killerWeapon","_distance","_message","_killerMethod"];
private ["_characterID","_minutes","_newObject","_playerID","_key","_pos","_infected","_sourceName","_sourceWeapon","_distance","_message","_method"];
//[unit, weapon, muzzle, mode, ammo, magazine, projectile]
_characterID = _this select 0;
@@ -9,10 +9,10 @@ _newObject = _this select 2;
_playerID = _this select 3;
_playerName = toString (_this select 4); //Sent as array to avoid publicVariable value restrictions
_infected = _this select 5;
_killerName = toString (_this select 6);
_killerWeapon = toString (_this select 7);
_sourceName = toString (_this select 6);
_sourceWeapon = toString (_this select 7);
_distance = _this select 8;
_killerMethod = toString (_this select 9);
_method = toString (_this select 9);
//Mark player as dead so we bypass the ghost system
dayz_died set [count dayz_died, _playerID];
@@ -43,30 +43,38 @@ diag_log format ["Player UID#%3 CID#%4 %1 as %5 died at %2",
// EPOCH DEATH MESSAGES
if (_killerWeapon == "Throw") then {_killerWeapon = "Grenade";};
if (_killerMethod in ["starve","dehyd","sick","bled","crushed","rad","zombie"]) then {
if (_killerMethod == "zombie") then {
_message = format[localize "str_player_death_zombie",_playerName];
if (_method in ["explosion","melee","runover","shot","shothead","shotheavy"]) then {
if (_sourceName == _playerName) then {
_message = ["suicide",_playerName];
} else {
_methodStr = localize format["str_death_%1",_killerMethod];
_message = format[localize "str_player_death_message",_playerName,_methodStr];
if (_sourceWeapon == "") then {_sourceWeapon = "unknown weapon";};
_message = ["killed",_playerName,_sourceName,_sourceWeapon,_distance];
// Store death messages to allow viewing at message board in trader citys.
PlayerDeaths set [count PlayerDeaths,[_playerName,_sourceName,_sourceWeapon,_distance,ServerCurrentTime]];
};
} else {
if (_killerName == _playerName) then {
_message = format[localize "str_player_death_suicide",_playerName];
} else {
_message = format[localize "str_player_death_killed",_playerName,_killerName,_killerWeapon,_distance];
};
// No source name, distance or weapon needed: "%1 died from %2" str_death_%1 (see stringtable)
// Possible methods: ["bled","combatlog","crushed","dehyd","eject","fall","starve","sick","rad","unknown","zombie"]
_message = ["died",_playerName,_method];
};
if ((_killerWeapon != "unknown weapon") or {_killerMethod != "unknown"} or {_killerName != "unknown"}) then {
diag_log _message;
if (_playerName != "unknown" or _sourceName != "unknown") then {
if (toLower DZE_DeathMsgChat != "none" or DZE_DeathMsgCutText or DZE_DeathMsgDynamicText) then {
PVDZE_deathMessage = _message;
publicVariable "PVDZE_deathMessage";
//Don't use regular PV here since JIP clients don't need it
{
if (isPlayer _x) then {
owner _x publicVariableClient "PVDZE_deathMessage";
};
} count playableUnits;
};
// Store death messages to allow viewing at message board in trader citys.
PlayerDeaths set [count PlayerDeaths,[_playerName,_killerName,_killerWeapon,_distance,ServerCurrentTime]];
_message = switch (_message select 0) do {
case "died": {format [localize "str_player_death_died", _message select 1, localize format["str_death_%1",_message select 2]]};
case "killed": {format [localize "str_player_death_killed", _message select 1, _message select 2, _message select 3, _message select 4]};
case "suicide": {format [localize "str_player_death_suicide", _message select 1]};
};
diag_log format["DeathMessage: %1",_message];
};