How to realese message when agent/bot (ai) kill player?

hekut146

Well-Known Member
Hi, how i can get realese message when agent/bot (ai) kill player? I need and have killerMessage EH, but can i know who killer agent/bot (ai)? Maybe who have complite script?
 
Last edited:
I would load the files it tells you to replace (server_playerdied.sqf etc), AND the file of the same name that is on your server, and run the notepad++ COMPARE plugin so see exactly what changes are made. If the files are of different versions then you can just copy the relevent code from the new file, into your current file.
2016-02-22_13-02-24.png


To add plugins:
2016-02-22_13-03-12.png
 
then you better add in some diag_log debug lines to find out why not. When an AI kills a player, do these variables get set?
_killer = _victim getVariable["AttackedBy", "nil"];
_killerName = _victim getVariable["AttackedByName", "nil"];

The issue is probably in this code right here. If the _killer variable (retrieved above) is NOT a "string", then it assumes you killed yourself. But if the AI killed you and the _killer variable is !string then it wont be printed because it only prints for suicides.

Code:
if ((typeName _killer) != "STRING") then {
_weapon = _victim getVariable["AttackedByWeapon", "nil"];
_distance = _victim getVariable["AttackedFromDistance", "nil"];
_pic = _victim getVariable["AttackedByWeaponImg", "nil"];
if ((owner _victim) == (owner _killer)) then {
_loc_message = format["PLAYERSUICIDE: %1 killed himself", _victimName];
_message = format ["%1 killed himself",_victimName];
} else {
 
thx, i now try write to logs:
_victim
_killer
_killerName

when agent/bot (ai) (dzai bot) killing me:
22:07:50 "_victim"
22:07:50 B 1-1-D:1 (Hades) REMOTE (me)
22:07:50 "_killer"
22:07:50 "nil"
22:07:50 "_killerName"
22:07:50 "nil"

but i don't see suicide message too...
DZE_DeathMsgGlobal = true;
DZE_DeathMsgSide = true;
DZE_DeathMsgTitleText = true;
 
Last edited:
Okay, so you were running Epoch to begin with. So all that code was the same as what you had because Epoch includes the deathmessages.

there is this line in the code that says

// 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.

and thats why it checks if !=string. Apparently, AI are same as zombie since you are getting "nil" for AI kills.
I am sure I always got messages in the log when an AI killed me, distance, weapon etc.

Here is an idea. there is probably some variable added to DZAI when they are created, if not then add one in.
_unit setvariable("isAI",true,1);
Now when you get killed, you can just check if that variable was set on the killer then create the message.
I would work this out for you, but am at work.
 
But I still did not understand a single moment, I added all bots variable, but as it is to check if the role of the killer vystupayayu I even if I was killed by a bot
setVariable ["EtoBot",true,true];
but where i need get this var?
 
PVDZE_plr_Died = [dayz_characterID,0,_body,_playerID,_infected, dayz_playerName];
this array go to server_playerDied, no killer

i think i found problem (in fnc_plyrHit)...
if (!isPlayer _victim || !isPlayer _attacker) exitWith {}; //_attacker is AI and this if is true and script is terminate

not work...
 
Last edited:
but when i inject at client
player addMPEventHandler ["MPHit", {_this spawn fnc_plyrHit;}];
all work wtf?!
when added to init not work, olny inject, run execVM in sqf wait Alive and add EH
if (!isDedicated) then {
player addMPEventHandler ["MPHit", {_this spawn fnc_plyrHit;}];
};
when i try this all work but only 1 game loading (i added to publicEH)
 
Last edited:
70 % my mission in my addons, all work when i inject at client (infistar admin) this
Code:
player addMPEventHandler ["MPHit", {_this spawn fnc_plyrHit;}];
but if i try add this in init
Code:
if (!isDedicated) then {
    [] spawn {
        waitUntil {alive player};
        player addMPEventHandler ["MPHit", {_this spawn fnc_plyrHit;}];
        diag_log "addMPEventHandler MPHit activated";
    };
};
not work (work 30% works 3 times out of 10) but if i add in publicEH in 1 line
Code:
player addMPEventHandler ["MPHit", {_this spawn fnc_plyrHit;}];
work everytime (1 login)

p.s. sorry my bad english i try to transtalte literally from my language
 
i found fix: need add to player_spawn and init, now all works :)

now i try add [BOT] to name killer if bot kill player

i created [BOT] + name text if me killed bot :)

now try create message when i (player) kill bot/ai/agent/unit, but don't have ideas how release this...

created :)

now try to release + or - humaniti text to kill at plant down (cutText)

created for zombies/players/bots (dzai), don't know how for wai and dzms
 
Last edited:
Good. so you are making progress. I think DZMS uses DZAI.

You use a word "release". it is not translating correctly .
now try to release + or - humaniti text to kill at plant down (cutText)
I think you mean you want to "display" the change in humanity in a "plain down" cuttext.
So, you want to show to the player, how much the humanity has increased or deacreased?
 
yes, i now create this EH + cutText, now create for zombies/players/ai (dzai), in wai and dzms use not static variable humanity if you kill bandit humaniti + if kill hero humanity -, need found in where script adding humanity to send my EH

release = complite = create in this message #18
 
Last edited:
Back
Top