[AI] Continuous update to move-to w/o aborting

I have a zombie enemy that I want to constantly move towards the player using the behavior tree.

The problem: updating the move-to position and then cancelling the BT to retrigger the move-to node calls AbortMove internally. Result is a constant cancellation of the node while player is moving so the zombie will never move, because each frame cancels and restarts the node.

BT Overview:

My hacky solution is to override BTTask_MoveTo C++ abort node to don’t actually ever push the move abort to the player controller. Now this is probably NOT the way it’s intended :slight_smile: So I’m looking for help on how to properly UPDATE the move-to location w/o having to cancel the entire behavior tree and hacking in the custom move-to override.

Instead of a vector you could set the target of the MoveTo node to the actor you want to follow. That should do what you’re looking for.

To clarify, this still means I need to extend this class with my own code to use the target object and update position each tick in the BT task? I cannot by default assign a blackboard key of type Object to the MoveTo node.

Edit: I do notice that the node should allow AActor types, but the dropdown doesn’t allow me to set the “TargetEnemy” of type Object (since that could be something besides AActor) I cannot create a blackboard key of AActor…Any idea how get that working?

In your blackboard, when you select a key of type Object, then in the details panel you can expand the ‘Key Type’ property and select Actor (or if you prefer, one of your own classes derived from AActor) as the base class. Once you’ve done this, it should be accepted by the MoveTo task.

Thanks! I completely overlooked the extra property.