Skip to content

Arma 3 MP-compatible set/get loadout script with randomization options

Notifications You must be signed in to change notification settings

10Dozen/dzn_gear

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

dzn_gear

Version: 2.9

Uses aeroson's get_loadout/set_loadout script (see https://github.com/aeroson/a3-loadout)

  • Allows to choose gear and create gear kit for infantry units
  • Randomized infanty kit (random weapon, equipement, uniforms, etc.)
  • Allows to create cargo gear kits for vehicles and ammoboxes
  • Allows to use created kits to assign gear via: Synchronization with GameLogic or setVariable for unit
  • Allows to assign gear by unit's name or role description

Plugins

Unit Identity
Assign identity setting (face, voice, name) to AI-controlled unit via kit. Use `CTRL + I` to copy current identity settins and paste code as last paramater of the kit.
For multiplayer - set `dzn_gear_enableIdentitySync = true;` in `dzn_gear_init.sqf` to broadcast identity between clients.
Gear Assignement Table
Assign kits by RoleDescription or unit name (100% JIP compatible).
Gear Notes
Show your loadout and loadout of your squadmates at briefing screen.
Gear Zeus Compatibility
Allow Zeus to assign dzn_gear kits to selected units. Use 'G' key to open selection menu.

How To

Download files to your mission folder. If you already have "init.sqf", then update it with lines from downloaded "init.sqf".
Script should be ran with options[ editMode(BOOL), startDelay(NUMBER, Optional) ] execVM "dzn_gear_init.sqf";.
  1. Open Editor and place GameLogic object
  2. Name GameLogic as dzn_gear_%KITNAME% or dzn_gear_box_%KITNAME%
  3. Synchronize GameLogic with units to assign kit for them
  4. (Optional) You can also assign kit by adding this setVariable ["dzn_gear", "%KITNAME%", true] or this setVariable ["dzn_gear_cargo", "%KITNAME%", true] to units/vehicle init
  5. (Optional) You can also assign kit by adding this setVariable ["dzn_gear", "%KITNAME%", true] or this setVariable ["dzn_gear_cargo", "%KITNAME%", true] to GmaeLogic's init and synchronizing units with this GameLogic
  6. Open mission in EDIT MODE of dzn_gear and create kits
  7. Save kits to dzn_gear/Kits.sqf
  8. Rename kits (kitname from GameLogic's name or variable should match)

Video HowTo

https://www.youtube.com/watch?v=rhsF5Jw3Vdo
https://www.youtube.com/watch?v=rlCNkTFW2W8

Google Slides HowTo

Google Slides (RU): https://docs.google.com/presentation/d/1TDAyE8xhFSAO9977mSDJ8B5OokprkgaBUE59KTb0fuc/present?slide=id.gfe3687196_0_0

Kits

There are several types of gear kits you can create:
  1. Gear Kit (for infantry)
    1. Simple Kits
    2. Randomized Kits
    3. Random Kits
  2. Cargo Kit (for vehicles and ammoboxes)

(1)Gear Kit could be assigned to any infantry (even to crew of vehicles). It has some randomization option.
(1.i)Simple Kit is simple. It has one item for each category (uniform, weapons) which will be assigned to unit as is.
(1.ii)Randomized Kit has some variations of gear for some category. E.g. if you change classname of uniform to array of classnames, then unit will get random item from this array (BIS_fnc_selectRandom is used). If you want to give unit a random weapon, then change weapon's classname to array of classnames and change magazines for weapon to array of magazines - e.g. for Primary weapon:
change weapon "arifle_MX_SW_Black_F" to ["arifle_MX_SW_Black_F","LMG_Zafir_F"] and then change primary weapon's magazines from "100Rnd_65x39_caseless_mag_Tracer" to ["100Rnd_65x39_caseless_mag_Tracer","150Rnd_762x51_Box"]
Categories allowed to randomization are: Equipment: Uniform, Vest, Backpack, Headgear, Goggles, Primary Weapon: Weapon, Optics Attachement, Muzzle Attachement, Pointer Attachement, Secondary (Launcher) Weapon: Weapon, Handgun Weapon: Weapon, Optics Attachement, Muzzle Attachement, Pointer Attachement, Items, Magazines: Primary Weapon Magazine, Secondary Weapon Magazine, Handgun Weapon Magazine
(1.iii)Random Kit is a kit of kits. It doesn't contain any classname, but it is the array of another kit's names (bounded with "). Script will choose random kit from this array and assign it to unit. You can use the name of randomized kit here.

(2)Cargo Kit could be assigned to vehicles and ammoboxes. It contain only items which will be placed in cargo of unit (there is no weight/volume limits, so check quantity of items).

Assign Kits

There are several ways to assign kit to unit:
  1. Unit's variable
  2. GameLogic's variable
  3. GameLogic's name
(1) At the unit's init field place line: this setVariable ["dzn_gear", "%kitName%"](for gear kit) or this setVariable ["dzn_gear_cargo", "%kitName%"](for cargo kit).
(2) Place object GameLogic-Objects-GameLogic on map and add a line this setVariable ["dzn_gear", "%kitName%"] or this setVariable ["dzn_gear_cargo", "%kitName%"] to it's init field. Then synchronize GameLogic with units to assign gear to them (F5 in editor, to better accuracy - link unit to GameLogic). You can also synchronize vehicles with crew to assign gear kit.
(3) Place object GameLogic-Objects-GameLogic on map and name it dzn_gear_%kitname% or dzn_gear_cargo_%kitname%. Then synchronize GameLogic with units to assign gear on them. You can also synchronize vehicles with crew to assign gear kit.

How it works

After mission starts, all GameLogics will be checked. For any of them which have "dzn_gear" or "dzn_gear_cargo" in the name or as the variable all synchronized objects will be returned. For each object the chosen kitname will be checked for existence in file dzn_gear\Kits.sqf and then kit with such name will be assigned. Then all units will be checked for variable "dzn_gear" or "dzn_gear_cargo" and kits will be assigned.
After gear assigned, unit/object updates with variable "dzn_gear_assigned" which store the name of assigned kit.
Script runs at mission initialization. If you want to delay it, use second argument - e.g. 15 seconds after mission start: [ false, 15 ] execVM "dzn_gear_init.sqf";.

Edit mode

In 'EDIT' mode open mission in Editor and click "Preview": inside the mission you'll see hint with help text and keybinding.

Edit mode: Keybinding

  • [SPACE] -- Open Virtual Arsenal
  • [CTRL + SPACE] -- Copy gear of player or cursorTarget and add it to action list
  • [SHIFT + SPACE] -- Copy gear of player or cursorTarget without adding new action
  • [1...6] -- Show item list (primary weapon, uniform, headgear, etc.) and copy to clipboard
  • [SHIFT + 1...6] -- Set current item list and copy list
  • [CTRL + 1...6] -- Add item to list and copy
  • [ALT + 1...6] --Clear item list

  • where 1..6:
    1 -- Primary weapon and magazine
    2 or U -- Uniform
    3 or H -- Headgear
    4 or G -- Goggles
    5 or V -- Vest
    6 or B -- Backpack
    7 or P -- Backpack
  • Del -- removes all items of player/cursor target
  • PgUp -- cycled switch of uniform items presets
  • PgDown -- cycled switch of assigned items presets

When kit is created via [CTRL + SPACE] an actions will be added:

  • Kit with MX at 00:01:32 -- action will assign saved gear to player or cursor target (primary weapon and timestamp are added to action name)
  • Cargo Kit from ZAMAK (Covered) at 00:02:32 -- action will assign saved cargo gear to player's or cursor vehicle or box (vehicle name and timestamp are added to action name)

Edit mode: Basic flow of usage

  1. Open Virtual Arsenal by pressing [SPACE] key and choose any gear you need
  2. Quit Arsenal and press [CTRL + SHIFT] to copy kit to clipboard
  3. Then open dzn_gear/Kits.sqf and paste kit. It will be something like:
    kit_NewKitName = [[">", ...] ... ];
  4. Change kit_NewKitName to some unique kit name, e.g. kit_riflemanNATO, kit_SF_Demo_NATO, kit_OPFOR_OfficerWithMG. Use only global variable as name of kit.

API

After 'dzn_gear' initialized the client's dzn_gear_initDone = true is defined and dzn_gear_serverInitDone = true variable is published via network. After it you can use gear assignment "manually" using next function:
  • [ @Unit, @Kitname(string), (Optional)@isVehicle ] spawn dzn_fnc_gear_assignKit - assign given @kitname (as string, e.g. kit_nato_ar = [...] should be given as "kit_nato_ar") to @Unit or to vehicle, if @isVehicle argument passed as TRUE
  • [ @Unit, @Kit(array) ] spawn dzn_fnc_gear_assignGear - assign given @Kit (array of gear, returned from dzn_fnc_gear_getGear function) to @Unit (infantry)
  • [ @Vehicle, @CargoKit(array) ] spawn dzn_fnc_gear_assignCargoGear - assign given @CargoKit(array of gear, returned from dzn_fnc_gear_getCargoGear function) to @Vehicle (or box)
  • @Kit = @Unit call dzn_fnc_gear_getGear - return gear of infantry unit in format of dzn_gear kit.
  • @CargoKit = @Vehicle call dzn_fnc_gear_getCargoGear - return Cargo gear of vehicle or box in format of dzn_gear kit

  • @PreciseGear = @Unit call dzn_fnc_gear_getPreciseGear - return array of @PreciseGear (gear as it exists in units inventory, ammo in magazines is counted).
  • [ @Unit, @PreciseGear ] call dzn_fnc_gear_setPreciseGear - assign @PreciseGear to @Unit (infantry)

About

Arma 3 MP-compatible set/get loadout script with randomization options

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages