RTS Move To with behaviour tree

How would I do a simple “MoveTo” with behaviour tree?

I set up an “AIController”, a “BeahviourTree” and a “Blackboard”. On “BeginPlay” of the “AIController” i do “RunBehaviourTree” with “BehaviourTree” assigned.

103813-aicontroller.png

In the “BehaviourTree” is the Root->Selector->MoveTo(with VectorKey asigned from Blackboard).

In my “PlayerController” i can get a “HitResultsUnderCursor” with “LeftMouseClick” check if it is of Type “Unit” and and store it in a variable (SelectedCharacter).
When doing an “RightClick” i get the “HitResultUnderCursor” with the ground take its “HitLocation” and call a function of the AIController which i get from “SelectedCHaracter” and pass it the “HitLocation”.

This function then sets the Blackboard Key “VectorKey” to the “HitLocation”.

When i test this, the “SelectedUnit” starts to run to the “HitLocation” like expected.
But when i have multiple Units they all run to this “HitLocation” although i only selected one Unit.

Any advice what im doing wrong?

Thank you man! This did the trick!

I bet your HitLocation BB key is configured as “synchronized”. Look at its options and disable that flag.

Cheers,

–mieszko