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?
asked May 18 '15 at 06:09 AM in Blueprint Scripting
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.
answered May 18 '15 at 03:21 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here