Page MenuHomeFeedback Tracker

Inventory interaction via scripting commands
New, NormalPublic


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)


Operating System
Windows 7 x64
Operating System Version
Windows 7 Home Premium
Additional Information

It seems that BI has thought of introducing a way to handle inventory items with IDs, as can be seen on the commands weaponAccessoriesCargo and soldierMagazines.

weaponAccessoriesCargo seems to take 2 ID numbers as parameters, however there is no information on what these IDs are, or where to obtain them.
soldierMagazines on the other hand outputs the IDs of the magazines inside a unit's inventory. The resulting array will have entries such as:
["6.5 mm 30Rnd STANAG Mag(30/30)[id/cr:10002981/0](9x)
where id/cr:10002981/0 may be the ID of the stack of 6.5mm magazines.

While this shows that multiple items can be bundled as one ID if they are similar (all 9x magazines are full), there still isn't a way to interact with this stack in particular (e.g. remove exactly one magazine from it). The suggested scripting commands would eliminate this problem by giving users more control over what they can remove. This is especially helpful for the removal of weapons with specific attachments, while keeping other instances of the same weapon that have different attachments, because there is also no command to add a weapon with desired attachments.

Event Timeline

Cre8or created this task.May 9 2017, 12:26 AM
Jaffa added a subscriber: Jaffa.Jan 14 2019, 5:09 PM

Please consider this Bohemia. This is long overdue.