Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

"Give" instead of "use"

Hi! Is there any way to automatically override the "use" suffix with "give" when the player tries to combine an inventory object with an NPC? It seems that the interaction is set before you click an hotspot; any way to change "use to" in "give to" with single-interaction mode, only when the cursor is over a NPC? I've see an example of this behaviour in the game "Virtuaverse". Thanx!

Comments

  • Depending on your Settings Manager's Interaction settings, the option to choose between Use vs Give will be shown when defining a Hotspot Inventory Interaction when an NPC component is either attached or a parent.

    What are your settings, and AC version? It should also be possible to have a custom script apply this should your current settings not allow for it by default.

  • Hello Chris,
    I'm using the interaction method "Choose hotspot then interaction"; i've already tried the option "Give"/"use" that is showed when i create e new hotspot inventory interaction, it's useful to handle "use" and "give" interactions, but not seems to have effect on the hotspot/cursor label when the mouse cursor is over an NPC: if i use the "Single" option in Inventory Interaction i cannot display the "Give" suffix in the hotspot label instead of "Use"... Maybe i need a custom script?

  • I'm sorry, but I do need more information - including your AC version. Can you share a screenshot of your full Settings Manager?

    Here is a script that you can attach to a Hotspot to force the selected item into "give" mode. I cannot be sure it'll work without knowing your full settings, however.

    using UnityEngine;
    using AC;
    
    public class AutoGive : MonoBehaviour
    {
    
        private void OnEnable ()
        {
            EventManager.OnHotspotSelect += OnSelect;
            EventManager.OnHotspotDeselect += OnDeselect;
        }
    
        private void OnDisable ()
        {
            EventManager.OnHotspotSelect -= OnSelect;
            EventManager.OnHotspotDeselect -= OnDeselect;
        }
    
        private void OnSelect (Hotspot hotspot)
        {
            if (hotspot == GetComponent <Hotspot>())
            {
                if (InvInstance.IsValid (KickStarter.runtimeInventory.SelectedInstance))
                {
                    KickStarter.runtimeInventory.SelectedInstance.SelectItemMode = SelectItemMode.Give;
                }
            }
        }
    
        private void OnDeselect (Hotspot hotspot)
        {
            if (hotspot == GetComponent <Hotspot>())
            {
                if (InvInstance.IsValid (KickStarter.runtimeInventory.SelectedInstance))
                {
                    KickStarter.runtimeInventory.SelectedInstance.SelectItemMode = SelectItemMode.Use;
                }
            }
        }
    
    }
    
  • Thank you Chris, this worked perfectly; i've attached the script to the NPC hotspot and now every object i move over him says "GIVE" instead of "USE". Also work with multiple interaction inventory mode. My version of AC is 1.73, here a screenshoot of my settings, but your script already worked like a charm!

    settings: https://ibb.co/hMjkRDY

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.