In some gameplay situations I want my AI to finish executing their movement before I call Finish Execute on the Blueprint task. This led me to this fantastic post, which was very helpful. However, I am having some issues implementing Peter Newton’s method and would like some clarification on AIRequestIDs and How to properly use OnMoveCompleted.
In my BTTask (called “Task A”) my AI will start moving and do it’s thing, but will not Finish Executing the task until after the move has completed–as desired. Unfortunately though, after the AI waits to ReceiveMoveCompleted and fires the Event for the first time, the ReceiveMoveCompleted event continues firing, even after Finish Execute is called and the behavior tree moves on to a different task “TaskB”. Because of this, ReceiveMoveCompleted continues firing during subsequent calls to Task A. This causes the task to complete execution without the movement first completing. From my understanding, each ReceiveMoveCompleted event is bound to a specific AIRequestID (or just “RequestID” in Blueprints) created by the MovetoLocation node. I suspect that the request ID from the first movement is still being used to trigger ReceiveMoveCompleted. Such that ReceiveMoveCompleted considers each subsequent move as “completed” because it is using the same RequestID. So a good followup question to the linked question is, how do I reset the RequestID and have my Bind Event to ReceiveMoveCompleted call the event with a different Request ID on each new “tick” or “call” of Task A. Or more simply, “Why does my BTTask treat every call to MoveToLocation as the same request?”
*Willing to Share Behavior Tree and Blueprint, but both are rather large, so hesitating for now.