Download

TopDown Example movement help please

I am trying to make an ARPG and have started with the top down toolkit. In the current demo the player will move using Simple Move To Location. This function will stop pathfinding if it is given a path that is not valid (can’t be reached). In most ARPG games the character will path find as close as possible to the location rather than stopping, or at least try to travel directly in that direction. I have researched that the AAIController class has a Move To Location function that I would have liked to try out, but I can’t cast a PlayerController to an AAIController.

I even purchased the TopDown ToolKit from the assets store and all it does is AddMovementInput to follow in a direction. It feels nice but you can’t just click to move. I also found out that SimpleMoveToLocation does not replicate on the server so it seems to me I need to go a different route in general.

What am I missing here? I feel extremely limited in functionality to recreate expected ARPG behavior. I would prefer to do all this in code, but I have not been able to get any further with blueprints either. Thank you for your time.

I’m a little confused, so here is what I understand is the behavior that you want:

So let’s say there’s a large cube structure, so the behavior that you want to is be able to click on roof of that structure, and have your character run towards the point on the ground that is closest to that location?

You may need to do a little legwork before actually calling SimpleMoveToLocation.

In the UE4 TopDown Template (not the toolkit) when the mouse button is clicked it sends in sort of a raycast, its called FHitResult, and checks to see if this was a hit. If so, it then takes the hitresult’s vector coordinates and sends that data into SimpleMoveToLocation, where that function then decides whether your character can move there or not.

Now here’s my idea: figure out whether or not that location you clicked can be navigated to. I’m thinking maybe using the bool UNavigationSystem::ProjectPointToNavigation to achieve this. Then if it is not reachable, use the location where the mouse was clicked as the origin point and use UNavigationSystem::GetRandomPointInRadius which will return a random point around that area, which you will then pass into SimpleMoveToLocation. If the location can be reached with no problem then you would just call SimpleMoveToLocation.

I’ve never used the top-down tool kit btw.

I’ll see if I can generate a code snippet for you as soon as I can.

Hi,

just right now saw that post. I am the creator of the topdown toolkit.

Initially i used the SimpleMoveTo for the Player, but as you already found out, this does not work with networking, so i removed that one and did AddMovementInput so networking was working generally.

What you really want now is more than possible, but unfortunately not with Blueprints. You can see my answer on answerhub here:
https://answers.unrealengine.com/questions/36667/click-to-move-and-clicking-outside-of-navmesh-boun.html

My codesample should basically do what you want here; If a path can be found, it will follow the path, otherwise it will just go straight to the direction you clicked.

Btw, usually i help my customers with all sorts of extending the toolkit (i still call this “customer support”), so just ask me directly next time you got such a question, chances are i already have a solution :wink:

Cheers,
Indy