Page MenuHomeFeedback Tracker

canAddXXXX commands don't actually do what they claim
Feedback, NormalPublic

Description

As in canAddItemToUniform, canAddItemToVest and canAddItemToBackpack.

For example:
https://community.bistudio.com/wiki/canAddItemToBackpack
"Checks if given object can be stored into soldier's backpack."

So one would assume this means that it returns true until given item actually can't fit, but no.
The commands also return false when soldiers whole capacity is full even if the checked container still has plenty of room in it.

So howsabout either removing the overall load aspect from these commands, or add additional syntax to disregard the overall load?
As in

player canAddItemToBackpack ["30Rnd_65x39_caseless_mag", true]; //uses backpacks actual maximumload and doesn't care about soldiers load

Details

Severity
None
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
Engine
Steps To Reproduce
  • add this loadout to player
player setUnitLoadout [["arifle_MX_ACO_pointer_F","","acc_pointer_IR","optic_Aco",["30Rnd_65x39_caseless_mag",30],[],""],[],["hgun_P07_F","","","",["16Rnd_9x21_Mag",16],[],""],["U_B_CombatUniform_mcam",[["30Rnd_65x39_caseless_mag",4,30]]],["V_PlateCarrier1_rgr",[["30Rnd_65x39_caseless_mag",14,30]]],["B_Bergen_dgtl_F",[]],"H_HelmetB","",[],["ItemMap","","ItemRadio","ItemCompass","ItemWatch","NVGoggles"]]
  • go to arsenal and observe how you can add 48 30rnd 6.9 STANAG magazines into the backpack. Which makes sense because magazine mass is 10 and backpack maxload is 480
  • empty backpack and return to game
  • run following code:
private _i = 0;

while {true} do {
	if (player canAddItemToBackpack "30Rnd_65x39_caseless_mag") then {
		player addItemToBackpack "30Rnd_65x39_caseless_mag";
		_i = _i + 1;
	} else {
		break;
	};
};
_i
  • count ends at 40
  • open inventory: players overall load is full but plenty of space in backpack
Additional Information

For old plain canAdd makes sense using soldiers full load.

Event Timeline

h- created this task.Jan 4 2024, 6:06 PM
h- updated the task description. (Show Details)Jan 5 2024, 7:38 AM
Leopard20 set Ref Ticket to AIII-56175.Jan 6 2024, 8:45 PM
kju-PvPscene added a comment.EditedJan 7 2024, 9:33 AM

Note that this about the maxSoldierLoad limit (see https://community.bistudio.com/wiki/Arma_3:_Stamina#Functionality)

Via scripting commands you can add more stuff to unit containers as long as their limit is not reached - aka maxSoldierLoad is ignored

This request is asking canAddXXX to support ignoring the maxSoldierLoad limit too to be able to check what can be added via scripting commands

class CfgInventoryGlobalVariable
{
	maxSoldierLoad = 1000;
};

Revision: 151252

BIS_fnc_KK changed the task status from New to Feedback.Jan 8 2024, 12:57 AM
h- added a comment.Jan 13 2024, 5:46 AM

New alt syntax seems to be working. 👍
Thanks.