I have a melee character with some range, stored in MeleeComponent. I now want to create a task in behaviour tree (using blueprints) that would move to enemy with accepted radius of melee range.
Unfortunately, I cannot set accepted radius for MoveTo (UBTTask_MoveTo) task in the blueprints.
So, instead, I want to create my own task MoveToMelee,in C++, that would create a UBTTask_MoveTo, set the AcceptedRadius with my melee range, and launch it as a subtask: so that when the subtask finishes, it’s result is automatically propagated as a result of my MoveToMelee task. Is this possible?
the UBTNode::NewBTAITask function looks like what I need, but it works with AI tasks, not UBTTasks, and it seems that they can’t be used as UBTTasks.
There ai version of moveTo BTTask - AITask_MoveTo, but I don’t see how to use it as a subtask.
P.S blueprint solutions are also welcome.
P.S. one possible solution to this is to subclass MoveToMelee task from UBTTask_MoveTo directly, but this is ugly.