Description
Checks if given object can be stored into soldier's backpack.
Important
Avoid passing an empty string "" to this command as it will create a warning dialog:
This message will show once per mission restart.
Syntax
Syntax 1
unit canAddItemToBackpack item
Parameters:
Returns: Boolean
Syntax 2
since arma3 1.56
unit canAddItemToBackpack [item, count, ignoreSoldierMaxLoad]
Parameters:
Returns: Boolean
Examples
Example 1
if (player canAddItemToBackpack "HandGrenade") then { player addItemToBackpack _item } else { hint "no room!" };
See also
canAdd · canAddItemToUniform · canAddItemToVest · backpackContainer · firstBackpack · unitBackpack · backpack · backpackCargo · getBackpackCargo · backpackItems · addBackpack · addBackpackCargo · addBackpackCargoGlobal · removeBackpack · clearBackpackCargo · clearBackpackCargoGlobal · clearAllItemsFromBackpack · loadBackpack · backpackSpaceFor · addItemToBackpack · removeItemFromBackpack · everyBackpack
This command is very unreliable, along with all other canAdd commands. For example, in the inventory screen, an empty "B_Bergen_dgtl_F" backpack can fit a total of 30 "5Rnd_127x108_APDS_Mag" mags. However, player canAddItemToBackpack "5Rnd_127x108_APDS_Mag" starts returning false once there are 17 in the backpack. Furthermore, if the player has equipped an empty PCML launcher (without any missile in his inventory), the command starts returning false once there are only 11, despite the fact that the launcher has no effect on backpack space...
I wrote a function almost 9 years ago to bypass this (surprisingly still existing) bug. You can check it here, with a usage example here.