KosherArsenal Tutorial
The kosherArsenal function group is a collection of functions that provides an arsenal system which allows you to select loadout only upon initial respawn with whitelisted items based on role and team.
Creating a whitelist (loadout file)
Creating a whitelist is fairly simple contrary to how it looks. To start making your first loadoutfile navigate to rsc/loadouts/ and duplicate !Template.sqf, name it something descriptive and open it up. Once opened it should look like this:
params["_role"];
private["_availableUniforms", "_availableWeapons", "_availableMagazines", "_availableVests", "_availableItems", "_availableBackpacks", "_availableHeadgear", "_availableFacewear", "_availableAttachments", "_availableGrenades"];
// Define default gear
private _defItems = ["ACE_adenosine", "ACE_fieldDressing", "ACE_elasticBandage", "ACE_packingBandage", "ACE_quikclot", "ACE_epinephrine", "ACE_Flashlight_MX991", "ACE_MapTools", "ACE_morphine", "ACE_splint", "ACE_tourniquet", "ItemMap", "ItemCompass", "ItemWatch", "ACE_CableTie"];
private _defWeapons = [];
private _defAttachments = [];
private _defMagazines = [];
private _defGrenades = [];
private _defUniforms = [];
private _defVests = [];
private _defBackpacks = [];
private _defHeadgear = [];
private _defFacewear = [];
// Rifleman
if (_role == "RFL") then {
_availableUniforms = [];
_availableWeapons = [];
_availableAttachments = [];
_availableMagazines = [];
_availableVests = [];
_availableItems = [];
_availableGrenades = [];
_availableBackpacks = [];
_availableHeadgear = [];
_availableFacewear = [];
};
// Team leader
if (_role == "SL") then {
_availableUniforms = [];
_availableWeapons = [];
_availableAttachments = [];
_availableMagazines = [];
_availableVests = [];
_availableItems = [];
_availableGrenades = [];
_availableBackpacks = [];
_availableHeadgear = [];
_availableFacewear = [];
};
// Medic
if (_role == "MED") then {
player setVariable ["ace_medical_medicclass", 2, true];
_availableUniforms = [];
_availableWeapons = [];
_availableAttachments = [];
_availableMagazines = [];
_availableVests = [];
_availableItems = ["ACE_personalAidKit", "ACE_plasmaIV", "ACE_plasmaIV_250", "ACE_plasmaIV_500", "ACE_surgicalKit", "kat_chestSeal", "kat_larynx", "kat_stethoscope"];
_availableGrenades = [];
_availableBackpacks = [];
_availableHeadgear = [];
_availableFacewear = [];
};
// SAW/LMG
if (_role == "AR") then {
_availableUniforms = [];
_availableWeapons = [];
_availableAttachments = [];
_availableMagazines = [];
_availableVests = [];
_availableItems = [];
_availableGrenades = [];
_availableBackpacks = [];
_availableHeadgear = [];
_availableFacewear = [];
};
// MMG
if (_role == "MMG") then {
_availableUniforms = [];
_availableWeapons = [];
_availableAttachments = [];
_availableMagazines = [];
_availableVests = [];
_availableItems = [];
_availableGrenades = [];
_availableBackpacks = [];
_availableHeadgear = [];
_availableFacewear = [];
};
// Grenadier
if (_role == "GRD") then {
_availableUniforms = [];
_availableWeapons = [];
_availableAttachments = [];
_availableMagazines = [];
_availableVests = [];
_availableItems = [];
_availableGrenades = [];
_availableBackpacks = [];
_availableHeadgear = [];
_availableFacewear = [];
};
// LAT
if (_role == "LAT") then {
_availableUniforms = [];
_availableWeapons = [];
_availableAttachments = [];
_availableMagazines = [];
_availableVests = [];
_availableItems = [];
_availableGrenades = [];
_availableBackpacks = [];
_availableHeadgear = [];
_availableFacewear = [];
};
// MAT
if (_role == "MAT") then {
_availableUniforms = [];
_availableWeapons = [];
_availableAttachments = [];
_availableMagazines = [];
_availableVests = [];
_availableItems = [];
_availableGrenades = [];
_availableBackpacks = [];
_availableHeadgear = [];
_availableFacewear = [];
};
// HAT
if (_role == "HAT") then {
_availableUniforms = [];
_availableWeapons = [];
_availableAttachments = [];
_availableMagazines = [];
_availableVests = [];
_availableItems = [];
_availableGrenades = [];
_availableBackpacks = [];
_availableHeadgear = [];
_availableFacewear = [];
};
// Engineer
if (_role == "ENG") then {
player setVariable ["ACE_IsEngineer", 2, true];
_availableUniforms = [];
_availableWeapons = [];
_availableAttachments = [];
_availableMagazines = [];
_availableVests = [];
_availableItems = [];
_availableGrenades = [];
_availableBackpacks = [];
_availableHeadgear = [];
_availableFacewear = [];
};
// Return loadout arrays
[
"1.0", // loadout version
[
(_availableBackpacks + _defBackpacks),
(_availableVests + _defVests),
(_availableUniforms + _defUniforms),
(_availableFacewear + _defFacewear),
(_defHeadgear + _availableHeadgear),
(_defAttachments + _availableAttachments),
(_availableMagazines + _defGrenades + _defMagazines + _availableGrenades),
(_availableWeapons + _defWeapons),
(_availableItems + _defItems)
]
];
To add items to a section copy the classname of the item and put it inside quotes inside the array brackets: ["<Classname>"]. To copy the classname open ace arsenal on a unit and hit CTRL + C when you have selected your desired item.
Let's break up each individual part of the loadout file to make it easier to explain what each part is:
private _defWeapons = [];
private _defAttachments = [];
private _defMagazines = [];
private _defGrenades = [];
private _defUniforms = [];
private _defVests = [];
private _defBackpacks = [];
private _defHeadgear = [];
private _defFacewear = [];
The section above is where you define "default items". These are items that will be available regardless of role. It is designed for items that should be shared across roles like maps and compasses etc.
if (_role == "RFL") then {
_availableUniforms = [];
_availableWeapons = [];
_availableAttachments = [];
_availableMagazines = [];
_availableVests = [];
_availableItems = [];
_availableGrenades = [];
_availableBackpacks = [];
_availableHeadgear = [];
_availableFacewear = [];
};
This section is how you create a role, the template comes with 9 predefined roles (RFL, SL, MED, AR, MMG, GRD, LAT, MAT, HAT and ENG) but you can add or remove roles at will. To create a new role just copy paste the code section above and change "RFL" to a new unique role name.
A complete loadout file can look like the example below:
<example of complete loadout file>
Using kosher arsenal in a mission
Now that you have created a loadout file we will have to initialize kosher arsenal and assign it the loadout file. I recommend calling kosherArsenal from inside initPlayerLocal.sqf but aslong as it's being called locally on each client it will work. First however you will need to assign roles to the playerunits. To do this place the following in a playerunits init field and change "RFL" to the desired role:
[this, "RFL", 0] call emf_gameplay_fnc_setRole;
Once this has been done put the following inside initplayerLocal (or modify it if it's already inside):
[["<loadoutfile>"]] call emf_kosherArsenal_fnc_init;
Now you should have a fully functional arsenal. If you however wish to use multiple loadout files separate each loadout file with a comma:
[["<loadoutfile1>", "<loadoutfile2>"]] call emf_kosherArsenal_fnc_init;
Each loadout file defined in the array increments the team by 1, so the first element would be team 0, the next would be 1 etc.