Jump to content
Sign in to follow this  
ladlon

Moving copter copilot to pilot seat

Recommended Posts

I think the problem is that it doesn't complete the MOVE before it gets the land command.

Here's a solution that you can do in the editor without dealing with script files.

Heli1 = Chopper

HeliPad = the "H" at base

In your "Request Apache" trigger add this line to the beginning of your existing code:

{deleteWaypoint [Heli1, _x];} foreach waypoints group Heli1;

In your "Land Apache" trigger cut and paste this changing the object names where necessary:

[Heli1] join grpNull; player hcRemoveGroup group Heli1; wp = (group Heli1) addWaypoint [(getPos HeliPad), 0]; wp setWaypointStatements ["true", "Heli1 land 'LAND';"]; (group Heli1) setCurrentWaypoint wp;

Ok - now for an explanation.

The line we added to the "Request" trigger is just to delete the waypoint we create later on when we call the "Land" trigger.

For the "Land" trigger -

[Heli1] join grpNull; player hcRemoveGroup group Heli1; - we need to remove the heli from the group before giving it the waypoint, otherwise it'll just hang around with us.

wp = (group Heli1) addWaypoint [(getPos HeliPad), 0]; - this creates a new waypoint at the HeliPad

wp setWaypointStatements ["true", "Heli1 land 'LAND';"]; - this adds a line to the OnAct. of the waypoint - you can see what it does :) NOTE: pay attention to the single quotes around 'LAND' double quotes will throw an error because the whole line must be enclosed in double quotes for the function and extra double quotes will confuse it.

(group Heli1) setCurrentWaypoint wp; - finally this actually assigns the waypoint to the Heli and it moves towards it. Once it reaches the waypoint, the line we added to tell it to land will execute.

Now the next time you "Request" the heli it will delete the previously created waypoint and join your group.

This isn't a perfect solution as it's kind of a brute force approach and there will be problems if you have waypoints assigned to the Heli already, but it works!

:D

Edited by Grizzle

Share this post


Link to post
Share on other sites

Yep, that makes sense. Good work!

I'll try that. If it doesn't work, it's no biggie. The Land Where You Are works fine, so it's really just a matter of pointing him to where you want him to go (like the airport), and then sending the Land command.

I just make an aircraft that comes to you from the airport, and lands again once you dismiss him.

Cool....

Share this post


Link to post
Share on other sites
Yep, that makes sense. Good work!

I'll try that. If it doesn't work, it's no biggie. The Land Where You Are works fine, so it's really just a matter of pointing him to where you want him to go (like the airport), and then sending the Land command.

I just make an aircraft that comes to you from the airport, and lands again once you dismiss him.

Cool....

This works. I tested it out. It's just not bulletproof because I'm deleting all the waypoints for the Heli, though for your purposes it won't be an issue.

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  

×