Creates a loadout from given inventory structure and applies it to a unit.
When String for class name is supplied, the command will search CfgVehicles for the given class in order to extract the loadout from config.
If Config is given, it will search given config (including mission config) for the loadout information.
In either case, the config should contain the following entries, which is standard for any unit class, for example:
Since Arma 3 v2.20 if the command is executed while the unit is in the process of switching weapon, the command will be aborted. To check if unit is switching weapon use isSwitchingWeapon.
player_2 setUnitLoadout (getUnitLoadout player_1); // Copies loadout from player_1 and applies it to player_2
player_2 setUnitLoadout [getUnitLoadout player_1, true]; // Copies loadout from player_1 and applies it to player_2 while topping up all magazines
If this command is used on the player, it makes the inventory window bug (if opened) - vest and backpack tabs disappear. Closing and re-opening the inventory solves the issue.
Empty or used magazines in loadouts will be refilled under specific circumstance, even if the refill argument is false. This seems to happen if amount of used magazines is 2 or more.
Will result in 2 magazines but full, 30 rounds in it. This applies to any magazines count >2. They will never be with specified amount of rounds, even if you force the refill argument to false.
Andrew_S90
Here is a command I wrote up that provides a fix for the ammo bug described by Demellion above.
https://pastebin.com/SHX41Jkk
Pass a loadout to your compiled command and it will provide one back that will not refill ammo.
You can use nil to skip some desired parameter. The skipped part will be ignored and remain the same with old loadout.
This method is very slightly faster than the latter method: