Hi. I’m having trouble getting behavior trees to stop when the enemy is dead. I have a blueprint that calls “Stop Logic” and “Set State AS Dead” nodes when the enemy dies. I know the nodes are being executed because the print node on the false pin of Is Not Valid is not firing. When I check their behavior trees they still performing tasks. I also know the death event is firing because the enemy ragdolls after the event begins. Any insight would be appreciated.
Hey @Nitrox32!
Have you tried running “Destroy Component” using the Behavior Tree as the input? If you don’t need to restart the logic that will for sure end it!
Hope this helps!
For my current project that would work, but I’d like to know how to do it without destroying the component for any future project where I might want to restart the behavior tree.
Well, we can go further into it if you want, but it will require a lot more effort, because this is a troubleshooting situation.
The print node not firing doesn’t tell you that the death event is firing- if you want to know it’s firing you need to put a print string after “Stop Logic”. There’s a chance the event “Death” isn’t going off at all. Before we question whether the node is bugged, we need to make sure it’s getting truly used. ![]()
You should have a conditional check at the very top/start of the logic chain to see if the character is alive before proceeding. Just setting to a dead state should immediately end all further task processing if you have the starting conditional/state check.
Thanks, that’s what I ended up doing. I created a Decorator that through an interface got hold of an isDead bool I created on the enemy. I put the Decorator (abort to self) on a Selector just after the Root node in the behavior tree and connected the rest of the tree to that. This way, to turn the behavior tree back on I just have to set the isDead variable on the enemy and they are now alive again. Sorry for the detailed response. I just like to explain to others how I did it for anyone else who might come across the same problem. Thanks again.
