With the scripting commands that are currently available (ArmA 3 v1.68.141559), interaction with container/unit inventory is very limited. For instance, it is not possible to remove a specific weapon/magazine/item from an inventory holder or from a unit - it is only possible to remove ALL instances of a weapon/magazine/item class inside a container or on a unit, which often removes too much.
These issues can be fixed by introducing a new set of scripting commands which, unlike the existing commands, don't work with classname strings, but rather with UIDs that are assigned to every inventory item in every cargo container (comparison to Object-Oriented Programming: every instance of a class has a unique ID). With the use of UIDs, targetting specific items/magazines/weapons would become possible with the introduction of these commands:
- (object Container) removeMagazine (number/string UID) - return nothing - Alternative syntax of the existing removeMagazine command, designed to work with a specific magazine's UID, which is connected to the cargo container that the item is inside of.
- (object Container) removeItem (number/string UID) - return nothing - Same as above, but with items.
- (object Container) removeWeapon (number/string UID) - return nothing - Same as above, but with weapons. NOTE: doesn't need to work on equipped weapons, as it is already possible to remove a unit's primary/secondary/handgun weapon with this command.
- (object Container) getClassFromUID (number/string UID) - returns string - Return the classname of the inventory item inside the container with specified UID, or "" if the UID wasn't found.
In order for these functions to find any use, the following scripting commands would need to be tweaked to output the UIDs of the inventory items they are iterating through:
- magazinesAmmoFull (object Container)
- magazinesAmmoCargo (object Container)
- weaponsItemsCargo (object Container)
- (object Container) weaponAccessoriesCargo [number WeaponID, number CreatorID] - has been WIP for over 2 years, does this command even have any use?
- soldierMagazines (object Unit)