Hello,
I have been working on a shooter for the past few months. Recently, I added some features to the Enemy Behaviour Tree, creating a task that makes them run from the player that is supposed to happen when their health reaches below a certain threshold.
I was able to create said task. However, I notice that the health referenced in the Behaviour Tree is always 0 so the enemies are fleeing by default. I created a Behaviour Tree Service and used the following code to get the value of the health to store as a Key in the Behaviour Tree -
The definition of the referenced method is given below -
As you can see, the value of CurrentHealth is at 75.0.
But as the below image shows, the value of Health key in the Behaviour Tree is 0.
I am calling the service as shown below in the tree.