Whenever my AI dies I am not using ‘Destroy Actor’ because I want their body in the game still but the behavior tree keeps running no matter what I do. I plan on having a decent number of enemies and I do not want a whole bunch of behavior trees running in the background when there is no need. I just want the BT to go away to improve performance and stop other smaller bugs after an enemy dies.
I’ve tried 'Un Possess" node, it doesn’t do anything.
And I even tried making a boolean variable to stop the flow in the BT once dead but that didn’t seem to work either. I may have set it up wrong but I’m not sure. I don’t even know if this would work properly, because the BT would still be running.
Simple solution: use an “isDead” boolean.
When you set the AI to die, set the isDead bool to true.
Then, pass that value to the behavior tree at the top level and set “isDead is Not Set” shown in the image
Also, a bonus is that you can have other AIs check that AIs bool to see if it should attack it or not.
If dead, the living AIs move on to the next one.
I’m trying to do what you said but it’s not working and I can’t figure out why. All I can tell you is that the “Hello” print string does fire when the creature dies, but the BT does not stop and I can’t tell if the IsDead boolean is changing or not.
Try using “get blackboard” node for the target for “Set Value as Bool”
Blackboard should be directly accessible in the Character BP.
No need to cast if it works.
Didn’t seem to make a difference. I used a different BB based condition whether or not the AI has seen the player and I’m trying to set this up the exact same way (but using a bool instead of an object, but it’s just not working.
I don’t even know how to test to find out where the problem is.
I thought the reason was optional and I thought I may want to have it for later, even when I leave it blank it doesn’t make any difference at all.
In your picture what calls the LogicActivate function? How did you hook that up to a behavior tree?
Also I am not doing anything in c++