Jump to content
Sign in to follow this  
azams

[ASK] addMPeventHandler hit doesnt work properly with grenade

Recommended Posts

Hi,

 

I am still making a TvT mission with money system.
The rules is got hit (anywhere) means killed, so I cant use killed on addMPeventhandler to trigger the script.
I am using "Hit" so if player got hit, I just put setDamage 1 on the victim.

Everything works properly with any gun but grenade.

 

anyone know how to make it work with grenade?

 

here is the init:

this addMPEventHandler ["mpHit", {hint format["%1 killed by %2", name (_this select 0), name (_this select 1)];_this select 0 setDamage 1;}];

Thank you. :)

Share this post


Link to post
Share on other sites

From BIKI page:

Is not always triggered when unit is killed by a hit. Most of the time only the Killed event handler is triggered when a unit dies from a hit. The hit EH will not necessarily fire if only minor damage occurred (e.g. firing a bullet at a tank), even though the damage increased. Can also trigger several times for an explosion (direct and indirect damage).

Share this post


Link to post
Share on other sites

From BIKI page:

Is not always triggered when unit is killed by a hit. Most of the time only the Killed event handler is triggered when a unit dies from a hit. The hit EH will not necessarily fire if only minor damage occurred (e.g. firing a bullet at a tank), even though the damage increased. Can also trigger several times for an explosion (direct and indirect damage).

Hi killzone_kid, thanks for the reply.

Yes I read that after I visit your blog to make the money system. Thats why I am asking the question here, maybe someone has any alternate solution for my problem. do you have any solution beside using addmphandler mphit?

Share this post


Link to post
Share on other sites
if (local this) then {
	0 = this addMPEventHandler ["MPHit", {
		if (hasInterface) then {
			params ["_unit", "_killer"];
			_unit setVariable ["_nameUnit", name _unit];
			_unit setVariable ["_nameKiller", name _killer];
		};
		if (isServer) then {
			_unit setDamage 1;
		};
	}];
	0 = this addMPEventHandler ["MPKilled", {
		if (hasInterface) then {
			params ["_unit", "_killer"];
			hint format [
				"%1 killed by %2", 
				_unit getVariable ["_nameUnit", name _unit],
				_unit getVariable ["_nameKiller", name _killer]
			];
		};
	}];
}; 

Dunno, maybe add MPKilled EH as well? Something like this ^^^^^^^^^

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  

×