Forum rules - please read before posting.

Giving an item a "Standard interactions: Use:" without blocking "Hotspot: Inventory interactions"

If I give an item in my Inventory Menu a "use" interaction, this will make any hotspots where I've added said item as an inventory interaction no longer work.

The behavior I'm hoping for is this: I'm using direct movement.

  • When using an item from my inventory, I'd like to make a quick remark about it.
  • When using the item while standing on a hotspot WITHOUT an inventory interaction, this should still just make the remark (just use the inventory's "use").
  • When standing on a hotspot that happens to have an inventory interaction for this inventory item, I'd like that to override the item's own use interaction and instead do this inventory interaction; currently it seems to do the opposite, the item's use interaction overrides the hotspot inventory interaction.

Comments

  • What's your Interaction method? Is your Inventory box displayed as part of an Interaction menu? Inventory interactions are typically one or the other - they'll either always run an item's interaction, or a Hotspot's.

    To have a hybrid, you'd need a custom script that checks the state of the current Hotspot. Can you share a screenshot of your Inventory menu and Settings Manager?

  • Interaction is direct via keyboard: stand on a hotspot and press space. The inventory box comes up not as part of the interaction, the player stands on the hotspot they wish to use the item on, and then open their inventory and click the item.

    Using an inventory item on a hotspot in this method uses a custom function

    private void OnInventorySelect(InvCollection invCollection, InvInstance invInstance)
        {
            Hotspot[] hotspots = KickStarter.player.hotspotDetector.GetAllDetectedHotspots();
            Hotspot hotspot = hotspots.Length > 0 ? hotspots[0] : null;
            if (hotspot)
            {
                hotspot.RunInventoryInteraction(invInstance);
                Debug.Log("Hotspot at time of item selection: " + hotspot.hotspotName);
            }
            Debug.Log("Item selected " + invInstance.ItemLabel);
        }
    

    Inventory menu and settings manager link

  • To be clear: does the custom function run correctly so long as an item doesn't have a "Use" interaction?

    If so, try checking Prevent interactions? in the InventoryBox element, so that it forces the item selection. It should then just be a case of updating your function to run the item's use interaction if no Hotspot was detected, i.e.:

    else if (invInstance.InvItem.useActionList) invInstance.InvItem.useActionList.Interact ();
    
  • This works, Thanks!

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.