Jump to content
Sign in to follow this  
Z0MBiE

Make Helicopter wait between patrols?

Recommended Posts

I'm trying to make a mission and during this mission an AI helicopter will patrol the island. I want it to do one circuit, land, wait, then go again.

I've gotten it to do its patrol, then land, but I can't seem to make it wait. I've tried putting the numbers in the Timeout section of the Cycle waypoint and the landing waypoint but it just takes off to patrol again without waiting.

Am I trying to do this the wrong way?

Share this post


Link to post
Share on other sites

I see what you mean but I just can't think of how to implement it. :/

It says it'll copy the waypoints from one group to another, but I only have one helicopter unit.

Would I copy it to itself? Something like

Heli copyWaypoints Heli

Sorry if this sounds stupid, still trying to learn the scripting.

Edited by Z0MBiE

Share this post


Link to post
Share on other sites

Place down some random dude and give him the waypoints you want the chopper to have. Have this in it's init field:

chopperPath = group this;deleteVehicle this;

What that will do is give you access to the waypoints via this command which you'd run anytime you wanna kick off your heli flight:

chopperPath copyWaypoints Heli;

So basically taking the waypoints from group "chopperPath" which was the group of the now-deleted unit you put on the map to the Heli, and that command will start the flight. Even though you deleted the unit, the group still remains so you still have access to the waypoints.

Share this post


Link to post
Share on other sites

Ah, that's pretty clever. Thanks again.

---------- Post added at 16:06 ---------- Previous post was at 15:39 ----------

EDIT: I'm still not sure where in the process I would put this command. Do I put it in the "on act" in one of the waypoints? In an external script which I call from one of the waypoints?

My guess was to just put something like

sleep 120; chopperPath copyWaypoints Heli;

into the last waypoint but that's not working and is giving me an error about expecting a group not an object or something? I'm probably way off.

Share this post


Link to post
Share on other sites

I'm sorry, I had the syntax backwards! It's copyTo then copyFrom. Gah

Here's a demo mission.

Waypoint dude's init:

heliPath = group this; deleteVehicle this;

Trigger code:

group Heli copyWaypoints heliPath;

Or name the Heli's group and replace "group Heli" with "heliGroup" or whatever.

So your example would be:

sleep 120;
group Heli copyWaypoints chopperPath;

Share this post


Link to post
Share on other sites

Thanks for taking the time to make that, I appreciate it.

BUT! hehe, I'm having a problem, when I try

sleep 120; group Heli copyWaypoints heliPath

in the trigger I get an error come up, "Error Generic error in expression".

I thought just making a chopper fly around on it's own every now and then would be a bit easier than this lol.

Share this post


Link to post
Share on other sites

you cant' use sleep directly in the editor

you will need to spawn the code.

null=[] spawn {sleep 120; group Heli copyWaypoints heliPath};

you could also instead of sleep use the trigger timers, the three small boxes, set them all to 120

Share this post


Link to post
Share on other sites

Yeah, I'd have it loop via an external script instead of via trigger, especially if you wanted it to happen more than once.

Share this post


Link to post
Share on other sites
you cant' use sleep directly in the editor

you will need to spawn the code.

null=[] spawn {sleep 120; group Heli copyWaypoints heliPath};

you could also instead of sleep use the trigger timers, the three small boxes, set them all to 120

That got it working thanks alot guys.

Edited by Z0MBiE

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  

×