Forum rules - please read before posting.

Exploring hotspots during dialog

Hey abventure creators! What would be the best practice to enable the player to explore hotspot names (but not being able to click them) during dialogs/speech.

Am I missing a more elegant approach opposed to disabling the input manually in every dialog actionlist?

Comments

  • As in, be able to mouse-over the screen to reveal Hotspot labels, without being able to click on them?

    Such labels aren't shown during dialog by default - have you enabled the Allow regular gameplay during Conversations? option?

    Probably the best way is to use an input override script that prevents use of the InteractionA input when the mouse is over a Hotspot and some other condition is met (e.g. during a conversation). The Manual's "Remapping inputs" chapter covers this concept.

    What's the exact approach - screenshots if possible - that you're taking now, and what are the conditions for which such a script should kick in? For example, when an ActionList with a given tag is running?

  • As always thanks for your quick response, Chris!

    Yes, that is exactly the intention.

    We were at two conventions with our game demo and we noticed that a surprisingly high number of players wanted to have the possibility to search the scene while listening to dialog.

    To be honest the only solution I have so far would be the option you mentioned above and manually disabling movement and the hotspot interactions during the conversation. (still noobish at C# but I'm learning ;))

    Your idea to tag an actionlist to have a script kick in sounds great! It would need to disable InteractionA over hotspots and also disable player movement if AC would need to be set to allow regular gameplay during conversations.
  • Something like this should do it. You'll need to define a Tag in its Inspector that will cause it to kick in when an ActionList with the same Tag is run.

    using UnityEngine;
    using AC;
    
    public class InteractionBlocker : MonoBehaviour
    {
    
        public string tag;
        bool disabledInteractions;
    
        void OnEnable ()
        {
            EventManager.OnBeginActionList += OnBeginActionList;
        }
    
        void OnDisable ()
        {
            EventManager.OnBeginActionList -= OnBeginActionList;
        }
    
        void Start ()
        {
            KickStarter.playerInput.InputGetMouseButtonDownDelegate = InputGetMouseButtonDown;
        }
    
        void OnBeginActionList (ActionList actionList, ActionListAsset actionListAsset, int startingIndex, bool isSkipping)
        {
            if (actionList.gameObject.CompareTag (tag))
            {
                DisableInteractions ();
            }
        }
    
        void Update ()
        {
            if (!KickStarter.actionListManager.IsGameplayBlocked () && KickStarter.playerInput.activeConversation == null && disabledInteractions)
            {
                EnableInteractions ();
            }
        }
    
        bool InputGetMouseButtonDown (int button)
        {
            if (disabledInteractions && KickStarter.playerInteraction.GetActiveHotspot ())
            {
                return false;
            }
            return Input.GetMouseButtonDown (button);
        }
    
        void EnableInteractions ()
        {
            disabledInteractions = false;
            KickStarter.stateHandler.SetMovementSystem (true);
            Debug.Log ("Enabling interactions");
        }
    
        void DisableInteractions ()
        {
            disabledInteractions = true;
            KickStarter.stateHandler.SetMovementSystem (false);
            Debug.Log ("Disabling interactions");
        }
    
    }
    
  • Thanks alot for checking it out, Chris! I will try it out later when I am back home!

  • I got it to work! Thanks alot Chris! Sorry for the bad communication, I was traveling for a few days. Have a nice week!
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.