Jump to content
Sign in to follow this  
Hinds

Helicopter Scripting Question

Recommended Posts

Hello all. This'll be my first public question here. Here it is:

I want a helicoptor to start the mission sitting on the ground and wait until I am in it for it to begin following its waypoints. There's a little catch: once it lands at the destination, I want it to wait until I get BACK in the helicopter AND for it to check the objective is completed (i.e. - both are necessary to leave) before it takes off for its last waypoint (which will end the mission).

How would I go about this? Thanks!

Share this post


Link to post
Share on other sites

First you would want to check whether the player is in the helicopter, the best way to do this I think is to use a trigger using in vehicle (http://community.bistudio.com/wiki/in_vehicle), in the case of the second trigger you could simply use the system used in the first trigger but use AND (http://community.bistudio.com/wiki/and) so the trigger will check both if the player is in the vehicle and if the objective condition is met.

You can make the helicopter wait by synchronising the trigger with the landing waypoint, now this should work for the second trigger. But if you want to let the helicopter start from the ground you might have to do a workaround, although I think a better option would be to let the helicopter start of in the air and then let it land near the players starting position and then simply synchronise the waypoint and the trigger.

If you dont want to make the helicopter land at the players starting position you might want to check out ways to temporarily disable the helicopter.

http://community.bistudio.com/wiki/disableAI

http://community.bistudio.com/wiki/setFuel

Share this post


Link to post
Share on other sites

Thanks for the reply!

I think it'll be easier if I just have the player start in the helicopter while it's flying. That's fine; doesn't mess anything up.

The second/exit trigger seems straightforward enough, though. I should be able to have it check another trigger that returns "true" when all the objectives are completed, right? That already exists, so I may as well just modify and reference it (for tests purposes the game ends after objectives are complete, but I'll switch that for the helicopter extraction).

Now, which waypoint do I synchronize the trigger with? The one I want it to go to (once I'm in the helicopter and the objectives are complete), correct?

Thanks again! :D

EDIT: Noticed where to attach the second trigger to. Sorry! I'm trying it out now. I'll report back on how it turns out.

Edited by ScratchtasticZ
Noticed answer to question.

Share this post


Link to post
Share on other sites

Alright, I've been playing with this for about two hours now. The mission is about 2/3 done, but I'm trying to nail this helicopter thing down. Once I learn how to make it work right, I should be able to add as many conditions as I want... but here's the problem:

Originally, I had it set to test whether player (SF1) were in the helicopter as well as referencing an objectives checker (which turns "true" when an artillery piece, truck, and plane are all destroyed - I know this trigger works; it used to end the mission) BEFORE taking off. I would do a run through, destroy everything, and then get in the helicopter. It would just sit there and do nothing.

So, I made another helicopter and started playing around with triggers on the other side of the map. You know, to see if I could nail it down over there and then transfer what worked to the actual landing zone and such. I can't get a single thing to do what I want it to do. It seems to drop me and my squad off and then ascend probably 50m above the ground and wait for a random civilian to be killed (I'm using him as a generic placeholder for the trigger), regardless of how I set it up. I've tried synchronizing the triggers by themselves or together to the LZ waypoint, using conditions IN the waypoint itself, referencing the triggers IN the waypoint, etc... nothing seems to accomplish what I'm trying to do.

Any ideas? And to restate what I'm trying to do:

*Player must complete objective for helicopter to take off

*Player must be in helicopter to take off

Here is my current setup for the helicopter I want to use:

*Transport Unload Waypoint [centered on H (Invisible)]

Condition: ExtractChecker

On Act:

-where ExtractChecker is the following;

**ExtractChecker

Condition: Boolean = SF1 in Ins1 AND Complete

On Act: ExtractChecker=true

-where SF1 is the player, Ins1 is the helicopter, and Complete is the following;

***Complete

Condition:! (alive Plane1) AND ! (alive Arty1) AND ! (alive Truck1)

On Act: Complete=true

-where Plane1, Arty1, and Truck1 are all empty vehicles

Then, once ExtractChecker gives permission, it's supposed to take off and fly to a mission-ending script.

^ I organized that as best I could to provide the most information. Please ask if you're confused... I've tried combining them or taking out the Boolean command or all manner of other combinations that should provide the same effect... problem has always been that it simply won't take off.

As far as my test helicopter, I can't get it to stay on the ground, like I said. So... kind of at a loss here. Hopefully someone can help me out. Thanks!

EDIT: Needed to provide OnAct information and reorganize a bit.

Edited by ScratchtasticZ
Fixing formatting, etc.

Share this post


Link to post
Share on other sites

Hmm, I don't really know how to keep the chopper on the ground, I recommend you try a few other waypoint types and see if they work better.

You could off course use the get out waypoint to make the pilot get out of the helicopter and then make him get back in when you complete the objectives and are in the chopper.

A second possibility is that you let the helicopter fly off when you are dropped off and then make him come back to the landing zone when the objectives are completed by synchronising a pick up waypoint by the chopper (don't remember the exact waypoint name, but its in there somewhere) and combine that with a get in waypoint by the player group which should be put on the chopper and which should also be activated when you complete the objectives (although this would require having a previous waypoint). This should make the helicopter hover over the pick up spot and when the helicopter spots the player group it should land and wait for the group to be in the helicopter before it goes to the next waypoint (although this system can fail sometimes for no apparent reason).

Share this post


Link to post
Share on other sites

I will try your suggestions either today or tomorrow. Thanks!

At this point, I'm thinking of scrapping the helicopter idea in favor of a much simpler manual (player drives) boat insertion, just for sake of finishing the mission and having it complete and playable. I'd still like a helicopter to factor in somehow, though...

So, in the mean time, is there any way to force a helicopter, such as the UH-60, to circle the island (I'm using Rahmadi) and fire at enemy targets for a set amount of time, and then fly away?

Basically, come in for a minute, shoot at stuff with the door guns, and then leave. Might be a way to incorporate helicopters in to the mission without all the complicated landing stuff... although this could be just as bad. Haha. Thanks again.

Share this post


Link to post
Share on other sites

The problem with that predetermined pass is that when your helicopter sees enemy units he will go into combat mode, which practically means that he will ignore his waypoints to evade/attack the enemy units.

Your best bet for making that predetermined pass is to disableai (I think the target part) the pilot unit in the helicopter.This might allow you to simply manage the helicopters flight using waypoints.

http://community.bistudio.com/wiki/driver

http://community.bistudio.com/wiki/disableAI

Share this post


Link to post
Share on other sites

Thank you. I'll throw that in there and see if I can make it work (tying it to a radio call would be pretty awesome for this kind of mission).

Would the AI maybe be messing up my landing/takeoff issue as well? Like I've mentioned, it seems to ignore the conditions I set for taking off (checking number of occupants, if everyone is either dead or in the helicopter, etc).

Share this post


Link to post
Share on other sites

I doubt your taking off problem is related to the combat ai because then the helicopter would start flying around instead of simply hovering over the landing zone. Nevertheless you can try fiddling a bit with the disableai command and see if it works.

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  

×