Download

How Do I Make My Character Perform A Short Run Whilst Being Locked Into The Animation?

Hi everyone. I’m trying to make a Prototype using 2D Sidescrolling BluePrints and need some help.

I want my character to be able to run a short distance when I press the assigned button on my keyboard. The distance and duration will be short. Something like half a second. Whilst the character is running, I need all other button presses or movement options for the character to be locked out, so he can’t jump, punch, stop, etc. Just like in a lot of Street Fighter games, where you douple tap forward on the d-pad and the character will do a short hop forward that they are unable to cancel once executed, except I need mine to be a short run rather than a hop.

I spent the last two days scavenging the forums and found lots of threads with similar questions being asked but after trying them out myself, they either didnt have the desired effect or I wasnt able to get it to work. I would really like the run to be activated by a double tap but I found the most failure when trying to use that method so, I’m willing to just settle for a dedicated button for it if thats much easier to set up. Also, I’m relatively new to Unreal Blueprints so if you guys have any ideas to share, please consider that I’m still learning! Providing screenshots of a node set up and a nice explanation on why the method is good when compared to others would be a godsend!

Bump. Please help!

You could always put an anim notify on the animation sequence at the start, which fires off a bool to be set, then delay for a bit before turning the bool off. Then on each input, you can check to see if that bool is on, and if so, have it finish there. If false, it continues to each input’s command

Do you mind putting a screenshot if you have the time? I’m having trouble understanding. If you could also explain why that should work that would be most helpful because im very new to unreal and understanding the logic is most important to me right now.

Here is a screenshot of what I have now. When I press the dash input my character just plays his run animation on the spot for about half a second then stops. He doesnt move anywhere. I felt like this blueprint set up would work but I dont understand why he isnt moving forward.

dash input.PNG

I’ll try to explain using my own project, where I’m disabling jump inputs briefly when I land after jumping, just so you can’t immediately jump as soon as you’ve landed or it doesn’t feel grounded. Firstly, I have a notify on my animation sequence. I’m referring to my first one, as the other 2 are vibrations and making sure the disable notify is cleared after an amount of time
08f870dd83c42313f548576e1679f65c4f6a0170.png
Then in the animBP I set up an event to fire off from that notify. All this does is set a bool, then delay that before turning it off. In your case, you’d just need to set that delay to however long
a799bc9fd26d60f9743720d5773a64999c1aa5dd.jpeg
Then in the character BP under the jump input, it checks to see if that bool is on (I have cast to the animBP and promoted it to a variable, hence the blue bit coming off the ‘islanding’). If it is, then the command ends there, effectively disabling the inpiut. Forgive my example here, as there’s a bunch of other checks and branches in play, but the blue arrow acts as a simplified flow for you
047f6a3b6667b8fa4ad4f54fca97efc35e162c9e.jpeg

Some more code savvy people probably will hate my implementation, but it does the job just right. I also do a similar thing that halts controller axis movement when attacking so you don’t run around during it and I don’t get anything undesirable happening. This will all depend on your dash animation however, where you would only be playing it in this instance, and ideally not looping. You may want to use a montage if it gets more complex

Alright thanks for the help. I’ll give something like this a try when I get into the office tomorrow