Speed and pathing in top-down template (blueprints)

Hi all,
This is gonna be my first attempt to play with blueprint scripting and I’m running into a wall when trying to create a few modifications to my game, which is currently just the top-down template.

First: I’m trying to create a dash / sprinting mechanic that works with the existing click-and-move mechanic, where whenever a key is pressed the current movement speed (max walk speed) of the actor would go up significantly, and resume to normal when released. I’ve tried several ways based on existing answers and it did not show any result in game. What would be a good way of approaching this?

Second: The click-and-move pathing is a little bit too smart for what I want, which is a more direct move-towards-the-mouse functionality without intelligently pathing around obstacles (would really make a maze pointless, that one). How should I go about doing that?

Thanks!

To your first question: Go into your character and implement a "Event " (ideally you make this a “Event Sprint” by adding it to the inputs in your project settings so it’s not locked to a key and you can rebind it later but for testing this works just as well). From that event “On Press” get the character movement component and change the “Max Walk Speed” to the high number and the other way around for “On Released”.

To your second question: In this case you actually want to get rid of the “Simple Move To” node in your script right now and replace it with a “Add Movement Input”. This requires a vector for the direction in which you want to move. To get this vector do a “Get Hit Result Under Cursor” which will provide you with a hit result. Once you break that you will find a “Hit Location”. The vector between your actor and that point is the vector you want to input (Hit Result - Actor location).

I hope this helps.

Cheers!

Thank you so much for your response! I’ve implemented your answer to my second question and it works perfectly now.

The first problem persists, though. You answer is pretty similar to the other stuff I’ve tried before - it compiles ok, but the key press/action event does not change the movement speed of the character during runtime (manually changing it before runtime does work, but that’s just the consistent max walk speed which is not what I need). Also note that most of the functions happen on the controller blueprint, not the character - don’t know if it makes a difference. Any ideas?

Ah I think I know why. What is the speed you specify in your “Add Movement Input”? Because for the max walk speed to change anything your walk speed has to be above the max walk speed you are setting it to :wink:

I actually couldn’t find the add movement input node, any idea where it could be? i looked under the character blueprint, which has pretty much nothing, and the controller blueprint only has the click-to-move functionality but no specifics about the movement itself.

I’m… Not sure. the top-down template has the controller with the click-move functionality, and the character itself has nothing except the inherited character movement.

What are you using to move your character?

You modified it as I described in the initial answer didn’t you?

It should be a combination of the length of the “World Direction” vector and the scale value. Maybe it automatically defaults the world direction to one. Try setting the scale to like 10 for testing.

Yes, I did, sorry! where does the speed get specified on it?

that’s what it was, and it works now! thank you!

One thing I had an issue figuring out was that the scale could only accept values between -1 and 1. I had it set to 2 for a while and couldn’t figure out why it wasn’t working.

Again, thank you very much! :smiley: