Jump to content
Sign in to follow this  

Recommended Posts

Is there any way to return what part of the body of a unit or vehicle is hit? I know you can set where the damage is registered on the unit or vehicle, but is there any way to get the damage done to that area?

For instance, let's say I wanted to create a zombie mission. I want to disable the unit from taking damage (unit allowDamage false) until the unit is shot in the head. How can I find out if the unit is shot in the head?

Share this post


Link to post
Share on other sites

You'd have to add an Eventhandler for HandleDamage

Now when that fires, you'll get several being fired. One of them, I believe the first is for the head.

Just do some searching. You'll find several posts on how to use the event handlers, and handledamage in particular.

Share this post


Link to post
Share on other sites

Simple script for almost headshot-only damage (hope it works) :)

Init box:

this addEventHandler ["HandleDamage",{_this exec "headshot.sqs"}]

headshot.sqs

_unit=_this select 0
_bodypart=_this select 1
_damage=_this select 2

?_bodypart=="head_hit" and _damage>=2:_unit setDamage damage _unit+_damage

exit

The downside of it being simple is that it probably will let through damage caused by powerful weapons (.50 cal, Vintorez) to other areas of the body, which cause the head to take lots of damage.

See my body armor script for a more elaborate solution to single out the body part that was hit.

Share this post


Link to post
Share on other sites

The problem I am having is that for some reason the body part is not being returned. I get the unit who took the damage, the unit who damaged him, the type of ammo that was used and the amount of damage sustained. However, the second parameter should say the body part but all I get returned, regardless of where I shoot the guy is "".

Why is the body part not being returned for me?

Share this post


Link to post
Share on other sites

it's because it sends several every time a unit gets hit. if your doing a hint, you may only see the last time it was fired. try sidechat.. you'll see all of them.

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  

×