Forum rules - please read before posting.

Question about switching QTE Animators/Displaying Alternative Animations (Hit, Win, Lose)

Hi all,
Hope everyone is having a great weekend!

I have a question about the best way to achieve the following:
I've set up all my QTEs with UI for Keyboard/Mouse, implemented controller inputs, and added a listener script that checks if a controller is connected at runtime. I'm currently in the process of adding controller UI elements to match all the keyboard counterparts.

My question is: what’s the best way to handle this?

Should I use the same UI element and switch the animator?

Should I add a "Link Variable to Animator" component, create a variable that activates when a controller is connected, and have all animators display alternative animations based on that?

Or should I just clone all the keyboard QTE UI elements and replace their animators with controller versions?

I’d really like to not have to clone all the UI elements just for controller inputs, but I’m unsure if "Link Variable to Animator" can work properly in conjunction with the Hit, Win, and Lose QTE states.

Thank you in advance, as always!

«1

Comments

  • As in, show a gamepad button instead of a keyboard key?

    It would be best to use the same UI. Link Variable To Animator can be used - you can link it to a Bool variable that your listener script sets manually, i.e.:

    AC.GlobalVariables.GetVariable ("IsUsingGamepad").BooleanValue = true;
    

    The issue right now, though, is that the Hit/Win/Lose animations are currently played directly by naming convention - meaning they'll run regardless of any Animator parameter / transition.

    It would, in hindsight, be better for these to be played via Trigger parameters instead, i.e. "Hit" is a Trigger that you can set up in your Animator to play your Hit animation. That way, you can add an additional "IsUsingGamepad" parameter condition in the Transition to play one of two different Hit animations based on the variable's value.

    I'll look into making this change as part of the next update. You can make this change manually in the meantime by opening AC's PlayerQTE script and replacing all the instances of:

    animator.Play
    

    with:

    animator.SetTrigger
    
  • Hi, Chris! Thanks for getting back so quickly. That'e exactly why I was asking. I know that Hit/Win/Lose play directly. Thank you for the workaround. I'll see what I can do. Have a wonderful day ahead.

  • No problem - let me know if it works!

  • edited November 17

    @ChrisIceBox Sorry to @ you directly in a message, but I didn’t want to spam the forum by creating a new thread on the same subject. I’ve started focusing on the controller QTE stuff and I’ve hit a wall. I’ve manually replaced animator.Play with animator.SetTrigger, and I’ve added the Link Variable to Animator as suggested. I’ve added the triggers and the bool variable to the Animator, and created two sets of Hit, Win, and Lose for Controller and Keyboard.

    The part I’m unclear on is how to set up Parameters to automatically detect everything. I tried using Any State and adding the bool (true/false) based on the variable, but it only seems to play the layer’s default state and ignore my settings. Could you tell me what I’m doing wrong, please? I’m using 1.82.6. The QTE script was changed manually (I didn’t update because I have a release coming up and I didn’t want stuff to break). Here’s a screenshot of what I tried doing and it didn’t work.

    https://drive.google.com/file/d/1ieOhVO4Qv_iq90hAdZhywCvOhP66G7Nr/view?usp=sharing

  • Are the parameter values correct at runtime?

    Since your Hit state is the default, you'll need to ensure Can Transition To Self is checked in the transition's properties so that it can re-start the Hit state if it's already playing.

  • Hi. Thank you for replying so quickly. On the default Can Transition To Self is checked but it makes no difference. The Bool updates but it doesn't seem to make any difference. I created a New State and tried switching to Hit from there instead of Any State and it's the same thing, it will only play de default state. Seems to ignore the Link Variable to Animator.

  • edited November 18

    https://drive.google.com/file/d/1AXiUGthPMHUBPlndFt-HwvPyOkqeUTMP/view?usp=sharing Here's a video. I've included all of the settings in the video. If you click on "Hit" trigger while the QTE is running it does seem to take effect. I've checked with the variable on and off and it does switch correct between the two and alternate animations.

  • To be clear on the problem: it's that the IsControllerConnected parameter isn't linking to the Variable?

    The video shows a warning in the component about the variable's Link to field not being set to Custom Script. Is this the case?

  • As far as I can tell it's not the variable that's causing the issue. Link to (Custom Controller) is disabled because if I enable it it doesn't update the variable in the Animator. I've tried it both ways, and set to "none" is the only way it actually updates at runtime. The issue seems to stem from the triggers. I assume the the 3 triggers (Hit, Win, Lose) need to update at runtime and get ticked if they're set as a condition during a state? If so, then that's what's broken. The triggers don't update. I can get it to work by manually enabling all 3 of them before running the QTE.

  • You've said you modified AC to call SetTrigger to allow for this - which lines, exactly?

    The latest release has made this change officially. It would be worth testing it in a backup/duplicate project.

  • I followed your instructions. Looked at the new PlayerQTE script and adapted it.

    animator.Play
    with:
    animator.SetTrigger

    I have another build with the latest version of AC but I think I might just create separate controllers for the joypad stuff and figure it out later.

  • I've tried it on a separate project with the latest version of AC installed and Unity 6000.0.45f1. The same issue with the triggers seems to be occurring. This is what I've noticed so far. Hit trigger updates properly but only plays the Hit animation once (regardless of how many times you press the required QTE input). Win and Lose triggers don't work at all. I've created transitions for all 3 from a default state as indicated in the tutorial (https://adventurecreator.org/tutorials/quick-time-events-2). https://drive.google.com/file/d/1h_qvkm4BxSi4tEXpLI34Jim_C0_RFwnD/view?usp=sharing

  • There may be an issue with the tutorial image - try running the transitions from the Any state instead.

  • Hit does seem to work as intended after setting transition form Any state, however, win and lose still don't work. I've done the same where I run transitions from Any State to them, but the animations don't play.

  • What do your Action, and Menu's properties, look like? I cannot reproduce this behaviour.

  • The link is private, I'm afraid.

  • Following your settings, the issue I'm finding on my end is that the Menu is turned off automatically following the QTE completing - meaning the effects of the animation aren't visible. Is this the case for you?

  • I'm not sure. The Hit animation works, but Win/Lose don't appear at all. Is it an issue or a mistake on my part?

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.