Handling environment queries within a behavior tree
We are now ready to implement the behavior tree, which, as you will see, shows some similarities with the BT_GunnerDummy asset; the only difference is the way we get possible targets. For this reason, we will be using the same Blackboard as BT_GunnerDummy. So, without further ado, open BT_EQSGunnerDummy and, in the Details panel, set the Blackboard Asset attribute to BB_GunnerDummy.
Now, focus on the behavior tree graph and do the following steps:
- Add a Selector node to the ROOT node and name it
Root Selector
. - Add a Sequence node to the Root Selector node and name it
Shoot Sequence
. - Add a Blackboard decorator to the Shoot Sequence node and name it
Has Ammo?
. In the Details panel, do the following:- Set the Notify Observers attribute to On Value Change
- Set the Key Query attribute to Is Not Set
- Set the Blackboard Key attribute to NeedsReload
The graph so far should look like the one shown in Figure 11.3:
...