Jump to content
Sign in to follow this  
TraxusIV

Helicopter extraction script for MP with respawns

Recommended Posts

Ok, so I found some threads about helicopter extraction scripting, and I got to the point where if my MP coop mission has 4 players on BLUFOR, I can have the helicopter wait until all four are aboard before taking off. I found that if one of them had died, using the ((!alive blu1) || (blu1 in heli1)) will evaluate to true even if blu1 isn't in the heli. So anyway, what I want to do is to make this script work with ai disabled. So if only 2 people are playing, only two team members (say, blu2 and blu3) will be present. How do I have the heli take off as soon as all the played by human players are on board?

Thanks,

Trax

Share this post


Link to post
Share on other sites

fnc_areAllPlayersInVehicle = {
  private ["_areAllPlayersInVehicle"];
  _areAllPlayersInVehicle = true;
  { if (isPlayer _x && alive _x && vehicle _x != _this) exitWith { _areAllPlayersInVehicle = false } } forEach playableUnits;
  _areAllPlayersInVehicle
}

Use a GetIn event handler to check if all players are in the vehicle when someone got in the heli. I didn't test the code.

Share this post


Link to post
Share on other sites

This works as a condition to check to see if all living members of a group are in a vehicle, the heli would be called helo1 and your group called Grp1 in this example.

{_x in helo1} count units Grp1 == count units Grp1;

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  

×