Authorised Crew Type Check

From F2 EN
Jump to: navigation, search

Description

The Authorised Crew Type Check component works in exactly the same way as the Authorised Crew Check component, but instead of checking for named player slots, it checks to see if the player is of a certain type or sub-type (such as pilot or a soldier of a west faction).

AuthorisedCrewCheck1.jpg


Required files

All the code associated with this component is found in:

  • init.sqf
  • stringtable.xml
  • f\common\f_isAuthorisedCrewType.sqf

How to activate

See section below.

How to use

Setting authorised crew type for a vehicle

In the ArmA2 editor, select the vehicle and ensure it has a name in the Name: field (such as MyTank).

Still in the editor, make sure the playable slots that you want to have as the authorised crew-members are of types such as Pilot or Crew.

Open the file init.sqf and look for the code segment entitled:

// F2 - Authorised Crew Type Check

Edit the following line, removing the // at the start, replacing VehicleName with the name of the vehicle, and the array ["UnitType1","UnitType2"] with an array containing the classnames or parent classes of the unit types authorised to act as crew.

// VehicleName addEventhandler ["GetIn", {[_this,["UnitType1","UnitType2"]] execVM "f\common\f_isAuthorisedCrewType.sqf"}];

For example, to ensure that only units of the type USMC_Soldier_Crew can act as the crew of MyTank, change the line to:

MyTank addEventhandler ["GetIn", {[_this,["USMC_Soldier_Crew"]] execVM "f\common\f_isAuthorisedCrewType.sqf"}];

Note: Remember to put "" around the unit types. If you want all BLUFOR soldiers but also Russian crewman to be able to drive MyTank, change the line to:

MyTank addEventhandler ["GetIn", {[_this,["SoldierWB","RU_Soldier_Crew"]] execVM "f\common\f_isAuthorisedCrewType.sqf"}];

Common unit types

Common unit types that you may want to use are:

FactionTypeClassname
USMCPilotUSMC_Soldier_Pilot
Armoured CrewUSMC_Soldier_Crew
CDFPilotCDF_Soldier_Pilot
Armoured CrewCDF_Soldier_Crew
RussianPilotRU_Soldier_Pilot
Armoured CrewRU_Soldier_Crew
ChDKZPilotINS_Soldier_Pilot
Armoured CrewINS_Soldier_Crew
NAPAPilotGUE_Soldier_Pilot
Armoured CrewGUE_Soldier_Crew
Civilian (Chernarus)PilotPilot
Civilian (Russia)PilotRU_Pilot

Tips

  • There is a known limitation with this feature: if a unit enters a vehicle as a passenger, s/he can sometimes use the action menu to move to a pilot / driver / commander / gunner position.
  • You can find a comprehensive list of all unit classes here http://browser.six-projects.net/cfg_vehicles/tree

Credits

  • white angel
  • Ricardo
  • eJay
  • Raedor
  • Pillage
  • Rom
  • Fer
  • Black Mamba