wiggum2 31 Posted December 13, 2011 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
Przemek_kondor 13 Posted December 13, 2011 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
demonized 20 Posted December 13, 2011 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
VictorFarbau 0 Posted December 13, 2011 (edited) 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 December 13, 2011 by VictorFarbau Share this post Link to post Share on other sites
st_dux 26 Posted December 13, 2011 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