Jump to content
Sign in to follow this  
skudd3r

[ISSUE]Helicopter extraction hold waypoint

Recommended Posts

Note: I'm learning to script still so if I am doing something messy, tell me I won't be offended.

Goal: Have a helicopter controlled by AI fly to a waypoint, wait for all players to get out, then move off when no players are left in the chopper.

Script:

Helicopter follows waypoints. At waypoint 3, a script is activated (AIR1 being the helo, AIR1OUT being a variable I set in init.sqf to false):

null = [AIR1, AIR1OUT] execVM "scripts\emptyVehicle.sqf";

At waypoint 4, I set a condition AIR1OUT, this causes the helicopter to stop (Altitude at 3-5m). I bail out and nothing happens, the helicopter remains in that way-point. So I added a debug hint my script to try to see what was going on. I found out that my waituntil is working fine, it shows that there is 1 player in the chopper and the Boolean is false. When I bail out however, the counter changes to 0, but the Boolean remains as false. Its late I could just be tired or completely overlooking something obvious.

Here is my SQF:

//Made by SKuD
//null = [vehicle,player] execVM "scripts\emptyVehicle.sqf";

_vehicle = _this select 0;
_str = "Counter: ";
_unit = player;
_condition = _this select 1;


waitUntil{
{_x in _vehicle} count units group _unit == 0;
_counter = {_x in _vehicle} count units group _unit;
_str = _str + format ["%1 %2", _counter, _condition];
hint _str;
sleep 5;
};

_condition = true;

Share this post


Link to post
Share on other sites

If you are using in game waypoints you dont need this script. Set the helicopters waypoint to transport unload and set the infantry to a get out waypoint then sync the two waypoints.

Share this post


Link to post
Share on other sites

As Cobra said. If you still want to use a script try changing the waitUntil condition:


waitUntil {helo emptyPositions "cargo" > 0};
helo doMove (getpos helipad);

This would cause the helo to wait until nobody's in the cargo and then issue a domove to a new helipad.

Share this post


Link to post
Share on other sites

ive done something similar using a script using a raido command with heli flying about 3 inchs or more of ground you get booted out and then the heli will hold at waypoint for 12 secs enough time to use the command. unload waypoints dont work well at least never for me if you want the helicopter to hover without landing ive set it up for that but if you want heli to land and take of after cargo empty ive done that also just using way points. as cobra said.

Share this post


Link to post
Share on other sites

I know about unload, but I am wanting the users to perform the action, feels more involved. I also was trying to create this script so it could be reusable with the inputs, vehicle name and the condition name as input variables. I was thinking maybe the issue was the variable AIR1OUT is set in the init.sqf as false, I place it in the waypoint condition as AIR1OUT and in the previous waypoint I've already executed the script, but in the script I take the input for the condition and set it to _condition and update it locally. But then why would my waituntil loop not stop? My debug hint updates and shows as 0 when the user bails out of the chopper, so shouldn't that end the waituntil loop(It's not atm)?

Share this post


Link to post
Share on other sites

Have you tried the support module yet? Sync the transport module to a heli and the leader. You can call the helicopter multiple times and he will fly you where you want.

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  

×