How to use Flock with agents that have trees

jstriedinger

New member
Hello! Im having trouble figuring out how to use the Flock task from the Movement Pack when considering my agents do have some other behavoirs, meaning they each have tree.

The idea is simple: a flock of 2D fishes swims around, if the player gets too close, the internal tree runs the "evade" task. Once player is out or range, those agents must go back to their Flock behavoir.

What I have right now:
1. Parent flock item that has a tree with just the Flock tasks
2. Multiple fish objects that have a tree where the only behavoir is: if "can see player" then "evade".

Any ideas how to mix Flock with other behavoirs in other trees?
I'm thinking something like if I (a fish) can see the player they dynamically remove from the Flock object array, evade and when Im further away enough then dynamically add me again to the flock.
 
I'm thinking something like if I (a fish) can see the player they dynamically remove from the Flock object array, evade and when Im further away enough then dynamically add me again to the flock.
That sounds like a good solution. The flock task does assume that the other agents do not have their own active behavior tree so you will need ot do some modification of the original flock array.
 
Top