Home   Help Search Login Register  

Author Topic: Check if a guy has been shot in torso?  (Read 1016 times)

0 Members and 1 Guest are viewing this topic.

Offline Wildebeest

  • Contributing Member
  • **
  • The time the wildebeest ruled the Earth.
Check if a guy has been shot in torso?
« on: 19 Nov 2008, 16:50:06 »
Hi!

I'm using the BAS addons and the black rebels from that pack. When you fire at them they scream, except when you hit them in the head. What I wanna do is to have an alarm go off if they scream, but no alarm if they don't scream.
It's pretty annoying playing in the night with NVG and supressed weapons and not alerting other enemies when the ones you kill in a clumsy fashion holler out.
What I've done so far is to put the following in every enemy's init field:

Code: [Select]
this addeventhandler ["hit","_this exec {fired\hit1.sqs}"]
And here is the script:

Code: [Select]
;Hit1.sqs

_unit = _this select 0

? not alive _unit : exit

~4

alert0 = true ; publicvariable "alert0"

exit

This works pretty well if you hit the guy in an arm or leg. He then screams and the alarm goes off after 4 seconds. But when you shoot him in the torso he first screams and then dies instantly, hence the script exits.

Is there a way to check whether someone gets hit in the torso or something?
Any ideas?

Cheers
Weeee...

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Check if a guy has been shot in torso?
« Reply #1 on: 19 Nov 2008, 17:08:52 »
Take a look at Igor Drukov's Event Handler tute, specifically the bit on 'damaged'.  :good:

Offline Wildebeest

  • Contributing Member
  • **
  • The time the wildebeest ruled the Earth.
Re: Check if a guy has been shot in torso?
« Reply #2 on: 23 Nov 2008, 11:15:36 »
Thanks! I tried "dammaged" instead of "hit" and made the script detect when an enemy got hit in the head, however I then found out that the enemies sometimes don't holler out when they get hit somewhere else. So I'm sticking with "hit" for now.

Cheers
Weeee...