How can I create a player character whose movement is based on events?

good day.

I have a few questions about the movement of the player character .
I am creating a runner and I need to realize a few things.

  1. I need a character to himself ran forward , but stayed at certain events . For example hit the area , stopped for 2 seconds, and then ran on. Constant running I realized using Event tick, but now I can not stop :slight_smile:

2 . If you hold down the right \ left , the character shifted sideways by 2 meters , when the key is released , he comes back.
The question is how to move it 2 meters.

3 . How best to implement a smooth change of speed of the character ? For example at the beginning of the level of the maximum speed of 2000, and then every second it falls .

I’m going to do my best to answer what I think you’re asking.

First off, one way of pausing the movement of the player’s pawn for two seconds would be to create a matinee sequence for whatever happens there if it’s supposed to be cinematic. If not, you can create a level blueprint that does that using a number of different combinations(That is a more complex question in itself, so if that is your question ask if on it’s own in blueprints).

Second, i think you’re talking about the camera actor and how it tracks the pawn, and that is built in with the sidescroller template. If you select the blueprint template and browse through all the class blueprints, you’ll have a better understanding of how it’s set up. Then you can tweak the camera, pawn, and other actors.

Third, Once again blueprints. I’ve been trying to figure our how to decay something over time myself, I’m not sure if i can answer that one as i lack the knowledge. but i thought I’d help you with your other two!

Thanks for the answer.

Explain in more detail what I was doing.

This Runner, with a third person.

Character runs itself, some events of his speed, others slow. The player can dodges from obstacles by pressing the right and left to jump them.

for this I need to change the speed and fixed strafe.

how did you get it so the character runs forward by itself?
I’m trying to get a camera (or invisible sphere with the cam attached to it or something) to move forward by itself using blueprint, but i’m fairly new to this and i cant figure it out.

hope you can help, thanks.

Hey Guys, so specifically this is the default Character Blueprint in UE4.

In the blue box is what makes the player move forward, the inputaxis “move forward” is what makes the character move directly forward and back, In the red box, the Input axis “Move right” is what allows the player to move left and right. I’m not sure as to make the player “Return” to a single point, but you can create movement input to move left and right the way you want it to via the red box.

And MGtmaggot, go ahead and create a character blueprint for your sphere, and hook up exactly what you see in this image in it’s eventgraph, then go set the default pawn as that blueprint. Also you can add a camera there and set up what the player sees.

I guess this is not really what i want to happen, i hooked up the event graph you provided to my “sphere camera thing” and i can move forward but it’s not moving forward by itself, i still need to press ‘w’ to move forward and ‘s’ to move back, is there any way to just have it to move forward by itself?

Simply add movement input with fixed value per tick, or use variable if you want to change speed. To stop character from moving you have to use book variable like CanRun and check it before adding movement.

To answer topic starter, you probably would want to use animations with rootmotion for strafe movement. You can also lerp between current location & current location + 2 meters to the left/right, but I assume you want some cool animations :slight_smile:

Updated blueprint that i’ve uploaded below to fit your needs. Strafes back to the side when key is released and speed is decreasing every second. You’d like to create a function for strafing, either blueprint is messy a bit.

[1]:

sorry, but i really don’t understand… still new to all this.


This character blueprint constantly moves character forward if CanRun is true, if player presses Space it toggles CanRun(false to true, true to false). MovementValue should be between 0 and 1.

Here is quick blueprint implementing basic runner game style movement.


Movement to the left/right still depends on MaxWalkSpeed value of character movement component. To quickly move character to the right/left either play animation with root motion as i said in answer, or manually lerp position.


[Blueprint][2]

sorry to ask this, i feel really stupid now but, I can figure this out, so thank you very much but there’s one (well, actually two) thing that i can’t figure out and that is:

the “CanRun” node, i can’t figure out what kind of node that is (i know it’s not in there by default so…)
And the same aplies to the “MovementValue” node.

if you’d like to explain those two nodes and what those are I’d be very, very happy. (i know the “CanRun” is a boolean and the “MovementValue” is a well, value node, but that’s basically it)

thanks again :smiley:

Those are variables, CanRun is boolean as you said and MovementValue is float. Blueprint is attached to the previous comment, check it out.

well yeah i know, but the thing is, i don’t know how to add them :frowning:

i’m nowhere near a programmer, i’m a visuals guy and i thought that blueprints was a lot easier (well it is) than to code it, but now I have my doubts.

I can follow along with the whole blueprint image, you provided (and i will credit you once i’m finished with my little prototype) but it’s just those two little variables, i cant figure those out.


Look at the left side of the window, these variables are listed there. To add them you have to click that “+Variable” button.

Looks like you didn’t check official blueprint tutorials, you should do that :slight_smile:

There is a latest blueprint, made few changes to answer all original questions.

oh god, i feel so dumb…

well actually i did, i created the “light switch” and the “sliding door”. But as I said, i’m a visuals guy, i just can’t remember code and variables and so on.

thank you so much.

Thank you very much for your answers.

With control and change of speed I understood. Now think of another question, how to get the character back on the desired trajectory.

But this issue is no longer on this topic.

Thank you :slight_smile:

Check latest blueprint, character moves to right/left and remains at that line as long as player has button pressed, character moves back to the middle line as soon as player releases the button.

Is that what you mean?

Hey Tamaru,

Thanks for the info on blueprint, =]
Helped alot with a few things I was struggling with!