Check if the round has started in Behavior tree

I wanna make a game logic that player spawn his troops agaisnt enemy troops and start round to let them fight. To do this i created a bHasRoundStarted in game mode and set it true after a custom event. I call this event in UI blueprint when pressed a screen button that starts round.

I have this behavior tree below. It handles ai’s move to closest enemy and play hit animation (there isn’t any damage calculation or hit reaction just yet).

Now i want to add a functionality to check if the round has started. Do those things just after the round started. I have a bool in game mode blueprint and another bool in blackboard for round state. I dont know where to change this bool values and how to check their values in behavior tree.

There’s a set of functions for blackboard that are named “Set Value As X” where ‘X’ is the value type. So there is one called “Set Value as Bool”.

In order to check values in the behaviour tree, you’ll want to add something called a decorator. Decorators will check the values of an assigned variable in the blackboard. I thought I’d share with you the behaviour tree I created to help explain.
All you need to do is right click on a node and choose add decorator. I have two of them in my sequences which show up as blue (I probably don’t really need the sequence nodes considering they each only do one task, but have them in case I wanted to add more behaviour). In my case, I am checking to see if my target actor is set. If not, the alien will move to a random location, but if it is, it will enter the chase sequence until the target actor is no longer set. At this point the alien will move to the location the player was last seen, and if the target actor is still not set, proceed to move to random locations.
For your case, in your blueprints you’ll want to use a Get Blackboard node and use the Set Value as Bool node as Tuomo mentioned. Here you specify the name of your blackboard variable and give it the value you want.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms