vehGear - Global-Conflicts-ArmA/Olsen-Framework-Arma-3 GitHub Wiki

The vehGear.sqf file is used to set the inventory of vehicles.

To give a vehicle a custom loadout you use [this, "LOADOUT"] call FNC_VehicleGearScript, in the initialization field of the vehicle, where LOADOUT is the custom text name of the loadout.

Example:

[this, "KamAZ"] call FNC_VehicleGearScript;

example

Switch structure

The vehicle gear script uses a case switch to separate the vehicle loadouts. A switch basically takes an input and compares it to all the cases until it spots a match and executes the matched loadout. The case switch uses custom text names to differentiate the loadouts.

Example: LOADOUT is not valid code.

switch (_type) do {
    
    case "HUMMVEE": {
        LOADOUT
    };
    
    case "UAZ": {
        LOADOUT
    };
    
};

Making a vehicle loadout

When making a vehicle loadout there are 2 approaches, to clean out everything already in the vehicle, or just to add additional equipment to whats already inside the vehicle. To clear out the inventory CLEARCARGO is used.

ACE3 classnames

UO classnames

To clear the gear of a vehicle use _vehicle call FNC_RemoveAllVehicleGear;.

To add a single item use ["CLASSNAME"] call FNC_AddItemVehicle;.

To add multiple items use ["CLASSNAME", AMOUNT] call FNC_AddItemVehicle;.

To add random items use [["CLASSNAME1", "CLASSNAME2"], AMOUNT, "uniform"] call FNC_AddItemVehicleRandom;.

Advanced random items syntax [["CASE1_AMMO", random(2, 6)], ["CASE1_WEAPON"](/Global-Conflicts-ArmA/Olsen-Framework-Arma-3/wiki/["CASE1_AMMO",-random(2,-6)],-["CASE1_WEAPON"), ["CASE2_AMMO", random(1, 4)], ["CASE2_WEAPON"](/Global-Conflicts-ArmA/Olsen-Framework-Arma-3/wiki/"CASE2_AMMO",-random(1,-4)],-["CASE2_WEAPON")] call FNC_AddItemVehicleRandom;.
You can have as many cases and items per cases as you like.

Example:

case "KamAZ": {

    _vehicle call FNC_RemoveAllVehicleGear;

    ["arifle_Katiba_C_ACO_pointer_F", 5] call FNC_AddItemVehicle;

    ["30Rnd_65x39_caseless_green", 20] call FNC_AddItemVehicle;

};