Forum rules - please read before posting.

Return To Monkey Island Interaction System

Hi there,

I've recently played Ron Gilbert's Return To Monkey Island and I've noticed that the way they designed their interaction system completely gets rid of traditional player verbs as they are almost exclusively relying on context sensitive tooltips per Hotspot.

Our team has been discussing adopting a similar system as it's much more modern and in our opinion also great for additional storytelling.

Now the way I understand this works is that they completely get rid of different types of interactions and just put whatever action they need on the left and right mouse button.

Additionally, these context sensitive tooltips change over time depending on whether you interact with something for the first time or not.

I was wondering if anyone had already tried building such a system with adventure creator and could give us some pointers!

In case anyone doesn't know what I'm talking about, here is a short clip showcasing the system in action:

Best,
ACV

Comments

  • edited April 15

    If it essentially controls the same as Context Sensitive mode, i.e. left-click is one interaction, right-click is another, then it might just be a case of having to rely on a bit of scripting to control the appearance of a Menu that shows when a Hotspot is selected.

    The sentences that appear would probably be best stored in a second custom script, one that's attached per-Hotspot to store this text as strings. The Menu script could then read these for the associated Hotspot and display them.

    If you use Unity UI for a Menu that is set to appear On Hotspot, you can attach a script that gets the current Hotspot with:

    AC.KickStarter.playerInteraction.GetActiveHotspot ()
    

    And then style the UI components as necessary. The functions available to read within Hotspot can be found in the Scripting Guide.

  • Thank you, Chris!

    If it essentially controls the same as Context Sensitive mode, i.e. left-click is one interaction, right-click is another

    This is the part I am not sure about. If you were to categorize the actions, I’ve noticed cases where both examine and interact have been on either mouse button. There is never more than two actions at the same time going on so I suppose we could simply divide it between actions where the character physically needs to interact with the hotspot (e.g. left click) and those where the character simply has something to say about it (e.g. right click)?

    Also, if it is the case of transforming the tooltip after having interacted one or multiple times with a hotspot, I assume that I would simply store an array of strings for each hotspot and just change the logic to display the next in line after having interacted once/multiple times?

  • Context Sensitive would get you a decent approximation, but if you need more control over which is left, which is right, then you'd need to rely on Custom Script mode for your chosen Interaction method.

    In this mode, how Hotspots are interacted with is left to custom scripting. You can still define your Interactions within Hotspots as normal, and Hotspots will still be detected according to the Hotspot detection method field. Your custom script can then access the currently-selected Hotspot with:

    AC.KickStarter.playerInteraction.GetActiveHotspot ()
    

    A Menu with an Appear type set to On Hotspot will also turn on automatically when a Hotspt is selected. You'd likely attach your script to this Menu's UI prefab so that you can configure it's appearance, and control input, only when it's showing.

    To run a Hotspot's "Use" interaction through script, call its RunUseInteraction method. You can get a full list of available functions in the Hotspot class in the Scripting Guide.

    Also, if it is the case of transforming the tooltip after having interacted one or multiple times with a hotspot, I assume that I would simply store an array of strings for each hotspot and just change the logic to display the next in line after having interacted once/multiple times?

    Right. You'd need to store the "default" sentence in the custom script I mentioned, attached to the Hotspot, so this could be an array of strings instead. You could automate the returning of which string is shown by having it record how many times the Interaction has been run. This can be done by having it hook into the OnHotspotInteract custom event, and checking if the Hotspot's first-found Use interaction was run.

    Something like:

    using UnityEngine;
    using AC;
    
    public class CustomHotspotLabel : MonoBehaviour
    {
    
        public string[] labels;
        int currentIndex;
    
        // Subscribe to the OnHotspotInteract event
        void OnEnable () => EventManager.OnHotspotInteract += OnHotspotInteract;
    
        // Unsubscribe from the OnHotspotInteract event
        void OnDisable () => EventManager.OnHotspotInteract -= OnHotspotInteract;
    
        public string GetLabel ()
        {
            return labels[currentIndex];
        }
    
        void OnHotspotInteract (Hotspot hotspot, AC.Button button)
        {
            if (hotspot.gameObject == this && button == hotspot.GetFirstUseButton ())
            {
                // The Hotspot's first-defined Use interaction was run
                currentIndex ++;
                if (currentIndex >= labels.Length) currentIndex = labels.Length - 1;
            }
        }
    
    }
    
  • I see, so to confirm, I'd essentially use a setup like this:

    1. A script that makes a menu appear when I am hovering over a hotspot (most likely attached to my Menu UI prefab.
    2. A script that stores and retrieves the individual labels for each hotspot (1 per hotspot), sending them to my UI script.

    In terms of the logic of which label to display, is it possible for me to tap into the variables manager of AC when writing C# code? I could imagine certain situations where hotspot labels should change based on certain conditions the player has to fulfill throughout the game but since this happens essentially on a case by case basis, I am having trouble finding a streamlined system. I suppose I could use a scriptable object with certain lables in the array having an additional "variable condition slot" that I could then connect to the variables manager?

  • The Menu would appear automatically. The setup would more like:

    1. A script attached to the UI prefab that configures its appearance based on the active Hotspot
    2. A script that stores individual Hotspot labels, which the 1st script retrieves from it

    is it possible for me to tap into the variables manager of AC when writing C# code?

    Absolutely. See both the Manual's "Variable scripting" chapter, and the front page of the Scripting Guide for details.

  • Thank you for clarifying, Chris!

  • I got everything up and running - Hotspots in my scene can now be assigned custom labels which I can rotate through and have them react towards different game states.

    I did notice, however, that I'm unable to assign my Array Entries to Items which makes sense since they are not part of the scene. What would you propose in this case? Create scriptable objects that hold my data and have my Controller script check whether I'm hovering over an item/regular hotspot and only read the data from an SO if it is an item?

  • You can assign the data either as a prefab, or a SO.

    To do it as a prefab, attach it in the Item's Linked item prefab field.

    You can get the currently-hovered item's prefab with:

    KickStarter.runtimeInventory.hoverItem.linkedPrefab
    

    To assign a SO, create a Unity Object property in the Inventory Manager's Properties tab, named e.g. "Label array", and then assign the SO in each Item's Properties section.

    Your script would need refer to the property ID (default is 0) and then cast this into the SO's type:

    KickStarter.runtimeInventory.hoverItem.GetProperty (0).UnityObjectValue as LabelArray;
    
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.