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;