Forum rules - please read before posting.

Disable FlashHotspots in Hard Mode

edited September 2020 in Technical Q&A

Dear Chris and AC followers,
I was wondering if it's possible to enable/disable the FlashHotspots input based on a game variable.
Basically at the start of the game I let the player to chose between EASY and HARD mode. The first of which has the possibility to flash the hotspots pressing spacebar, the second won't.
I'm handling that with a global bool variable "EasyModeOn" (true/false) so it stays with saved files (I've other things affected by the EasyMode), but I was wondering how I can prevent the spacebar to Flash the Hotspots when EasyModeOn = false.
Do I've to write a script for that and attach it to the Persistent Engine? Any suggestion?
Thanks a lot!

Comments

  • You can do this by overriding the FlashHotspots input, and only reading its value if "EasyModeOn" is set to True.

    See the Manual's "Remapping inputs" chapter for details on the technique, but essentially:

    using UnityEngine;
    using AC;
    
    public class OptionalFlashHotspots : MonoBehaviour
    {
    
        void Start ()
        {
            KickStarter.playerInput.InputGetButtonDownDelegate = CustomGetButtonDown;
        }
    
        private bool CustomGetButtonDown (string buttonName)
        {
            if (buttonName == "FlashHotspots")
            {
                if (GlobalVariables.GetVariable ("EasyModeOn"))
                {
                    return Input.GetButtonDown (buttonName);
                }
                return false;
            }
    
            try
            {
                return Input.GetButtonDown (buttonName);
            }
            catch {}
    
            return false;
        }
    
    }
    
  • Awesome! Thanks a lot, as always!!!

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.