Jump to content
Sign in to follow this  
shark-attack

shot in the back

Recommended Posts

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

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

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

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

well in that case use this  smile_o.gif

With the dammaged EH wink_o.gif

<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

<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
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
lol ... i agree ... but a nice touch ...

or

"meh, its a game!"

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  

×