Home   Help Search Login Register  

Author Topic: Detect if somebody is the target of a handgrenade?  (Read 539 times)

0 Members and 1 Guest are viewing this topic.

Offline Fire-Fox

  • Members
  • *
  • Violence is just a friend walking on the right way
Detect if somebody is the target of a handgrenade?
« on: 03 Sep 2003, 00:35:56 »
Hi! :)

I've been fiddling around with setting up something like this but stopped it when I didn't get a successful result. But seeing the BAS MH-60 leading SAMs launched at it somewhere else immediately got me some new motivation to try it once again because the chopper has to detect if a SAM is launched at it.
Does anyone know "from the hip" how to set up somin' like this?

Thx for answers! :)

Rubble_Maker

  • Guest
Re:Detect if somebody is the target of a handgrenade?
« Reply #1 on: 03 Sep 2003, 10:58:03 »
This is a funny idea, and I implemented it in the mission "The Prey" (should still be available in the mission depot). It doesn't work as you expect though; detecting SAMs and other missiles works using the "incomingMissile" eventhandler. This eventhandler can only detect guided weapons, i.e. weapons that can lock a target. The handgrenade is unguided though. I solved this problem with a small scripted loop that uses the "nearestObject" command to find if there is a handgrenade nearby the soldier.

Offline Fire-Fox

  • Members
  • *
  • Violence is just a friend walking on the right way
Re:Detect if somebody is the target of a handgrenade?
« Reply #2 on: 04 Sep 2003, 01:04:33 »
This is a funny idea, and I implemented it in the mission "The Prey" (should still be available in the mission depot). It doesn't work as you expect though; detecting SAMs and other missiles works using the "incomingMissile" eventhandler. This eventhandler can only detect guided weapons, i.e. weapons that can lock a target. The handgrenade is unguided though. I solved this problem with a small scripted loop that uses the "nearestObject" command to find if there is a handgrenade nearby the soldier.

Hehe, I had thought about that one too, but: My idea was about INCOMING grenades only, excluding OUTGOING grenades (e.g. thrown by team members). The nearestObject command would detect outgoing ones, too, I'm afraid...  :-\
But thx for answer, I think I should use this one until some OFPEC guru- mastermind shows up here and brings us the heaven-sent answer ;)

Offline MI_Fred

  • Members
  • *
  • AA
    • OFP Team Finlanders
Re:Detect if somebody is the target of a handgrenade?
« Reply #3 on: 04 Sep 2003, 02:08:01 »
 ::)

After you've detected an incoming grenade, it's distance can go only one way right? right. So check the distance at point A, then after a very brief delay check it again at point B, and if distance at point A is greater than at point B, it's incoming, not outgoing. This has to be done right at the brink of nearestObjects radius, 50m, so any 'nades lobbed at very close distance might not return the correct result ('nade being lobbed over the player, or would you even start shouting when someone lobs a 'nade at 10m at you... I know I'd just run towards the tosser  ;D).
« Last Edit: 04 Sep 2003, 02:11:42 by MI_Fred »
There's gooks over there, there's mines over there, and watch out those goddamn monkeys talk, I'll bite ya.

Offline Fire-Fox

  • Members
  • *
  • Violence is just a friend walking on the right way
Re:Detect if somebody is the target of a handgrenade?
« Reply #4 on: 05 Sep 2003, 01:21:54 »
::)

After you've detected an incoming grenade, it's distance can go only one way right? right. So check the distance at point A, then after a very brief delay check it again at point B, and if distance at point A is greater than at point B, it's incoming, not outgoing. This has to be done right at the brink of nearestObjects radius, 50m, so any 'nades lobbed at very close distance might not return the correct result ('nade being lobbed over the player, or would you even start shouting when someone lobs a 'nade at 10m at you... I know I'd just run towards the tosser  ;D).

Didn't take too much of your mastermind to solve this, did it?  :-\
(to express my "goddam, am I stoopid!" thought ;))

Thank you all! :)