Jump to content

Recommended Posts

What is the best way to create and eventhandler for currentThrowable items?

 

I want an event handler to track every time I throw a throwable, so when my player's inventory of "HandGrenade"or "SmokeShellGreen" is depleted I can refill it.

 

I have tried to use an "explosion" EH with the following but does not work as _throwableArray is an array of strings, and I can't figure out how to create an array of throwables on the player...Also I don't think this would work for a "SmokeShell"

_throwableArray = [];
{ if (_x == _throwable) then {_throwableArray pushBack _x} } forEach (magazines player);
{
	_x addEventHandler ["Explosion", {
		params ["_vehicle", "_damage"];
		if (damage _vehicle > 0.1) then {
			if !( _throwable in (magazines player) ) then {for "_i" from 1 to 3 do {player addItemToVest _throwable};};
		};
	}]; 
} forEach _throwableArray;

 

I have tried to use "AnimDone" EH, but could not even find the common animation for throwing...

 

player addEventHandler ["AnimDone", {
	params ["_unit", "_anim"];
	if (_anim == "AmovPercMrunSlowWpstDf_AmovPercMstpSrasWpstDnon_gthThrow") then {
		if !( _throwable in (magazines player) ) then {for "_i" from 1 to 3 do {player addItemToVest _throwable};};
	};
}];

 

Share this post


Link to post
Share on other sites
player addEventHandler ["Fired", { 
 params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; 
hint str _this;
}];
player addEventHandler ["Fired", { 
 if ((_this select 1) isEqualTo "Throw") then {hint "Fire in the Hole"};
}];

 

  • Like 1

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

×