Jump to content
Sign in to follow this  
Easelm

Put units in a Helicopter on Spawn & one more thing..

Recommended Posts

First Question:

Hello again. I am wondering how to get units inside of a helicopter when that helicopter spawns "in the air". I have tried my own methods, I also searched for some methods and other things that didn't help.

Second Question:

Once I get units spawning in the helicopters correctly, I want to eject the units in the helicopter, well, I have something that works, but I want the pilot to stay in the helicopter instead of him launching out and the Helicopter falling out of the sky.

Here is the code I have for the helicopters to spawn, units ejecting, the helicopters go to a waypoint(This script works, but I want to add the above questions):

SpawnHele = true;
while {SpawnHele} do 
{
  Unit1 = [getPos hpad, side player, (configFile >> "CfgGroups" >> "West" >> "BIS_US" >> "Air" >> "US_CH47FFlight")] call BIS_fnc_spawnGroup;
  wp1 = Unit1 addWaypoint [getPos wp, 20];
 if(SpawnHele) Then 
 {
   {
      unassignVehicle (_x);
     (_x) action ["EJECT", vehicle _x];
   } foreach units Unit1;
 }; 
   sleep 5;
};

Share this post


Link to post
Share on other sites

Noone wants to eject the crew of a chopper without any reason... =)

In following (ugly) code i put an 5 man INF Squad in the heli and eject them..

SpawnHele = true;
while {SpawnHele} do 
{
  Unit1 = [getPos hpad, side player, (configFile >> "CfgGroups" >> "West" >> "BIS_US" >> "Air" >> "US_CH47FFlight")] call BIS_fnc_spawnGroup;
  wp1 = Unit1 addWaypoint [getPos wp, 20];
  Cargo1 = [getPos hpad, WEST, 5] call BIS_fnc_spawnGroup;
  {_x moveInCargo (assignedVehicle (leader Unit1))} foreach units Cargo1;
 if(SpawnHele) Then 
 {
   {
      unassignVehicle (_x);
      (_x) action ["EJECT", vehicle _x];
      } foreach units Cargo1;
   };
 }; 
   sleep 5;
};

:rolleyes:

Share this post


Link to post
Share on other sites

@Buliwyf

Mate, when a guy doesnt even know about moveInCargo command, dont confuse him with all that fancy stuff :) lol

@Easelm

1: you need assignAsCargo, moveInCargo Commands.

2: several different ways of doing it, using foreach command:

examples:

name group, place this in group leaders init.line. groupname = group this,

then do eject foreach units groupname, as Buliwyf showed.

{
  unassignVehicle (_x);
  (_x) action ["EJECT", vehicle _x];
} foreach units groupname;

or do eject for all units in heli that is not in group with driver/pilot:

{
  if ((group _x) != (group (driver heliname))) then {
     unassignVehicle (_x);
     (_x) action ["EJECT", vehicle _x];
  };
} foreach crew heliname;

you can also do if not driver then eject etc... many posibilitys., 1st groupname version recomended, many different ways of doing it.

Edited by Demonized
corrected groupname to crew heliname in last foreach example.

Share this post


Link to post
Share on other sites
Noone wants to eject the crew of a chopper without any reason... =)

In following (ugly) code i put an 5 man INF Squad in the heli and eject them..

SpawnHele = true;
while {SpawnHele} do 
{
  Unit1 = [getPos hpad, side player, (configFile >> "CfgGroups" >> "West" >> "BIS_US" >> "Air" >> "US_CH47FFlight")] call BIS_fnc_spawnGroup;
  wp1 = Unit1 addWaypoint [getPos wp, 20];
  Cargo1 = [getPos hpad, WEST, 5] call BIS_fnc_spawnGroup;
  {_x moveInCargo (assignedVehicle (leader Unit1))} foreach units Cargo1;
 if(SpawnHele) Then 
 {
   {
      unassignVehicle (_x);
      (_x) action ["EJECT", vehicle _x];
      } foreach units Cargo1;
   };
 }; 
   sleep 5;
};

:rolleyes:

Ugly code? I laughed. If you could not understand my code because it isn't your way, then please, keep those comments to yourself.

@Buliwyf

Mate, when a guy doesnt even know about moveInCargo command, dont confuse him with all that fancy stuff :) lol

@Easelm

1: you need assignAsCargo, moveInCargo Commands.

2: several different ways of doing it, using foreach command:

examples:

name group, place this in group leaders init.line. groupname = group this,

then do eject foreach units groupname, as Buliwyf showed.

{
  unassignVehicle (_x);
  (_x) action ["EJECT", vehicle _x];
} foreach units groupname;

or do eject for all units in heli that is not in group with driver/pilot:

{
  if ((group _x) != (group (driver heliname))) then {
     unassignVehicle (_x);
     (_x) action ["EJECT", vehicle _x];
  };
} foreach units groupname;

you can also do if not driver then eject etc... many posibilitys., 1st groupname version recomended, many different ways of doing it.

Thanks. At least someone actually gets me and what I am looking for. I am going to try it out now. <3

Share this post


Link to post
Share on other sites

just a note: i updated last post, details in reason for edit.

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  

×