Forum rules - please read before posting.

Multiple Inventory Items

Hi, I'm working on a 2D game and have some questions about managing multiple inventory items.

  1. Multiple Item Quantity Doesn't Show:
    Here are my settings (https://imgur.com/a/RfYDDIc), and the numbers of the items are not shown. It would be extremely helpful if anyone could point out which part I might have missed.

  2. Updating an Inventory Item's Image:
    For example, let's say cups are multiple items, and if a player adds a cup to the inventory, then the quantity should increase, as well as the image changing from one cup to two cups. Conversely, if a player uses a cup, the image of the cup should change from two cups to one cup. Is there a way to do this directly in Adventure Creator? If not, what are the alternative ways to achieve this?

Thank you so much for your help.

Comments

  • Multiple Item Quantity Doesn't Show

    Are you referring to their display in the Inventory menu? That's controlled with the Display item amounts field in the InventoryBox properties within the Menu Manager.

    If you're using Unity UI, you'll need to attach a Text child component to each slot in the UI prefab - this'll be used to display the counts. Though, the default InventoryUI should have these already.

  • Updating an Inventory Item's Image

    It's possible through the use of custom scripting. A script to handle this can be found on the AC wiki here:

    https://adventure-creator.fandom.com/wiki/Changing_item_graphics_with_amount

  • Thank you so much for your prompt response. It seems odd that the quantity still doesn't display, even though I have set 'Display item amounts' to 'Only If Multiple'. I've confirmed that my inventory item is configured with 'Can carry multiple?' checked, and the quantity is set to 3. However, as shown in the linked image, the quantity number doesn't appear on the inventory. It only shows when the item's 'Select mode' **is set to **'All', displaying a large quantity number in the middle of the item when I drag it from the inventory. (https://imgur.com/a/6aVOUbU)

    Thank you for the link! I followed the instructions on the website to change the graphics of multiple inventory items. One issue I encountered was when I followed the step '... and set the Slot capacity to 1', it did not work as expected. Rather than changing the item's graphic, it displayed three individual items in three separate slots. I'm wondering if this issue could be related to an error in my setup. (However, the script worked fine when the Slot number was set to a value other than 1.)

    Additionally, I have a question regarding the 'Select mode' of my multiple inventory items, which is set to 'Single'. For example, if I have three cups, the inventory displays an image of three cups. When dragging, ideally, it should show only a single cup. With the MultipleItemGraphics script, the inventory correctly displays images of three cups, two cups, and one cup, depending on the quantity. However, when I drag an item, the image dragged reflects the current graphic; for instance, if the quantity is three, it shows an image of three cups, and if it is two, it shows two cups, even though the player is actually dragging one cup. I'm curious if there's a way to modify this so that the dragged image matches the 'Single' select mode. Video: (https://imgur.com/a/PgGtvxt)

    Thank you so much for your time and assistance. I really appreciate it.

  • It only shows when the item's 'Select mode' **is set to **'All', displaying a large quantity number in the middle of the item when I drag it from the inventory

    The "count" display over the selected item is separate to the number shown in the menu - the size/style of this is set under the Inventory cursor panel of the Cursor Manager.

    For the Inventory menu: pause the game when the Inventory menu shows, and check the Inspector for the Text component that should be showing the value at this time - is the number showing there?

    If not, are you using TextMesh Pro, with the TextMeshProIsPresent symbol defined? This'll require all Text components be converted to TextMesh Pro equivalents.

    Thank you for the link! I followed the instructions on the website to change the graphics of multiple inventory items. One issue I encountered was when I followed the step '... and set the Slot capacity to 1',

    It might be a leftover from an older version of the script - I've removed that instruction.

    When dragging, ideally, it should show only a single cup

    I'll attempt a recreation and see what I find.

  • I realized that the 'TextMeshProIsPresent' symbol was defined, but I had been using a regular Text component for the Inventory Menu. After switching to TextMeshPro, the numbers now display correctly in the inspector! Apologies for my inexperience. I didn't realize that I had to use TextMeshPro.

    I'll attempt a recreation and see what I find.

    I can't thank you enough how I appreciate your support. Thank you so much!

  • No problem - I've updated the wiki page (both script and instructions).

  • Thank you so much for your help! It works perfectly!

  • Hi, hope you are having a great last week of 2023.

    I've been using this script (https://adventure-creator.fandom.com/wiki/Changing_item_graphics_with_amount) and encountered an issue: When I collect items that are set to be able to carry multiples, it behaves as if the slot capacity is set to 2, even though I've set it to a larger number. When I collect a third item, it appears in another slot with the texture that I've set for 'Min Count 1.' (https://imgur.com/a/Tg3lDV2)

    Has anyone else encountered this problem? Would you have any suggestions on how to fix it? Thank you.

  • edited December 2023

    Is the issue that the item is being split into different slots?

    The wiki script only affects the item graphics - it shouldn't affect where items are placed. Are you encountering this issue if you remove/disable the script?

    I'll need to see screenshots of the item's full properties panel, the InventoryBox element that displays them, and the ActionList that adds the item.

    Are you making use of Inventory properties?

  • Thank you for your prompt response! I've included a link https://imgur.com/a/cMWTaC5 to view the ActionLists, Inventory Box Element, and Inventory item settings. Regarding your last question about 'making use of inventory properties,' could you please provide further clarification? Thank you so much for your help once again.

  • Does the issue still occur after removing the script?

    To be clear: is the issue that you can add one and then two Dandelion Puffs into the same slot (separate Hotspots/interactions), but then the third is moved to a separate slot?

    As a test, temporarily replace your ActionList: Run Actions with Inventory: Add Actions that explicitly add the Dandelion Puff item. What is the behaviour then?

    When is the "ActionList_Remove" asset being run?

  • Thank you for your ongoing support. Regarding your question,

    Does the issue still occur after removing the script?

    when I remove the script, everything works perfectly, and all three items appear in one slot, just as intended.

    To be clear: is the issue that you can add one and then two Dandelion Puffs into the same slot (separate Hotspots/interactions), but then the third is moved to a separate slot?

    Yes, that's precisely the issue I'm facing. In my setup, there are three hotspots, and I've attached three separate interactions to each of these hotspots.
    When I set it up for the player to collect six Dandelion Puffs, they are grouped as three sets of two puffs each in a single slot. (https://imgur.com/a/3BGMRdS)

    As a test, temporarily replace your ActionList: Run Actions with Inventory: Add Actions that explicitly add the Dandelion Puff item. What is the behaviour then?

    I tried this, but unfortunately, the problem persists.

    When is the "ActionList_Remove" asset being run?

    The puff is designed to be given to a character one at a time. Once the dandelion puff is handed over, it's then removed from the inventory.

    I'm wondering if this issue might be specific to my setup. If so, there must be something I'm overlooking on my end.

    Thank you once again for all your help. Wishing you a wonderful New Year's Eve and a Happy New Year in advance!

  • edited December 2023

    Thanks for the details - I've recreated the issue.

    It's not an issue with the wiki script exactly - but the script highlights an issue with AC itself.

    I'll address this in the next release, but in the meantime you should be able to apply a temporary fix by opening up AC's InvInstance script and removing line 1195:

    return false;
    
  • Thank you so much for taking the time to investigate this issue. I'm eagerly looking forward to the new release, as always!

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.