Home   Help Search Login Register  

Author Topic: Get unit who I been locked by IR ?!?  (Read 509 times)

0 Members and 1 Guest are viewing this topic.

illario

  • Guest
Get unit who I been locked by IR ?!?
« on: 07 Apr 2004, 06:56:45 »
Hello to everybody and thank's all for my last topic about "Get tank turret direction".It helped me much!

My new task is to get the unit(enemy tank, for example) who i been locked by IR(right mouse button) via the gunner optic on gunner station.
I need it to get the enemy unit (my target) position.

I would be pleasure of your answers!

sa8gecko

  • Guest
Re:Get unit who I been locked by IR ?!?
« Reply #1 on: 07 Apr 2004, 10:47:49 »
Unnamed's work was great, really.
As far as I know there is no way to know which unit has been
locked as a target. It would be great if it was.
Since as now you should be able to find target direction
(plus or minus deflection applied) this is fairly easy,even if not always
fruitful.
Check along the firing direction with a serie of nearestObject
commands, remember, if you are targeting air unit above all,
to use absolute sea level height. Space these checks about
15 meters from each other (even 70-80 if you are targeting
air units): if the target it's hidden among high trees, though,
this space between those checks should be reduced at least
to 5-6 meters.
Wanna know more ? Message me.

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re:Get unit who I been locked by IR ?!?
« Reply #2 on: 07 Apr 2004, 17:20:18 »
You can use the "incomingmissile" event handler.  Put this in your vehicle's inti field:

Code: [Select]
addEventHandler ["incomingmissile" ,{_this exec "findenemy.sqs"}]

then in "findenemy.sqs" your first few lines can be:

Code: [Select]
_myVehicle = _this select 0  ; you are the target unit
_nastyInComming = _this select 1  ; type of missile
_shooterWhoNowMustDie =  _this select 2  ; the bad guy shooter

This event handler only works for vehicles that can be "locked on" and only for shooters using "lock on" type weapons.

From this you can use reveal and or knowsabout to get the bad guy.  Event handlers are cool, I'm just strating to understand them, so I hope my syntax is correct.  Read the tutorial on them in the editors depot.

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re:Get unit who I been locked by IR ?!?
« Reply #3 on: 07 Apr 2004, 17:25:27 »
Oh, sorry, did not read carefully enough.  The event handler I put only works after they fire at you.   But maybe there is a "locked" event handler?  I do not know.  I do not know if there exists a complete list of all known eventhandlers, it would be nice.

Offline Wadmann

  • OFPEC Patron
  • ****
  • I'm the next evolutionary step after a llama!
Re:Get unit who I been locked by IR ?!?
« Reply #4 on: 08 Apr 2004, 21:49:01 »
Hello all!

       Everything that I know about event handlers was obtained right here at OFPEC. Check out this page and look for Igor Drukov's "Event Handlers" tutorial. Although some of you may know this already, I found it very informative.


                                                                             Wadmann
Check out my Camouflage Collection! New items added 31 July 2005.