While crouching, Sprint is possible

Hello Guys :smiley:
My first post here.

I ran into an issue, I want to avoid that you can sprint while you are crouching.
When you are crouching it shouldn’t be possible to crouch faster when you hit shift for sprint.

Example:

I’m crouching and pressing W to walk, when I press shift, then it’s applying the Max Walk Speed 800, it should stay on Max Walk Speed 150.

Hope you guys know what I mean, if you need some more information pls ask me :slight_smile:

Kind regards from

PS: Here my Blueprint

There is a cleaner way for your whole movement.
First set up your key bindings under Edit\Project Settings\Input (ignore the gamepad i have in there. just asign your
jump & crouch keys as action mappings and the movement keys as axis mappings)

Then inside your blueprint set the controls like that for example

and you should be good to go. That’s a really basic setup, but it’s a good start I guess.

@CitéNoir Thx you for this fast reply.

I did it yesterday like your solution. But it doesn’t worked. I still can sprint while im crouching, maybe I did something wrong.

Are you sure that you cant sprint while you pressed left ctrl?

And why does my solution not work, I mean in c++ is it like

if ( w && leftShift && leftCtrl )
{
   maxWalkSpeed = 150;
}
else
{
   maxWalkSpeed = 400;
}

(not this simple but something like that xD)

the thing is that the first maxWalkSpeed 800 is overriding the other.
Maybe I can set this in a function?
btw I’m in my office and I can’t post pictures :slight_smile:

oh… I think I forgot something. Did you set your crouch speed and the abbility to crouch in the character moving details section?

also check out these tutorials:

https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/CharacterMovement/Blueprints/Input/index.html

https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/CharacterMovement/Blueprints/Setup_2/index.html

there’s a step by step explanation for setting up the movement of a acharacter. If you follow those it should work.

I’ll try it tonight :slight_smile:

So, I kinda did it right this time, however I dont know why it’s like this.
whenever the game starts and the first button I press is “W” the max walk speed goes to 800. If you look at my BP you will see that the condition isn’t true, is that a bug?

I marked it with a green line.

(now i can’t sprint while crouching and i’m only sprint 800 when I press W+Shift, and when I sprint sideways I’m a bit slower, these things work now)

you should only have one InputActionSprint, otherwise all of them are called n will mess up one another.
first, get rid of all the controll BPs you have in the last screenshot.
Then use InputAxis for wasd movment, set them in the Engine Input (first answer, first screenshot)

Axis mapping +

-forward/backward
W with a scale of 1
S with a scale of -1

-left/right
A with a scale of -1
D with a scale of 1

Then set them in the BP as seen in first answer, second screenshot.

And set sprint and crouch in the Engine Input as seen in first answer, first screenshot.

Action mappings +

-Jump
Spacebar (or any key u wanna jump with)

-Crouch
ctrl

It should work that way.

Remember one instance of ActionInput Sprint & ActionInput Crouch is enough.
And for a simple movement controll they don’t need to be connected with the InputAxis Forward/Backward and InputAxis Left/Right.

Hope this helps.

I appreciate your help, friend. I’m using the thirdperson template, so that means that the movement is already set. Because of you I figured it out how to stop the Sprint while I’m crouching. (in my last BP, top left corner)

However either one of them work at the same time. And thats why I made it like that.

The aim I had was, you can’t sprint while you are crouching and if you press W + Sprint you should speed up, but only in this direction, it shouldn’t apply on D, A and S. Thats why I’m using multiple InputAction for Sprint.

And yes it helped :slight_smile:

cool, hope u’ll work it out. cheers n have fun :slight_smile: