{"name":"addBackpackGlobal","operator":null,"title":"addBackpackGlobal","type":"command","url":"https://community.bistudio.com/wiki/addBackpackGlobal","revid":369079,"updated":"2024-09-02T20:35:57Z","groups":["Unit Inventory"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.32"}],"since":{"game":"arma3","name":"Arma 3","version":"1.32"},"arma3_since":"1.32","branch":null,"locality":{"argument":"global","effect":"global","server_exec":false},"exec":null,"description":"Adds a backpack to a unit - global variant of addBackpack.\n\n> [!WARNING]\n> 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.\n> Because of this, if non-local unit is the target and one tries to immediately access added backpack, the backpack returned will be null.\n> When adding backpack dynamically to a remote unit, wait until the backpack is added (See #Example 2).","syntaxes":[{"syntax":"unit addBackpackGlobal backpack","since":null,"effect":null,"exec":null,"params":[{"name":"unit","type":"Object","optional":false,"default":null,"description":"soldier","types":["Object"],"since":null,"text":"unit: Object - soldier"},{"name":"backpack","type":"String","optional":false,"default":null,"description":"backpack class name","types":["String"],"since":null,"text":"backpack: String - backpack class name"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"unit","types":["Object"]},"right":{"text":"backpack","types":["String"]}}],"examples":[{"text":"```sqf\nplayer addBackpackGlobal \"B_AssaultPack_khk\";\n```","code":["player addBackpackGlobal \"B_AssaultPack_khk\";"]},{"text":"```sqf\n_unit spawn \n{\n    if (not isNull backpackContainer _this) then\n    {\n        removeBackpackGlobal _this;\n        waitUntil { sleep 0.01; isNull backpackContainer _this };\n    };\n\n    _this addBackpackGlobal \"B_AssaultPack_khk\";\n    waitUntil { sleep 0.01; not isNull backpackContainer _this };\n    backpackContainer _this addMagazineCargoGlobal [\"30Rnd_556x45_Stanag\", 5];\n};\n```","code":["_unit spawn \n{\n\tif (not isNull backpackContainer _this) then\n\t{\n\t\tremoveBackpackGlobal _this;\n\t\twaitUntil { sleep 0.01; isNull backpackContainer _this };\n\t};\n\n\t_this addBackpackGlobal \"B_AssaultPack_khk\";\n\twaitUntil { sleep 0.01; not isNull backpackContainer _this };\n\tbackpackContainer _this addMagazineCargoGlobal [\"30Rnd_556x45_Stanag\", 5];\n};"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["addBackpack","backpackContainer","firstBackpack","unitBackpack","backpack","backpackCargo","getBackpackCargo","backpackItems","addBackpackCargo","addBackpackCargoGlobal","removeBackpack","clearBackpackCargo","clearBackpackCargoGlobal","clearAllItemsFromBackpack","loadBackpack","backpackSpaceFor","canAddItemToBackpack","addItemToBackpack","removeItemFromBackpack","everyBackpack"],"notes":[],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Unit Inventory","Introduced with Arma 3 version 1.32","Scripting Commands","Scripting Commands: Global Effect"]}