Arctic 0 Posted April 14, 2006 Hello there! This question has been asked countless times, but mine deals more with a script. So I have a chopper named AFlight that moves from airport to the Invisible H pad called LZ. I have the following code: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> #EnableAI AFlight move getpos LZ @((AFlight distance LZ) < 1) unassignvehicle a1 unassignvehicle a2 unassignvehicle a3 unassignvehicle a4 unassignvehicle a5 AFlight land "get out" AFlight flyinheight 120 AFlight move getpos "homeplate" The only problem is, the chopper simply hovers at the LZ spot! The chopper lands when I use a waypoint, but I want to use a script to get it to land. What's the darn problem? Share this post Link to post Share on other sites
Heatseeker 0 Posted April 14, 2006 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">AFlight land "get out" Hmm, have you tried <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">AFlight land "land" Instead? . Share this post Link to post Share on other sites
sanctuary 19 Posted April 14, 2006 Another possibility is because of that <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">AFlight move getpos LZ @((AFlight distance LZ) < 1) isn't the altitude of the helicopter added to the distance to the LZ . If yes, the distance will never be < 1 , if the helicopter is flying at +/- 30 m of altitude, instead of 1 , put +/- 40 or 50 (or even more, as the helicopter get more altitude when slowing down) this way the other part of the script will be read. Share this post Link to post Share on other sites
Garcia 0 Posted April 15, 2006 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">AFlight land "get out" Hmm, have you tried <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">AFlight land "land" Instead? . land "get out" works fine. Only difference is that with "get out" the chopper is supposed to hover over the ground (though I find that the chopper usually lands, except sometimes). Quote[/b] ]isn't the altitude of the helicopter added to the distance to the LZ .If yes, the distance will never be < 1 , if the helicopter is flying at +/- 30 m of altitude, instead of 1 , put +/- 40 or 50 (or even more, as the helicopter get more altitude when slowing down) this way the other part of the script will be read. That is indeed the problem. 1: The distance is the actual distance from the chopper to the LZ. So if the chopper flies 50 m above ground, and it actually positions itself perfectly over the LZ, the distance is still 50. So unless the chopper is flying at max 1 m above the ground, it'll never work. 2: If the distance command didn't add altitude, it would still be a problem. Choppers isn't really that accurate. Often they stop short or too long after the LZ. So it's not very likely you'll get it to stop so that check would have worked anyway. You could check the distance without the altitude easily though. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">@((sqrt(((getpos AFlight select 0) - (getpos LZ select 0))^2 + ((getpos AFlight select 1) - (getpos LZ select 1))^2) < 10) Something like that... Share this post Link to post Share on other sites
Arctic 0 Posted April 15, 2006 Yea Garcia and Sanctuary were right. Thanks, I never thought that the distance command would only do the x-axis distance! The pythagorean theorem did the trick Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 15, 2006 I have scripts that will take care of helicopter behavior issues here: http://www.flashpoint1985.com/cgi-bin....t=51453 Perhaps these will help you flesh out any further problems you have. Share this post Link to post Share on other sites