I am building a BT for a space ship. It's main purpose is to find a planet, look at what the planet has to offer and trade. Go to another planet and sell.
That part of the BT works fine.
I now want to add a behavior so if someone attacks the ship, it starts to run away from the attacker. I already implemented a Flee action but I am confused on how to incorporate it in my tree.
The issue is that I don't know how to combine parallel and/or interrupt so it will work? Some tasks will run for a while. I have a Goto action that keeps running while the ship moves towards a planet. This can take up a few minutes.
I don't know how I can create a branch in my tree so it keeps on checking if I'm attacked so it know it needs to interrupt whatever he is doing and move to another tasks.
Later on I want to add a IsHostileInRange condition that needs checking every time and will trigger another action.
That part of the BT works fine.
I now want to add a behavior so if someone attacks the ship, it starts to run away from the attacker. I already implemented a Flee action but I am confused on how to incorporate it in my tree.
The issue is that I don't know how to combine parallel and/or interrupt so it will work? Some tasks will run for a while. I have a Goto action that keeps running while the ship moves towards a planet. This can take up a few minutes.
I don't know how I can create a branch in my tree so it keeps on checking if I'm attacked so it know it needs to interrupt whatever he is doing and move to another tasks.
Later on I want to add a IsHostileInRange condition that needs checking every time and will trigger another action.