Hey guys, I’m trying to pick up learning the RAIN system again after putting it down for a while to work on another project. Right now I’m running into a bit of a problem with understanding how to correctly interrupt running nodes based on input the AI gets. To be more specific, here’s the base situation:
I’ve got a melee combat system. When the AI is in combat range of the player, he can do several proactive actions:
- Walk back and forth around the player
- Idle for a short time
During these actions, he also needs to react to things like an attack from the player.
If the enemy is currently walking or idling, the moment the player initiates his attack (clicks the mouse button), the AI needs to stop what he’s doing and jump to a decision whether to respond by:
- Do nothing
If the enemy is currently in the middle of an attack himself, he can’t respond.
Then if the player attack actually connects with the enemy’s body (measured with colliders), no matter what state the AI is in, he needs to jump to the node that registers the damage taken (and everything that comes with it, like animations and sound and stuff.
Now, I’m having some trouble understanding the logic on how exactly to signal the behavior tree that the current action needs to stop and something else needs to happen.
From reading around the forums and tutorials here I think I have to put all the actions under Constraints with booleans in order to interrupt them at specific occasions? Could someone tell me if I’m thinking in the right directions, and maybe help out with some behavior tree structure based on the situation I sketched? That would really help me out tremendously.
Thanks in advance!