Character movement

How hard would it be to take out all movement from a 3rd person character and only have the whole forward movement speed controlled by how fast you can button mash? (like the character is on a rail)

I would like the character to slow back down to zero if you don’t press a button, but speed up if you press a button (any button)

What would that look like node wise?

Thanks!

What you want:

  1. ButtonMash: in the third person character blueprint the input action “IA_Move” is mapped to 4 buttons and is using the “Triggered” output pin which will execute on the event tick (or some frequency set in the input action). To make it a “Button Mash” we’ll want to switch that to “Started”
BP_ThirdPersonCharacter - Movement Input


  1. Remove current movement logic: in the image above you’ll note the comment blocks “Left/RIght” and " Forward/Backward". Delete the nodes in the “Left/Right” comment block and reroute the ‘Execute’ pin from the “Started” pin-out on the input action IA_Move to the “Forward/Backward” node cluster.
Delete MovementLogic

  1. Speed Up on button press: One way you could handle speeding the player up and naturally slowing them down would be to use the “Character Movement” component to set the “MaxWalkSpeed” float variable. increasing the MaxWalkSpeed by a particular increment each time a player presses the input action “IA_Move”. This only increases the max speed, in order for the character to execute this we can use the “Event Tick” node to “AddMovementInput” with each tick. when operating in this way we’ll want to reduce the initial MaxWalkSpeed to 0 in the MovementComponent
Reduce MaxWalkSpeed

Now we can hook up our logic to the two nodes, “EnhancedInputAction IA_Move” and “Event Tick”

New Movement Logic


  1. Slow Down on Button Release: The Delay Node is used to slow the character down over time since the Event tick will execute with every tick we need to slow it down at a reasonable rate, it’s here where you could adjust how quickly the character were to slow down. Now there’s something wrong with the above logic; if we keep reducing the walk speed on the event tick it’ll start decrementing the MaxWalkSpeed variable even when we’re not pressing a button. To handle this we might introduce a “Branch” (if statement) that only decrements the MaxWalkSpeed if the MaxWalkSpeed happens to be above 0
Adjust Event Tick Logic

Now when we press the button once it’ll update the MaxWalkSpeed, then wait 0.5 seconds and reduce the MaxWalkSpeed. The PrintString node is added to the event tick so we can see the value of the MaxWalkSpeed variable as it changes.

I would be interested to know this too. Like you would have a baseline speed, and the amount of button mashing raises that to an ultimate max, but you probably want a slow raise and fall once you stop it and it would fall back to baseline.

sure, if we use the example I provided above, but with a ‘Baseline Speed’ value you could change the initial speed to whatever you’d like and a control measure such as an Enum which the player could use in a Branch to determine if it should move, when it does it could increase the speed value and continue moving, then when it decrements, it would only decrement the value to the ‘Baseline’ speed value. It would be up to you when you set the Enum to ‘Moving’ or ‘Idle’, it could be done in the same input action or a separate one.

I think I just seen how you could do this. Think of the Mortal Kombat “test your might” challenge (Doesn’t get more button mash than that right?).

Where that bar begins is the baseline speed. Now have a few more points, A , B, C, D, increasing so that only the fastest button mash achieves them. As a natural buffer, you could have it that only when B is reached, the speed is increased to A and so on. And then only after a set anount of time (with no buttons) does it fall down from a single point to the next point till it eventually reaches the base line.