Help with behavior trees and spawning enemies?

Hi,

The blackboard decorator only accepts one boolean, however, you can easily put two decorators on the same Selector or Sequence node. You can also use one boolean variable that stores the result of AND operation between your other two booleans (though I don’t recommend this as it might make things messy).

To run a Task with a timer at a different rate you have 2 options: Using Services or setting a timer in the Task itself. Services work similar to Tasks. They start executing if your decorators are all true and they provide you with an option to change the ticking interval once you add them to your behavior tree. You can override their Event Receive Tick and implement the logic you want.

Tasks, on the other hand, don’t give you an option to change their ticking interval, however, there are easy ways to make them tick in the interval you want. Instead of using Receive Tick event, you would use Receive Execute and bind your functionalities to a custom timer. Receive Execute works just like Begin Play and is called once when the Task gets activated. As a good practice, I recommend that you store this timer handle and call Clear and Invalidate on it once your task is finished executing by either using the Receive Abort event or another delegate that you have set somewhere else.

This official tutorial here might help you understand how to spawn actors using blueprints.

If your AI’s are based on Character, then you can use the inherited Movement component to change their Max Speed. if you’re inside your own character BP, simply drag the Movement component from the Components list to get a reference to it, click and drag from that reference and type “max speed”. You’ll be able to set it and change it to your liking even during gameplay and runtime.

Hope this helps.