Jump to content
Sign in to follow this  
raptor2x

Get the reason of the death of a player.

Recommended Posts

Hello,

I would like to know if there is a way to get the reason of the death of a player.

I mean to know if a player gets killed by a tank, an airplane, by a soldier or an other thing.

"If the player has been killed by a tank, then (do something here)".

"If the player has been killed by a soldier, then (do something here)".

I don't know if you understand me.

For example, with SAMP (a GTA San Andreas multiplayer mod), it works like that :

http://wiki.sa-mp.com/wiki/OnPlayerDeath

and the reasons :

http://wiki.sa-mp.com/wiki/Weapons

What about Arma 3 ?

Thanks.

Share this post


Link to post
Share on other sites

So far, A3 doesn't cover the reason of death. Look here: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Killed

Only 2 params. However, it's possible to make a workaround and, for instance, by the type of caliber projectile that hits the player, determine its possible source [Vehicle, armor, helicopter, etc.].

If killed by falling down, you can add an onEject or similar EH, or run a while { } do { } loop for a height check (this select 2 -> z axis), and then register a sudden change in velocity, if it equals 0 or something, get unit's health. Equals 0? He probably killed himself.

This is just some brainstorming.

Share this post


Link to post
Share on other sites

Thank you very much for your answer.

But maybe it is possible to know if a player is in a vehicle ?

Share this post


Link to post
Share on other sites
Thank you very much for your answer.

But maybe it is possible to know if a player is in a vehicle ?

if (player == vehicle player) then {
//do smth
};

Ofc, there are other ways. Search for them.

Share this post


Link to post
Share on other sites

using isKindOf command witk the cfgVehicles list and you can get loosely or very specifically what killed the unit together with a "killed" eventhandler;

note that this is not the cfgVehicles list for arma3, but will give you an idea what to search for when using subgroups, Landvehicle is car is hmwwtow, air is helicopter etc...

example:

this addEventHandler ["Killed", {
_killer = _this select 1;
_vehicle = vehicle _killer;
if (_vehicle isKindOf "Man") then {
	hint "its a man";
};
if (_vehicle isKindOf "Tank") then {
	hint "its a tank";
};
if (_vehicle isKindOf "Plane") then {
	hint "its a plane";
};
if (_vehicle isKindOf "Helicopter") then {
	hint "its a helicopter";
};
if (_Vehicle isKindOf "HMMWVTOW") then {
	hint "its a hmww with tow missiles";
};
}];

Share this post


Link to post
Share on other sites

Thank you very much, it works almost good.

_player = _this select 0;
_presumedKiller = effectiveCommander (_this select 1);
_killer = _player getVariable "FAR_killerPrimeSuspect";
_vehicle = vehicle _killer;
_presumedKillerVehicle = vehicle _presumedKiller;


if (_vehicle isKindOf "Man") then 
{
	_killer setVariable ["bmoney", (_killer getVariable ["bmoney",0]) + 500, true];	
};
if (_vehicle isKindOf "Tank") then 
{
    _killer setVariable ["bmoney", (_killer getVariable ["bmoney",0]) + 600, true];	
};
if (_vehicle isKindOf "Plane") then 
{
    _killer setVariable ["bmoney", (_killer getVariable ["bmoney",0]) + 1000, true];	
};
if (_vehicle isKindOf "Helicopter") then 
{
    _killer setVariable ["bmoney", (_killer getVariable ["bmoney",0]) + 800, true];	
};		



if (_presumedKillerVehicle isKindOf "Man") then 
{
	_presumedKiller setVariable ["bmoney", (_presumedKiller getVariable ["bmoney",0]) + 500, true];	
};
if (_presumedKillerVehicle isKindOf "Tank") then 
{
    _presumedKiller setVariable ["bmoney", (_presumedKiller getVariable ["bmoney",0]) + 600, true];	
};
if (_presumedKillerVehicle isKindOf "Plane") then 
{
    _presumedKiller setVariable ["bmoney", (_presumedKiller getVariable ["bmoney",0]) + 1000, true];	
};
if (_presumedKillerVehicle isKindOf "Helicopter") then 
{
    _presumedKiller setVariable ["bmoney", (_presumedKiller getVariable ["bmoney",0]) + 800, true];	
};		

Do you know the mod Wasteland ?

My script gives money in the bank account of the killer, depending of the way he did the kill.

_presumedKiller = When the killer directly kill the guy (for example a rocket launched to vehicle, and the vehicle exploded).

_killer = When the killer injured the guy and then the guy suicided.

_vehicle = Reason of death when it's the suicide.

_presumedKillerVehicle = Reason of death when it's a direct kill.

The fact is that the script almost works perfectly, the killer always win the correct amount, but when it's a suicide (when _killer is used), the killed guy win the amount too.

I don't know if you understand what i'm trying to explain cause english is not my native language.

A more simple way to explain the problem :

_presumedKiller = The killer win the money.

_killer = The killer win the money, but the killed guy also win the money.

Edited by Raptor2x

Share this post


Link to post
Share on other sites

From what I understand, you don't want the person to receive money if they kill themselves?

Just simply add this:

if (_vehicle == vehicle player) exitWith { // stuff };

Share this post


Link to post
Share on other sites

When you get killed on the wasteland mod, you are not directly dead but you are injured and somebody can revive you in a delay of 2 minutes.

If you died at the end of this delay, or if you press "suicide", you die and the guy who injured you gets the kill point, and with my system, gets money.

But the injured (and dead) guy doesn't have to get money, and this is the problem, cause with my system both gets money and I don't know why.

Thanks.

Share this post


Link to post
Share on other sites

must be related to the wasteland revive system, check in there to find what gives suicide and do your code around that.

best ask in wasteland thread.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×