Blackboard values simply don't set correctly

Hi : here’s how I do it.

First, create a blackboard key of an Actor type which you can use to store the player. Then, create a blackboard key of a boolean type which will act as a conditional.

Make the AI’s tree do this:

  1. go to a selector which first checks for the player, and stores that player in a blackboard key. You can out a decorator on this which prevents it from firing once that key is set if you want; I did, it doesn’t seem to matter though.

  2. that selector then goes to a second selector. The second selector has a service which ticks at some rate (mine was 0.2), and that service should be setting the bool blackboard key. Mine does a sphere overlap check and an array length from that to determine how many actors are within radius of the player, but it seems like any conditional will do, honestly.

  3. that second selector has one child, which is a MoveTo task which moves the actor to the player. What should happen is that you use a Bool decorator here to either allow or prevent the MoveTo task from executing; this will behave oddly, and if you observe the BB values in real-time during PIE you’ll see them changing erratically and more or less completely independently of the output of the selector.

  4. give the new selector a new first node (moving the MoveTo to the second child position), for example a very brief Wait node. If you give this child an opposite conditional check (i.e. The move executes if the Bool key is true, the wait executes if it’s false), then suddenly everything works! It’s like the selector isn’t “holding” the BT so the service isn’t running right, though if you stick a Print String inside that selector you’ll see that it IS running even though the BB value isn’t updating.