Forum rules - please read before posting.

Disable input button on trigger

Hello everyone, is possible to disable a single input button while the player is inside a trigger? I gave my character the crouch animation (just animating camera and collider) and i call animations using a menu to turn off and on animations and crouch icon, now i would like to avoid player to crouch off while it have to stay down. I've already tried locking on/off menu or enable/disable it but it will automatically play the inverse animation, as a plus i've already tried to do it disabling menu only when inside a trigger but even the crouch icon will disappear. I know active input or a custom action would save me but i'm still noob at programming, started a course but never finished yet, so i'm looking for a easy solution build already in AC.

Many thanks :D

Comments

  • What input button are you trying to disable?

    If the input button is defined in AC as an Active Input, then you can use the Input: Toggle active to disable it.

    If this is an input button that is only used in a script, then you can use an AC Trigger to change a Global Boolean Variable - i.e. set to True when entering, set to False when exiting. Your script can then read this variable's value to determine if the input button can be read, i.e.:

    if (AC.GlobalVariables.GetBooleanValue (3))
    {
        // Check for input here
    }
    

    (Where "3" is replaced by the ID number of the Global Variable - it's to the left of it's label in the Variables Manager).

    If you need further help, please elaborate with more details about how you're using the input button - because I can only give general advice otherwise.

  • Thank you Chris, you're right, input button is defined only in project settings, so its called from a menu via its Appear type: On Input Key, i've tried to define it in AC as Active Input, but i wasn't able to deactivate it, or better,i can't understand how properly Input:Toggle Active work.

  • If it's mapped to a menu, and you're just looking to prevent the menu from turning on during a certain time, you can use the Menu: Change state Action for that. Locking a menu will prevent it from turning on under it's normal condition - in this case, the pressing of an input button.

    See the Manual's "Active inputs" chapter for details on how active inputs work. If you use that method, I'd recommend getting it working first, and worry about activating/deactivating it later.

    To toggle a menu on and off with an active input, set the Menu's Appear type to Manual, and then - in the Active Input's ActionList - check it's on/off state with Menu: Check state before then turning the menu off/on accordingly.

  • Perfect, thanks again Chris. Everything clear. :)

  • edited March 2023

    I have a different problem. The player's interaction with the Npc when I click the button once works correctly, but if I click several times continuously on the Npc the interaction keeps repeating itself. Is there any way to block the button temporarily after a click to prevent repetitive clicks from continuously triggering the interaction list?

    It's because this interaction triggers an animation that lasts about 3 seconds and cannot accept another click before finishing the interaction.

  • You can use the Hotspot: Enable or disable Action to disable the Hotspot temporarily, or use the Hotspot: Change interaction Action to disable a specific Interaction within it.

  • thanks. It worked

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.