Home   Help Search Login Register  

Author Topic: search and rescue script  (Read 1951 times)

0 Members and 1 Guest are viewing this topic.

pangzi

  • Guest
search and rescue script
« on: 04 Dec 2002, 21:22:16 »
This displays the direction the player has to go to find a certain unit. For example it can be used for searching for a crashed pilot on enemy territory, or for a nuke.
It returns the "relative angle" either in degree or N,W,S,E.
Can easily be used for other tasks concerning relative angles.
feel free to do so.

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:search and rescue script
« Reply #1 on: 05 Dec 2002, 02:16:23 »
Dontcha just love math. I sure don't. :P

You figured out how to get the direction from one unit to another unit a different way than I did.

Code: [Select]
; ##the object ebing tracked
_trackee = w6

; ##the object tracking the object being tracked
_tracker = leader gw1

#start
_tracker = leader gw1

; ##the compass heading from the tracker to the trackee is calculated here

_dir = getdir (vehicle _tracker)
_degree = ((getpos _trackee select 0) - (getpos _tracker select 0)) atan2 ((getpos _trackee select 1) - (getpos _tracker select 1))

; ## "_degree" is the compass heading the tracker needs to point to face the trackee
?_degree < 0:_degree = _degree + 360
« Last Edit: 05 Dec 2002, 02:21:11 by toadlife »
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

pangzi

  • Guest
Re:search and rescue script
« Reply #2 on: 11 Dec 2002, 19:04:51 »
guess i got carried away a little  ;D ;D  
like your tutorial :thumbsup:  
 

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:search and rescue script
« Reply #3 on: 11 Dec 2002, 20:46:05 »
Quote
like your tutorial

The trig one? your welcomed to add to that one if you can. It's very incomplete.
« Last Edit: 11 Dec 2002, 20:49:23 by toadlife »
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.