canAdd returns false even when I still have space in my Bergen backpack.
canAdd does not work with any of the new Bergen backpacks
Description
Details
- Severity
- None
- Resolution
- Fixed
- Reproducibility
- Always
- Operating System
- Windows 10 x64
- Category
- Inventory
Set the loadout I used:
player setUnitLoadout [["arifle_ARX_ghex_F","muzzle_snds_65_TI_blk_F","","optic_Hamr",["30Rnd_65x39_caseless_green",30],[],""],[],[],["U_B_survival_uniform","FirstAidKit",5],["V_PlateCarrier2_tna_F","30Rnd_65x39_caseless_green",14,30],["B_Bergen_hex_F","30Rnd_65x39_caseless_green",29,30],"H_CrewHelmetHeli_O","G_Combat",[],["ItemMap","B_UavTerminal","ItemRadio","ItemCompass","ItemWatch","NVGoggles"]];
After that check your inventory and you will realize that there is still space for some more "30Rnd_65x39_caseless_green".
Now check in debug:
player canAdd "30Rnd_65x39_caseless_green"
will return false
Event Timeline
Hello,
are you sure you have everything is okay with the first script you used for filling your loadout seems to add only weapon, helmet and some accessories, uniform vest and backpack are not added with the script and thus canAdd would return false since you do not have a backpack.
I have tried editing the loadout in arsenal in Editor, leaving space for the magazines only in the Bergen backpack and canAdd returned true.
Again my loadout, hopfully i did not fked it up this time:
player setUnitLoadout [["arifle_ARX_ghex_F","muzzle_snds_65_TI_blk_F","","optic_Hamr",["30Rnd_65x39_caseless_green",30],[],""],[],[],["U_B_survival_uniform",[["FirstAidKit",5]]],["V_PlateCarrier2_tna_F",[["30Rnd_65x39_caseless_green",12,30]]],["B_Bergen_hex_F",[["30Rnd_65x39_caseless_green",48,30]]],"H_CrewHelmetHeli_O","G_Combat",[],["ItemMap","B_UavTerminal","ItemRadio","ItemCompass","ItemWatch","NVGoggles"]];
And I just realized that the bug doesn't occur when my Character is wearing the Bergen backpack. The bug occurs when my inventory is full and then I shoot some magazines and after that, I try the command and it will show false.
I just captured the process with Plays.Tv
http://plays.tv/video/58090e7244bf46e92d/inventory-bug-arma3
You can see when I open the Debug for the first time, yeah I know quite a short period of time you probably need to pause the video there, that I can't add more mags. Then I shoot some mags and after that, i check my inventory where you can see that there is enough space for more mags in my vest. Then I reopen the debug where you can see that I am still unable to add more mags. Then I move 1 mag from the backpack to the Vest.
After that, i am able to add more mags, but only as much as is moved from the backpack into the vest.
I can confirm that I am experiencing similar issues with this command, as well as canAddToUniform, canAddToVest, and canAddToBackpack. I am unsure of the cause, and I can confirm that it is not only an issue with the Bergen backpack. It seems to report inaccurate results for other clothing items as well. I read another feedback ticket regarding a similar issue as well, which you can see here: https://feedback.bistudio.com/T85789. I hope that there will be an update to this issue sometime soon as I would love to be able to use these commands.
Notes
dystopian 01:38
@dedmen, canAdd takes load player into account and if load == 1 it returns false. @Blutze is absolutely right about max mass (loadAbs player). This is already reported in other ticket https://feedback.bistudio.com/T120627#1517538 and rerpo is done in that comment. Even razazel was able to reproduce the issue.
I think it was done for stamina accounting. And I think you won't be able to fix canAdd command because it would probably break some stamina-based missions.
All you probably can is to add new command, something like hasSpace
dystopian 02:26
I found solution :slightly_smiling_face: Instead of canAdd we should use getContainerMaxLoad uniform player >= (getContainerMaxLoad uniform player * loadUniform player) + getNumber (configFile>>"CfgWeapons">> _type >>"ItemInfo">>"mass") for each uniform/vest/backpack (edited)