One Input Two Actions

Hello friends,

Simply, I wish to have my right mouse button perform the following:

Click: Roll.

Hold: Sprint.

Currently click is performing Roll and Sprint one after another upon input.

I have my stamina, sprint and directional roll systems in place, just can’t figure out how to make this work.
Some things I’ve tried: Timer after key press, variable conditions, delays, check if key is down and how long key pressed etc etc.

Eventually it will be gamepad so imagine this in Dark Souls, that’s what I want to achieve.
Any insight would be appreciated.

Thanks.

I believe the action keybind nodes have two outputs: One for on pressed and one for on released.

Assuming you made the “roll” a single animation/function movement and you made “sprint” just change max walk speed in character movement:

-You could set sprint to happen on pressed and then use your timer idea to set a bool to true “no roll” if it is held for, let’s say, .5 seconds?

-Then, on released, you could set roll to happen only if the bool is false, then clear timer with its handle, then set bool back to false, then stop sprint.

If you do this, then a single click would sprint the character for .01 seconds (or however fast a click is, hopefully nothing noticeable) and cause a roll the moment of release.

Or, alternately, if they hold the button, their character will sprint but won’t roll on release.

This seems like it would work. :slight_smile:

There’s going to be as many solutions to this as there are people, here’s one:

And one using a Timer instead:

Hail Everynone,

Thank you, it is now working as intended:

EDIT: I tried to link to Pastebin with the complete BP.

Thank you, Detach789.

I’m pleased to report it is now working!