Forum rules - please read before posting.

ingame inventory

I have an inventory in which player can view and use items with each other, but the player now has to be inside the inventory to select object for use and I find that this is clumsy.

I want to have a ingame inventory for player to select things to use on hotspots. The problem is that I also have an inventory that has slightly different graphics. I would like to keep the "real" inventory as it is, but would like to have an ingame inventory with the use cursor images of the item and when player clicks one the cursor changes and item is selected.

«1

Comments

  • Can you elaborate on what the difference would be with an "ingame" inventory vs a regular one? Any screenshots or mockup images you can share to explain the issue will help clarify the situation.

    What are your Interface settings set to, also?

  • Here is the inventory - there's the ingame inventory menu on - just ignore it:
    https://imgur.com/iiY3WtL
    and here ingame - ingame menu is on top right and there's also an example image of cursor image:
    https://imgur.com/8codTWG

    All of the inventory items have main graphics, selected graphics (not used - and not sure if ever used) and cursor images.

  • To be clear, then: is the issue that the item icons should use the "cursor textures" instead of their regular ones?

    From the one cursor image I can see, it looks like the cursor image is just the regular image with a circle around it. If your menu uses Unity UI, it may be possible to achieve a similar look just by using a UI Mask component to mask out a circle over the original texture.

    Otherwise, it should be possible to rely on a custom script that displays each item's cursor texture instead of their regular one - but again, this'll require Unity UI. Is this what you're looking to do?

  • Yes, cursor textures instead of regular ones. I'll try with the masks.
    But what about the interactions? Can I just create all interactions in AC game editor and then turn on and off them when changing game state?

  • It's possible to script custom inventory behaviour, but how would the interactions differ to when items are clicked in the "regular" inventory?

  • I already tried that I can turn on and off some interactions and it seems to work with ALs. Ingame inventory is for player to select an item to use it or give it or equip. In "real" inventory player can select an item for closer observation and possible turn it and there are hotspots on the item player can use other item to.

  • Actually, an ability to set in which inventory view an interaction is enabled in item interaction setup would be great.

  • There's still something. Always when I select an object from inventory and use it to hotspot which is expecting it, I first get an "error", but if the Include last selected is on, the interaction starts. Any ideas?

  • If you're looking to select items when clicked in the ingame inventory menu, you don't need to supply a dedicated ActionList for it. Set the InventoryBox element's Inventory box type property to Custom Script, and then use a script to force the selection of items when clicked:

    using UnityEngine;
    using AC;
    
    public class CustomInventory : MonoBehaviour
    {
    
        private void OnEnable () { EventManager.OnMenuElementClick += OnMenuElementClick; }
        private void OnDisable () { EventManager.OnMenuElementClick -= OnMenuElementClick; }
    
        private void OnMenuElementClick (Menu menu, MenuElement element, int slot, int buttonPressed)
        {
            if (menu.title == "InGame" && element.title == "InventoryBox")
            {
                MenuInventoryBox inventoryBox = element as MenuInventoryBox;
                InvInstance clickedItemInstance = inventoryBox.GetInstance (slot);
                if (InvInstance.IsValid (clickedItemInstance))
                {
                    clickedItemInstance.Select ();
                }
            }
        }
    
    }
    

    Always when I select an object from inventory and use it to hotspot which is expecting it, I first get an "error", but if the Include last selected is on, the interaction starts

    If the ActionList is a Hotspot's "Inventory Interaction", you don't need to check the selected item, because it'll only run if a specific item is selected.

    Depending on your settings, an item will become de-selected automatically when used on a Hotspot. Other settings depending, these should be configurable with the Settings Manager's Defined interactions deselect active item? and Unhandled interactions deselect active item? fields.

  • I don't seem to get it to run. Should it run when it's compiled and InventoryBox is set to Custom?

  • Ok, I got it working, but there's the same problem - I got the invalid interaction first and then when I right-click-rotate to use the valid interaction begins. I'm using the Choose Hotspot then Interaction could this cause something?

  • And Cycling Cursor And Clicking Hotspot

  • I got it working with "Inventory interaction", but it leaves a problem that if I select the item and right click away from selection, it leaves it still selected and I would like the selection to go away with cursor cycle. So player has to have an item selected with the cursor in order to initiate the interaction.

  • Can you share screens of your full Settings Manager?

    If Include Inventory items in Hotspot Interaction cycles? is unchecked, you can set Right-click active item to Deselects Item to have a right-click deselect the item.

  • I got it working by removing selected-check from inventory interaction (I just copied it from Use-interaction). I have a hunch that it worked earlier in Use.
    There was/is something weird in my setup at the moment. I just updated project to U2020.3.10f1 and it seems that I get some glitches with AC1.73.8: both side clicks were set to deselect, but they didn't work or the selection was lost straight after selection. I hope this is something temporary.

  • Is this after updating both AC and Unity, or just Unity - and what version(s) were you previously using?

    I will need full details of your settings and steps to reproduce the issue.

  • U2020.3.9.1f and AC1.73.6

  • I updated them at the same time.

  • Neither of those upgrades should have caused item-selection issues. I will need those details and steps in order to recreate the problem.

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.