Jump to content
Sign in to follow this  
curtcooll

Pilot only script

Recommended Posts

Hi ive been making a mission so far ive made 4 dudes in heli crash on hill side then alerted nearby blufor rush over with 2 cars with guys which take about 5 mins to get to your position, in which they search and kill survivors your job is to try and get of island, i have at least 2 weeks worth work left to add alot stuff just trying to make it so the 2 guys that are part of the 4 man downed crew are 2 pilots and i want them to be only ones that can fly making it vital the pilots stay alive but still there is option for a boat ive tried old arma 2 scripts with no luck.

Thanks

---------- Post added at 22:03 ---------- Previous post was at 21:51 ----------

I found this works but i dont know what you would put arma 3 pilot class under as its not usmc rather summit diffrent any clues?

[]Spawn

{

WaitUntil {Sleep 5;Local Player};

While {True} Do

{

If ((Vehicle Player IsKindOf "Air") && (TypeOf Driver (Vehicle Player) != "USMC_Soldier_Pilot") && (TypeOf Driver (Vehicle Player) != "")) Then

{

Driver (Vehicle Player) Action ["Eject", Vehicle Player];

Hint Format ["%1 you're not a qualified pilot.", Name Player];

};

Sleep 0.5;

};

};

Share this post


Link to post
Share on other sites

to get around this issue, name the players that you have spawned

eg. set the 2 infantry players - give them names such as rifleman_1 and rifleman_2

eg. set the 2 pilots players - give them name such as pilot_1 and pilot_2

create a script for each unit and give them global variables (see below)


//this is the pilotonly script


playerType = "setplayerName"; //select a player type bases on name
_helicopterName = _this select 0; //define helicopter name when calling script e.g. _pilotOnly = [helicopter_name] execVM "pilotOnly.sqf"
_player = player //means that script attached to local player

if (player = pilot_1 OR player = pilot_2)
then
{
      playerType = "pilot";
      hint format ["You are a %1", playerType]; //hints the players type of character
}
else
{
      playerType = "rifleman";
      hint format ["You are a %1", playerType]; //hints the players type of character
};

if (playerType = "pilot" && player in _helicopterName) then
{
      hint "You are able to fly this chopper";
}
else
{
      hint "You are not a pilot and cannot pilot this vehicle";
      moveOut _player; //this moves player out of vehicle
};

hope you understand this and that it works for you,

hope this helps

have a good time playing the Arma 3 alpha

Share this post


Link to post
Share on other sites
to get around this issue, name the players that you have spawned

eg. set the 2 infantry players - give them names such as rifleman_1 and rifleman_2

eg. set the 2 pilots players - give them name such as pilot_1 and pilot_2

create a script for each unit and give them global variables (see below)


//this is the pilotonly script


playerType = "setplayerName"; //select a player type bases on name
_helicopterName = _this select 0; //define helicopter name when calling script e.g. _pilotOnly = [helicopter_name] execVM "pilotOnly.sqf"
_player = player //means that script attached to local player

if (player = pilot_1 OR player = pilot_2)
then
{
      playerType = "pilot";
      hint format ["You are a %1", playerType]; //hints the players type of character
}
else
{
      playerType = "rifleman";
      hint format ["You are a %1", playerType]; //hints the players type of character
};

if (playerType = "pilot" && player in _helicopterName) then
{
      hint "You are able to fly this chopper";
}
else
{
      hint "You are not a pilot and cannot pilot this vehicle";
      moveOut _player; //this moves player out of vehicle
};

hope you understand this and that it works for you,

hope this helps

have a good time playing the Arma 3 alpha

i tried the above and well it didn't work for me. i tried putting in the int of player and helicopter and was able to enter and fly however other code i found worked but i dont know how and what helicopter pilot would be called.

Share this post


Link to post
Share on other sites

Could anyone else shed some light on what the new classes are named for the helicopter pilot instead of USMC_Soldier_Pilot.

Thanks

[]Spawn

{

//WaitUntil {Sleep 5;Local Player};

While {True} Do

{

If ((Vehicle Player IsKindOf "Air") && (TypeOf Driver (Vehicle Player) != "USMC_Soldier_Pilot") && (TypeOf Driver (Vehicle Player) != "")) Then

{

Driver (Vehicle Player) Action ["Eject", Vehicle Player];

Hint Format ["%1 you're not a qualified pilot.", Name Player];

};

Sleep 0.5;

};

};

Share this post


Link to post
Share on other sites

just replace "USMC_Soldier_Pilot" with "B_helipilot_F" and you should be in business!

Share this post


Link to post
Share on other sites

Here's two I had for Arma 2, can't remember which of them I used but anyways just try them both and change the classname to the Arma 3 pilot classname

after that just name the script e.g. pilotcheck.sqf, then on the helicopter put this in the init field: null = [this] execVM "pilotcheck.sqf";

In the first script (below) I'm guessing you need to say which vehicle type and classname you want in the init code,

e.g. null = [helicopter,US_Soldier_Pilot_EP1] execVM "pilotcheck.sqf";

_vehicleType = _this select 0;  // "Helicopter" / "Tank"
_crewType = _this select 1;  // "US_Soldier_Pilot_EP1"

//hint format["%1 - %2",_crewType, _vehicleType];
 if (typeof player != _crewType) then {
   private "_v";
   while {alive player} do {
     waituntil {vehicle player != player};
     _v = vehicle player;
     if (_v iskindof _vehicleType && !(_v iskindof "ParachuteBase")) then {
       if (driver _v == player) then {
         player action ["eject",_v];
         waituntil {vehicle player == player};
         hint "We shall leave the piloting to those with the appropriate training.";
       };
     };
   };
 };

if (typeof player != "USMC_Soldier_Pilot") then {
   private "_v";
   while {alive player} do {
     waituntil {vehicle player != player};
     _v = vehicle player;
     if (_v iskindof "Helicopter" && !(_v iskindof "ParachuteBase")) then {
       if (driver _v == player) then {
         player action ["eject",_v];
         waituntil {vehicle player == player};
         hint "You are not trained to use this vehicle.";
       };
     };
   };
 };

Edited by clydefrog

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  

×