Random Task in AI

Hi all,
I want the behavior tree to randomly do one of the tasks below a selector. Don’t care which task.
My current solution is to randomly Finish Execute with a fail so it goes to the next one. It works but it doesn’t feel clean.

Is there a cleaner solution?

1 Like

This works! Cheers.

Hi,

You can create a ‘Service’ and assign a random integer to a blackboard value and then on each task, use ‘blackboard condition’ decorator to check that integer value. Here, take a look at this very simple setup for a better understanding;

Blackboard

Behavior Tree

Service

Assign the service value to blackboard value.

200646-bb+&+bt+interface.png

First Task

Note that in this approach, the selector only picks one random task to execute. Hope it help.

Regards,

7 Likes