Latent MoveTo Task (BT)

Hi,

I am using BT and I need to move my Pawn to a location returned by an EQS query. The problem is that the MoveTo node sends the order to move and finishes and I want the node to stay active until the Pawn reaches the goal position. I tried creating a custom move task using the AIMoveTo function that does exactly what I want. However, this functions does not let you specify a custom filter class so it does not fit my needs neither. I also tried to achieve a latent MoveTo using the MoveToLocation function with delays, ticks and more complicated things but it did not work.

Can someone help me please?

Why do you need the node to stay active?
Without knowing the reason anyway, I think an hacky solution would be to put a long wait node after the move to, and a decorator that checks a variable HasPawnReachedDestination and when true abort self.
What do you think?

I’ve done something similar. In the BP of the task I added a long delay after the MoveToLocation. Then, also inside this BP I check every event tick if the current Location of the Pawn is near the Destination. If it is, I execute the Finish Execute Node. It works but…is a bit dirty and I dont like it. I was looking for something like the AIMoveTo but with the option to specify the FilterClass (from C++ for example).

I am going to re-think why I need the node to stay active. I think it is because if the node finishes, I have to do more checks to prevent the tree to execute this node again. I would need to add something like, PawnIsMoving or PawnIsGoingToDestination. Do you know what I mean?
I was doing this way to avoid that, but at the end I am doing these checks anyway so…I think I will re-structure my tree.

Just in case someone has the same question, here is my solution:

90310-capture.jpg

Where the bool AI_bNeedNewDestination is set when the distance between current location and destination is less than a given threshold.

Yes, I think it’s better to restructure it. I found that having clean/atomic tasks and multiple decorators is the best way to do bts.
Bye!