CustomMoveToTask

Hello. How would I correctly make a custom moveto task in my behaviour tree. The way i have it set up now is with a state machine that: 1st task builds the path, 2nd task cycles the checkpoints in the path; and the MoveTo itself. The move to is designed as an event that moves the actor a tiny bit towards the checkpoint. I thought that will work out fine because as the ai behaviour tree ticks so will the event move to because the state machine tells him to do only that one thing. It turns out it’s breaking my computer to run just a single ai and that’s not acceptable. What did I do wrong?
P.S. The reason I need the custom move to is because im building a 2D game and just finished a pathfinder for it. Now I need the move to to read the path and follow it.

BumP! Need the same answer

I know how to do this in C++.

Hello GammaD & DoctorD,

I have a pretty strong paltop, so I don’t really know the impact of this addition, but I can run my settup with like 15 AI without noticing it with my frames.

It depends on how you did your pathfinding code, but this is what I did:
But I have done similar stuff in two different ways:

Situation A: I don’t know in advance where to move to.
I let a Service make a “Memory Marker” It is just a target point, but I set a blackboard key with the same info as well (Object Actor key).

Then in my behaviour three I have a Task: MoveTo MemoryMarker.

88259-move+to.png

Situation B: I do know where to move to in advance.
I make some TargetPoints in my level. And make my AIcontrolled class have a Public array of target points, I place my AIControlled class in my level and assign my target points to it.
Then I made a Service to check wheter or not it has targets points, since I am using situation A AND B together.

Then in case I have targetpoints, I have a “PatrolBetweenPoints” Task, This one isn’t perfect yet, but this is what I have right now:

And this is how my behaviour three looks like in situation B.

You use the premade move to function. I made a spline network for my ai to use and pathfind around. no gravity just follow the splines. while i could use the movement component and flying movement its very clunky to implement compared to making just a custom move to task that follows the distance along the spline. i made it work in my controllers tick but when i implemented it into a ticking task it was very laggy. no behaviour trees for me.