Jump to content
Sign in to follow this  
scajolly

Aircraft group does not heed waypoints

Recommended Posts

Hello,

I wish to resolve an issue of mine. I spawn a group of aircraft and give them waypoints, but they do not seem intent on following the waypoints. Is there any obvious reason for why this is not working? Thanks in advance for any help.

fitter = createGroup east;

fitter1 = ([getPos fitterspawn, 150, "PRACS_TK_Su22", fitter] call bis_fnc_spawnvehicle) select 0;
fitter1 setVehicleVarName "fitter1";
fitter1 setvehicleammo 0.5;
driver fitter1 setbehaviour "safe";
fitter1 flyinHeight 500;

_fitwp1 = fitter addwaypoint [position fitterwp1,0];
_fitwp1 = [fitter,1] setWaypointType "MOVE";
_fitwp2 = fitter addwaypoint [position fitterwp2,1];
_fitwp2 = [fitter,2] setWaypointType "CYCLE";


   sleep 10;
   fitter2 = ([getPos fitterspawn, 150, "PRACS_TK_Su22", fitter] call bis_fnc_spawnvehicle) select 0;
fitter2 setVehicleVarName "fitter2";
fitter2 setvehicleammo 0.5;
driver fitter2 setbehaviour "safe";
fitter2 flyinHeight 500;

Share this post


Link to post
Share on other sites

Seems to work here, they do need too be a good distance a part because if their turning circle is to large they will have problems.

Share this post


Link to post
Share on other sites

Syntax is a little off - try this, addwaypoint returns an array (format waypoint) with [group,index] so you don't need to add it again:

_fitwp1 = fitter addwaypoint [position fitterwp1,0];
 _fitwp1 setWaypointType "MOVE";
_fitwp2 = fitter addwaypoint [position fitterwp2,1];
 _fitwp2 setWaypointType "CYCLE";

Your basic problem is not enough waypoints - they will not fly to the CYCLE WP - it simply instructs them to return to the closest / initial WP.

In your case they will fly from WP-0 (created when bis_fnc_spawnvehicle spawns vehicles) to WP-1 (_fitwp1) - then CYCLE back to WP-0 (or WP-1 if it's closer).

Just tried it in the editor, Takistan - put a group of 2 jets on the map, flying, near southern airfield, with AI as leader, player in rear jet - put a WP on the south airfield type MOVE, put another WP on the north airfield type CYCLE. The AI will circle the 2 waypints at the bottom of the map and never fly near the CYCLE waypoint. You need to add another MOVE type up north to get them to do the correct thing.

What are fitterwp1, fitterwp2, fitterspawn? Objects?

Edited by Mattar_Tharkari

Share this post


Link to post
Share on other sites

Man, you're in for some frustration when talking about helos, wayponts, & how said helos act. Even when everything is setup perfectly. I suppose it's all up to what you're trying to do also, but still, helos act stupid. The only time they don't act stupid, is when you use UnitCapture & UnitPlay. But this also has it's limitations too.

Share this post


Link to post
Share on other sites

True it can be frustrating - problem is you really need to read the wiki as some waypoints don't act the way you expect. Helicopters are also affected by the wind - hence the odd landing backwards behaviour. The AI are programmed to land into the wind but have no knowledge of turning into the wind to land, so I find I have to set the headwind for them in order to guarantee a realistic landing. So yes it's frustrating as the setWind command is a headache to understand.

Share this post


Link to post
Share on other sites

Well not just with landings or the wind... I personally thought landings, even landing backwards was acceptable. I'm talking about how they act in general, regardless of waypoints or how you understand them.

Share this post


Link to post
Share on other sites

Most helicopters will turn on landing, a) to dump speed. b) to turn into the wind. Thats the main problem for me - the AI just yank back on the stick like a noob flyer and climb to lose speed - it's awful! Scripting a turn and setting the wind is easy - it's getting them to miss terrain features while doing it that's hard, probably why BIS have left it the way it is?

Share this post


Link to post
Share on other sites

That's precisely what I'm talking about actually, how they climb, even sometimes on normal move waypoints. Then sometimes they go right through smoothly. Really irritating.

Share this post


Link to post
Share on other sites

Hello again Mattar,

Yes, these are invisi-H's high in the air.

The script works now, and the aircraft do as they are told. Thank you!

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  

×