Forum rules - please read before posting.

Container issues

edited September 2022 in Technical Q&A

I have a container (foodDrawer) with a limited number of slots (8), and AC is configured to allow item reordering.

I've noticed two issues:

(1) foodDrawer.Add(1, 10); will not add 10 units of item #1 to existing item #1 stacks in the container. It will add them to an empty slot. This is not an issue unless the slots are already taken; then those 10 units simply aren't added.

(2) I tried to circumvent this with the following code:

int x = foodDrawer.GetCount(1);
foodDrawer.Add(1, x + 10);

But this doesn't work because Add doesn't actually look for empty slots in the container; it checks if the last slot is taken, and if it is, the addition is denied, even if we've just emptied one of the previous slots with Remove. In fact, all the other seven slots could be completely empty: as long as the 8th one is taken, you can't add anything to the container with Add.

I'm assuming this is a bug and not the intended behaviour?


  • What's your AC version?

    The Add function is really just shorthand for the Add function in its InvCollection instance, and this should check for both empty slots and those that match the item being added.

    Lets see the properties of the item being added, as well as your Settings Manager.

  • You're right, (1) is not a problem at all. AC does look for a stack first and adds the units to it. My mistake.

    (2) persists though. As long as there is an item in the last slot of the container, even if all the other slots are free, even if it's the same stackable item as the one you're adding, the addition will not occur.

    AC 1.75.6
    Unity 2021.2.7f1

  • Recreated, thanks for the details.

  • A fix shall be included in the upcoming update.

  • edited September 2022

    Thanks, Chris!

    Now AC correctly checks all slots for empty ones before denying or allowing the addition. I still notice one little problem though:

    It seems that when you add an item, AC checks for empty slots first. If false, it denies the addition. If true, it looks for incomplete stacks. If true, it adds the items to the incomplete stack; else, it adds the items to an empty slot. The problem is that if you have no empty slots, but there's still room in a stack, the addition doesn't occur, which I don't think is the desired behaviour?

  • Is this through code, or placing an item in there with the cursor?

  • This is through code or using the Container > Add/Remove action. Placing an item in there with the cursor works fine because my custom inventory script adds the items to the specific index slot.

  • Thank you, recreated.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.