Forum rules - please read before posting.

Modifying QTE logic?

I was trying to create a new QTE that was very similar to the thumbstick rotation one. I wanted the "Lose" condition to be ONLY time running out, and the "Win" condition to be rotating the mouse once in either direction. Basically, the player character is going to slowly fall asleep, and you need to shake the mouse/rotate it to keep her awake.

I tried to do this by duplicating ActionQTE.cs and PlayerQTE.cs, and simply changing the "wrong direction fails" check to also output a win. That way, any mouse rotation means a win, and not rotating it at all means a loss. The problem I encountered is that when I started changing the references so they'd match the new files, I noticed they also referred to stuff in KickStarter.cs, and it soon got a bit too complicated. I tried to edit Kickstarter.cs just to see if it would work anyway, but I got an error where an instance of an object couldn't be found, and I figured I shouldn't be editing that file anyway.

Is there an easy solution for this?

Comments

  • You can try subclassing the two classes instead - so you'd use a separate custom variant of the Input: QTE Action, and also your own PlayerQTECustom.cs for the QTE handling itself.

    If you then go and replace the GameEngine object's PlayerQTE with PlayerQTECustom (or whatever you've named your subclass), the KickStarter should still reference it without having to make changes to it.

    One thought about the intended QTE, though: I wonder if this could be done with the "Button Mash" type, where you create multiple inputs of the same name that refer to the thumbstick in different directions (i.e. +X, -X, +Y, -Y).

  • Thanks, Chris!

    Yeah, the button mash QTE referring to the Mouse X and Y axes was my first thought, and it would really have been the best solution. The problem is that I can't seem to make the axis input be read as button presses? That was the reason why I moved on to the idea of mapping the mouse axes to the thumbstick rotation QTE, and making the number of rotations really low.

    I haven't even had any luck finding a simple way to convert an axis input into a button press via code. Outputting something when you move the axis to any given direction is trivial to code; but there doesn't seem to be any simple way to turn that into a virtual button press that AC can work with.

  • edited November 2020

    My suggestion to make this work out-of-the-box in AC would be to make the button mash QTE accept an axis pushed to +1 or -1 as a button press, no user-facing options necessary -- then all the user would need to do is set the desired sensitivities on the Input Manager.

    Edit: it seems like we posted at the same time. I'll check this solution out, thank you!

  • AC input checks can be overidden through the use of delegates - see the Manual's "Remapping inputs" chapter.

    As an example, you can reroute input checks for a button named "QTE_AxisMash" to an axis named "Horizontal":

    using UnityEngine;
    using AC;
    
    public class QTE_InputOverride : MonoBehaviour
    {
    
        void Start ()
        {
            KickStarter.playerInput.InputGetButtonDownDelegate = CustomGetButtonDown;
        }
    
        private bool CustomGetButtonDown (string buttonName)
        {
            if (buttonName == "QTE_AxisMash")
            {
                if (Mathf.Abs (Input.GetAxis ("Horizontal")) > 0.2f)
                {
                    return true;
                }
            }
    
            try
            {
                return Input.GetButtonDown (buttonName);
            }
            catch
            {}
            return false;
        }
    
    }
    
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.