Jump to content
Sign in to follow this  
wiggum2

Check for distance between flying plane and marker

Recommended Posts

Hi !

I try to do a HALO script and i need to check for the distance between the flying plane and a marker.

((_plane distance getmarkerpos _dropPos) < 150)

But this does not work, with vehicles and helicopters it works but the the condition never returns true with a plane although the plane is close enough.

I know that getMarkerPos always returns 0 for z but is this really the problem ?

Is there any other way to check for distance between a flying plane and a marker ?

Thanks !

Share this post


Link to post
Share on other sites

1. use -showScriptErrors

2. try:

_markerPos3d = (getmarkerpos _dropPos) set [2, 0];

((_plane distance markerPos3d) < 150)

Share this post


Link to post
Share on other sites

distance reads direct line from position to position, if a plane is 150 up there is a big chance of the check never activates since plane needs to be in perfect position above marker to be within. Just a little too the left or right or up and it never activates, try exstending range and check again.

No need to add in z value in getMArkerPos.

object distance markerPosition works just fine, at least in A2 CO 1.59 no betas.

Share this post


Link to post
Share on other sites

There is a function to query the distance in 2D to avoid the height problem. I don't recall the syntax now but I will add the codeline to this post later today.

EDIT

_mydistance = [x1, x2] call BIS_fnc_distance2D;

Measures the line of sight distance between x1 and x2. Works fine, I am using this in some HALO scripts. You need to have the function manager present on your game map though.

Cheers,

VictorFarbau

Edited by VictorFarbau

Share this post


Link to post
Share on other sites

Simply use the 2D position of the plane:

(([position _plane select 0,position _plane select 1,0] distance getmarkerpos _dropPos) < 150)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×