addBackpackGlobal: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(description)
m (Text replacement - "\|x([0-9])= *<code>([^<]*)<\/code>" to "|x$1= <sqf>$2</sqf>")
 
(88 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma 3 |= Game name
|game1= arma3
|arg= global|=
|version1= 1.32
|eff= global|=
|1.32|= Game version
____________________________________________________________________________________________


| Adds a backpack to a unit (even non-local) |= Description
|arg= global
____________________________________________________________________________________________


| unit '''addBackpackGlobal''' backpack|= Syntax
|eff= global


|p1= unit: [[Object]] - soldier |= Parameter 1
|gr1= Unit Inventory
|p2= backpack: [[String]] - backpack class name |= Parameter 2


| [[Nothing]] |= Return value
|descr= Adds a backpack to a unit (even non-local).{{Feature | Warning | Beware, the backpack added with this command will be created on the PC [[Multiplayer Scripting#Locality|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 [[objNull | Null]]. When adding backpack dynamically to a remote unit, wait until backpack is added (See Example 2)}}
____________________________________________________________________________________________
 
|x1= <code>[[player]] [[addBackpackGlobal]] "B_AssaultPack_khk";</code> |= Example 1


____________________________________________________________________________________________
|s1= unit [[addBackpackGlobal]] backpack


| [[addBackpack]], [[backpackContainer]], [[firstBackpack]], [[unitBackpack]], [[backpack]], [[backpackCargo]], [[getBackpackCargo]], [[backpackItems]], [[addBackpackCargo]], [[addBackpackCargoGlobal]], [[removeBackpack]], [[clearBackpackCargo]], [[clearBackpackCargoGlobal]], [[clearAllItemsFromBackpack]], [[loadBackpack]], [[backpackSpaceFor]], [[canAddItemToBackpack]], [[addItemToBackpack]], [[removeItemFromBackpack]], [[everyBackpack]]|= See also
|p1= unit: [[Object]] - soldier


}}
|p2= backpack: [[String]] - backpack class name


<h3 style="display:none">Notes</h3>
|r1= [[Nothing]]
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>


<h3 style="display:none">Bottom Section</h3>
|x1= <sqf>player addBackpackGlobal "B_AssaultPack_khk";</sqf>


|x2= <sqf>_unit spawn
{
if (!isNull backpackContainer _this) then
{
removeBackpackGlobal _this;
waitUntil { isNull backpackContainer _this };
};
_this addBackpackGlobal "B_AssaultPack_khk";
waitUntil { !isNull backpackContainer _this };
backpackContainer _this addMagazineCargoGlobal ["30Rnd_556x45_Stanag",5];
};</sqf>


[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
|seealso= [[addBackpack]] [[backpackContainer]] [[firstBackpack]] [[unitBackpack]] [[backpack]] [[backpackCargo]] [[getBackpackCargo]] [[backpackItems]] [[addBackpackCargo]] [[addBackpackCargoGlobal]] [[removeBackpack]] [[clearBackpackCargo]] [[clearBackpackCargoGlobal]] [[clearAllItemsFromBackpack]] [[loadBackpack]] [[backpackSpaceFor]] [[canAddItemToBackpack]] [[addItemToBackpack]] [[removeItemFromBackpack]] [[everyBackpack]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
}}

Latest revision as of 11:21, 13 May 2022

Hover & click on the images for description

Description

Description:
Adds a backpack to a unit (even non-local).
Beware, 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 backpack is added (See Example 2)
Groups:
Unit Inventory

Syntax

Syntax:
unit addBackpackGlobal backpack
Parameters:
unit: Object - soldier
backpack: String - backpack class name
Return Value:
Nothing

Examples

Example 1:
player addBackpackGlobal "B_AssaultPack_khk";
Example 2:

Additional Information

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

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note