shark-attack 2 Posted May 28, 2007 hi ... how would i set an event handler to detect if a unit was shot in the back or body and call a script if this happens..? many than in advance Share this post Link to post Share on other sites
Junker 0 Posted May 28, 2007 use this Unit init: this addeventhandler ["HIT","shot.sqs"] <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit = _this select 0 _3rd = _this select 1 ? _3rd == "body" : hitformat ["Ouch i was shot in the %1",_3rd] untested but i think it will work Share this post Link to post Share on other sites
shark-attack 2 Posted May 28, 2007 thanx mate ... what i was wanting to do was if an engineer was shot in the back his mine what he carrys would explode... thanx again Share this post Link to post Share on other sites
Balschoiw 0 Posted May 28, 2007 I guess there is no specific hitzone "back" that you could read, but determination of the projectile direction and angle towards the body could do the trick. Detect the direction relative to the body´s direction and you know if he got hit in the back or not. Share this post Link to post Share on other sites
Junker 0 Posted May 28, 2007 well in that case use this  With the dammaged EH <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit = _this select 0 _3rd = _this select 1 _pos = getpos _unit ? _3rd == "body"  : _bomb = "Sh_125_HE" createVehicle _pos; Exit Exit Share this post Link to post Share on other sites
shark-attack 2 Posted May 28, 2007 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> UNITS INIT this addEventHandler ["dammaged", _this execVM "myScript.sqf"}] MY SCRIPT unit = _this select 0; _hitPart = _this select 1; _damm = _this select 2; ? (_hitPart == "body") Â : [] exec "blast.sqs"; exit simulates a body shot good enough for me ... thanx to LCD Â works a treat Share this post Link to post Share on other sites
Big Dawg KS 6 Posted May 28, 2007 thanx  mate ... what i was wanting to do was  if an engineer was shot in the back  his mine what he carrys would explode... thanx again That's extremely unrealistic. Such a mine would only detinate if it was run over by a tank. Share this post Link to post Share on other sites
shark-attack 2 Posted May 29, 2007 lol ... i agree ... Â but a nice touch ... Share this post Link to post Share on other sites
Taurus 20 Posted May 29, 2007 lol ... i agree ... but a nice touch ... or "meh, its a game!" Share this post Link to post Share on other sites