Arma 3 Scripting

Command in Unit Inventory

addBackpackGlobal

Also available as Markdown and JSON, or read the original wiki page.

Description

Adds a backpack to a unit - global variant of addBackpack.

Warning

The backpack added with this command will be created on the PC local to the unit you are adding it to, even if executed on the server. Because of this, if non-local unit is the target and one tries to immediately access added backpack, the backpack returned will be null. When adding backpack dynamically to a remote unit, wait until the backpack is added (See #Example 2).

Syntax

unit addBackpackGlobal backpack

Parameters:

Returns: Nothing

Examples

Example 1

player addBackpackGlobal "B_AssaultPack_khk";

Example 2

_unit spawn 
{
    if (not isNull backpackContainer _this) then
    {
        removeBackpackGlobal _this;
        waitUntil { sleep 0.01; isNull backpackContainer _this };
    };

    _this addBackpackGlobal "B_AssaultPack_khk";
    waitUntil { sleep 0.01; not isNull backpackContainer _this };
    backpackContainer _this addMagazineCargoGlobal ["30Rnd_556x45_Stanag", 5];
};

See also

addBackpack · backpackContainer · firstBackpack · unitBackpack · backpack · backpackCargo · getBackpackCargo · backpackItems · addBackpackCargo · addBackpackCargoGlobal · removeBackpack · clearBackpackCargo · clearBackpackCargoGlobal · clearAllItemsFromBackpack · loadBackpack · backpackSpaceFor · canAddItemToBackpack · addItemToBackpack · removeItemFromBackpack · everyBackpack