Search the Community
Showing results for tags 'throwables'.
Found 2 results
-
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};}; }; }];
-
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};}; }; }];