Jump to content
Sign in to follow this  
giallustio

HandleDamage EH problem

Recommended Posts

Hey guys!

I'm trying to use the handledamage eh to catch the killer. The system works fine, but i got some problems with the grenade launcher. When a unit is killed by another one with a M203, the code returns that he kills himself...Here the code:

BTC_fnc_handledamage =
{
_player = _this select 0;
_enemy  = _this select 3;
_damage = _this select 2;
hint format ["%1 gets hurt by %2 (%3) with %4", _player,_enemy,_damage,_this select 4];
BTC_killer = objNull;
if (!BTC_need_revive && name _enemy != BTC_killer_name) then {BTC_killer_name = format ["killed by %1", name _enemy];if (name _enemy != name player) then {BTC_killer = _enemy;};};
if (BTC_need_revive) then {} else {_damage};
};

Share this post


Link to post
Share on other sites

Try to debug with sideChat or diag_log instead so that you can see if the event handler runs multiple times.

Are you using ACE or any other mods that might affect the behavior of explosives?

To catch a killer you might prefer to use the "KILLED" event handler.

Share this post


Link to post
Share on other sites

I can't use "killed" eh. I solved adding an alive check:

BTC_fnc_handledamage =
{
_player = _this select 0;
_enemy  = _this select 3;
_damage = _this select 2;
hint format ["%1 gets hurt by %2 (%3) with %4", _player,_enemy,_damage,_this select 4];
if (Alive _player) then 
       {
        BTC_killer = objNull;
if (!BTC_need_revive && name _enemy != BTC_killer_name) then {BTC_killer_name = format ["killed by %1", name _enemy];if (name _enemy != name player) then {BTC_killer = _enemy;};};
if (BTC_need_revive) then {} else {_damage};
       };
};

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  

×