KosherArsenal Tutorial

From cluster wiki
Revision as of 15:41, 26 March 2022 by Eric (talk | contribs) (Created page with "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 ite...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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:

<example here>

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:

<default example here>

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.

<role example here>

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 <ROLE> to a new unique role name.

<line>

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:

<setRole example>

Once this has been done put the following inside initplayerLocal (or modify it if it's already inside):

<kosherArsenal init example>

Now you should have a fully functional arsenal. If you however wish to use multiple loadout files separate each loadout file with a comma:

<multi file init example>

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.