Skip to content

#7345 [CORE] - Items Placed in Bags Don't Always Stack

AdulAdul Member Posts: 2,002
edited December 2013 in BGII:EE Bugs (v1.2.2030)
Sometimes, when placing items in bags (for example lynx stones in gem bags), items of the same type won't stack up.

E.g. you place 2 potions of healing into a bag of holding, then put a leather armor in the same bag, and then put 7 healing potions in it also. Sometimes, when you open up the bag, you will not find a stack of 9 healing potions and a leather armor as expected, but instead a stack of 2 healing potions, a leather armor, and another stack of 7 healing potions.

This issue is not always reproducible - it seems quite random, but it does occur fairly often if you use bags regularly.
Post edited by Troodon80 on

Comments

  • AdulAdul Member Posts: 2,002
    I'm uploading a save where the potions of extra healing inside the potion bag are affected.
  • MitchforkMitchfork Member Posts: 390
    I can confirm this happening in BG2:EE, but have never seen it in BG:EE. It seems like items are only stacked if you put them all in at once. It happens with all of the containers I've been using (Spell Case, Gem Bag, Potion Case).
  • LiamEslerLiamEsler Member Posts: 1,859
    @Gate70 Bug, I'd say :)
  • AdulAdul Member Posts: 2,002
    @Gate70 Great job reproducing the issue! I was unable to in the past, and I also didn't notice it was replicating items. Thanks!
  • PibaroPibaro Member, Translator (NDA) Posts: 2,989
    Items don't always stack in containers too. And when you loot from the ground using the new "diamond" feature, items "never" stack in your inventory.
  • RomulanPaladinRomulanPaladin Member Posts: 188
    Actually, this has to do directly with the "can't steal" flag that some items have, preventing them from being pick pocketed. Each item has a byte that describes if an item is identified, unstealable, and/or stolen.

    Proper stores, when they acquire a new item, strip whatever flags the item has; the byte is set to "01" (the identified property turned on, the other two off).

    Containers do NOT change this flag/byte. Thus, when you put two potions in a container, one with the "01" flag (identified) and another with the "03" flag (identified and unstealable), the container treats them as different items with different stacks in order to preserve the different flag values.
    This is important for containers so that they are capable of carrying two identical items where one is identified and the other one is not.

    The solution would have to be hardcoded; containers would have to be given the ability to remove the unstealable flag from items placed within them OR when items hit a character's inventory.
    Values would have to change thusly:

    Items with a "02" flag would have to be changed to "00"
    "03" --> "01"
    "06" --> "04"
    "07" --> "05"
  • Avenger_teambgAvenger_teambg Member, Developer Posts: 5,862
    This is a 'D' rated bug that happens in the vanilla too. Thanks for the analysis @RomulanPaladin.

    Well, except the item duplication, which (if exists) is a bug.
  • RomulanPaladinRomulanPaladin Member Posts: 188
    To be clear (with the intent of being helpful), @Avenger_teambg, the stack splitting seems directly related to the item duplication bug.

    The item duplication bug is reproducible:

    1) Create two separate stacks of the same item in a container. To do this, a good way would be to first add one item without the can't steal flag, close the container, then add another stack with the can't steal flag. Close your container.

    2) Open your container. Completely remove both stacks of that item from the container simultaneously (it is important to remove them both completely before closing, if you remove only one before closing the container, the bug won't occur). Close the container.

    3) Open the container again. You will notice that one of the stacks remains in the container as if it were never removed. You can remove it again, allowing you to receive an extra stack of that item.

    I'm not sure about the mechanics of this one. My guess is that, when you close the container, it updates the container file with the changes you made in the container interface. Changes that call for the removal of "itemxx" don't stack (it only fires once). So, when you remove multiple "itemxx" entries, only one entry is actually removed.

    I suppose one could change how the store file is updated once the interface closes but, personally, I'd tackle the whole flag situation and kill two birds with one stone.
Sign In or Register to comment.