Forum rules - please read before posting.

design question of showing a document in inventory

Hi, I have a document in inventory. It now works so that player selects the document for view by clicking inventory button and then a 3d object of a general document is shown in the middle of the screen. Then player has to click the 3d object in order to open a menu view with actual document content. Then player has to click the menu for the document to become read. Then player can select pen for use to sign the document. This is way too cumbersome.

But what I actually need is a document setup that I could have a 2d view to set a document, but would really like to be able to animate pen in front of it when signing it. And also to have it more usable.

Or would a setup where documents are stored in journal menu system - together with game guide and hints - and have a ingame inventory enabled, so player could use inventory objects with them?

Comments

  • edited August 2021

    To use an inventory item on something in a menu, the element you click on either has to be another item (which can open a Document with the Document: Open Action), or be handled through a custom script (hooking into the OnMenuElementClick event).

    To have an animated pen appear as part of your Menu, you'll want to use a Unity UI-based Menu, and attach an Animator in its Hierarchy to animate a pen in your intended way. You can then use the Object: Animate Action to play back that animation when desired.

    If you can share screenshots / mockups that show what you want the exact process for the Player to be, I can try to offer my thoughts on how you'd go about it.

  • Here's the current flow:
    Player has selected doc from upper menu
    1 https://imgur.com/pzfi8ad
    He clicks hotspot on the doc and menu opens
    2 https://imgur.com/n46FqBu
    He clicks menu - just one big button - and read it - objective marked read
    3 https://imgur.com/eDTywTV
    player right clicks pen and clicks it for use
    4 https://imgur.com/lO8evNG
    He click prefab with use-pen
    5 https://imgur.com/4PfXiKs
    And doc objective marked signed

    After some though and chat with the testers I thought that the document menu opens when a document is selected would be good. And pen animation in front of the menu would probably require another camera and it would cause more complexity, so it could be discarded. So the inventory item button should select the item and open a menu - this is easy. But how could I get the menu to react on selected inventory item?

  • edited August 2021

    You can hook into the OnMenuElementClick custom event to run custom code when a particular Button element is clicked on, and check if a particular inventory item is selected at that time:

    using UnityEngine;
    using AC;
    
    public class UseItemOnMenuButton : MonoBehaviour
    {
    
        public string menuName;
        public string buttonName;
        public string itemName;
        public ActionListAsset actionListAsset;
    
        private void OnEnable () { EventManager.OnMenuElementClick += OnMenuElementClick; }
        private void OnDisable () { EventManager.OnMenuElementClick -= OnMenuElementClick; }
    
        private void OnMenuElementClick (AC.Menu menu, MenuElement element, int slot, int buttonPressed)
        {
            if (menu.title == menuName &&
                element.title == buttonName &&
                KickStarter.runtimeInventory.SelectedItem != null &&
                KickStarter.runtimeInventory.SelectedItem.label == itemName)
            {
                // Item was used on menu element
                actionListAsset.Interact ();
            }
        }
    
    }
    
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.