OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Resources Beta Testing & Submission => Topic started by: pangzi on 04 Dec 2002, 21:22:16

Title: search and rescue script
Post by: pangzi 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.
Title: Re:search and rescue script
Post by: toadlife 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
Title: Re:search and rescue script
Post by: pangzi on 11 Dec 2002, 19:04:51
guess i got carried away a little  ;D ;D  
like your tutorial :thumbsup:  
 
Title: Re:search and rescue script
Post by: toadlife 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.