Forum rules - please read before posting.

About multiple inventory boxes on screen problems and questions.

Unity **2020.3.5f1
**AC:
1.75.0

hi there!

I'm prototyping some gameplay featuring inventory elements and the integrated crafting system.
the idea is that the player has a bunch of items that has to try to match to get results, like some classic Alchemy game type.

1-In order to have the user the feeling of having elements to play with (Like cards), I'm using Reordering and Drag and Drop.
2-Due to that Adventure Creator when Saves the game, doesn't save the position of the items in the inventory boxes, my first and easiest way to work around that is to work with different inventory boxes of item categories. **
3- Due to the need of Adventure Creator to have inventory boxes, crafting elements, and containers (I've still not used the container) in the **same menu to move between them
, All is in the same menu.
4- Most relevant problem is as shown in the video; for some reason when moving items in both inventory boxes, other inventory boxes are **refreshed and change positions. **

-> video of the behaviour here.

So I'll like to ask if, well, first if some of the premises I'm working on are wrong (like, should the order be saved? I could use crafting inputs and inventories in different menus? etc), Is this a bug or the code from AC can't support two inventory boxes in the same menu? (I've not tried the inventory boxes in different menus 'cause I need them in the same menu with the crafting inputs, for example). Is there some fix? I should think about all of this in a different way?

Thanks.

Comments

  • edited May 2022

    BTW.. I'm having problems configuring the correct way the crafting output should work for me. Not sure If I'm doing something contradictory. (using UnityUI)

    When using:
    (On crafting properties)
    -Specific Pattern: On
    -Actionlist on Create: On
    -Actionlist on Click on Result: On
    the Output element: Automatic Result: Off

    Problem is:
    -When I put correct ingredientes on correct slots, "Actionlist on Create" is triggered. (That's unexpected)
    - Strangely, Output item doesn't appear. (as I would think as actionlist on create was triggered, even if unexpectdly)
    - When I click after that on the Create button, Output item appears automatically. (I was expecting Actionlist On Create to trigger here)
    - When I click on the Output, Actionlist on Result is triggered. (I guess that's expected).
    Actionlist set to On Create, is automatically triggered as if Automatic Result should be On instead of Off.

    Edit: Also, Actionlist on Create appears again after the Actionlist on Result has triggered.

  • Due to that Adventure Creator when Saves the game, doesn't save the position of the items in the inventory boxes

    Are you referring to the InventoryBox elements, or the Ingredients Crafting element? The state of the Player's inventory should be saved. Currently, the state of the Crafting box will not be.

    Due to the need of Adventure Creator to have inventory boxes, crafting elements, and containers (I've still not used the container) in the **same menu

    There's no enforced limit to this - the default Inventory bar can be used to place items into the default Crafting menu. If you have steps to recreate an issue, please share.

    for some reason when moving items in both inventory boxes, other inventory boxes are **refreshed and change positions. **

    When sharing the same inventory, this'll be unavoidable despite my efforts to address it. The way around this is to rely on Containers instead.

    InventoryBox elements of the type "Container" can be mapped to a specific Container component either through script, or through use of the Container: Open Action's Open in set element? Action. What you can do is create "global" Containers that exist at all times, and assign these to the intended elements as you open the Menu.

    To create a global Container, see this page (https://adventure-creator.fandom.com/wiki/Creating_a_global_Container) on the AC wiki.

    When I put correct ingredientes on correct slots, "Actionlist on Create" is triggered. (That's unexpected)

    This may be unintended - I will look into it.

    Strangely, Output item doesn't appear.

    As intended - if Result is automatic? is unchecked, then the resulting item will appear only when the Inventory: Crafting Action's Create Recipe Action is run.

    Actionlist set to On Create, is automatically triggered as if Automatic Result should be On instead of Off.

    Can you rephrase this? I'm not clear on your meaning.

  • All right! I was under the complete assumption of the need of having them in the same menu, but I see I do not. Maybe a wrong assumption because fast tests.

    I've remade the menus; 3 menus, 1 crafting, 1 normal inventory box for Category 1 items, and 1 container for Category 2 items.
    **
    The unexpected Output problems have been fixed. It was probably a bug only ocurring when having them on the same menu, maybe with two inventory boxes.**

    About saving the position items on the inventory, I tested again; It saves the order, but not the position.

    Meaning; if I have 30 slots, and 7 items, if I move the first item to the last position (the 30th), and I save, when I load, the item goes to the last position of the maximum items (so is loaded on 7th slot, not 30th slot where I left it.
    (Same for inventory box and container)
    I don't know if there is no code on AC for saving the position or only the order.

    Using containers instead of the inventory set other challenges to the idea of creating this gameplay for several reasons. (As an example, Crafting returns items to inventory instead of containers in the case of use of cancel repeat or saving game with items on the ingredient slots) etc etc. And if in the inventory I only have one category allowed, this gives further problems.

    So it would be nice to know if position in a clear content slot should be saved, or could be implemented, in order to know if I have to do a complete different approach in my gameplay.

  • I will look into the issue of empty slots being removed upon loading a save-file - thanks for the details.

    You will need to rely on Containers to avoid the item-shifting behaviour, however, though the default behaviour of crafted items moving to the Inventory can be overridden through custom scripting.

    Checking Prevent default clicks? in the Output Crafting element's properties will allow click behaviour to be handled solely via the OnMenuElementClick custom event. I will look into improving the API to more easily handle the creation of a given Recipe and move the resulting item into a specific inventory collection (which can include Containers).

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.