News › Forums › RAIN › General Discussion and Troubleshooting › Incorporating special attacks to BT
This topic contains 1 reply, has 2 voices, and was last updated by prime 2 months, 2 weeks ago.
December 16, 2022 at 7:20 pm #34802
I have two main behaviour trees, one is for thr character and the other is for the ai enemies. Most of the trees is the same, but the ai has a few custom actions for decision making. Regular attacks are easy to handle. I use a BT that decides which weapon type the character is using and then a random node chooses the animation variant. What I want to do now is to add special attacks. And given that I have a dozen of them prepared and am working on more, I am unsure as to how to add these to the BT. I can add the ability to decide to use them to the custom decision making script, but how to add them to the tree? Do I have to add them one by one? I think that would not be optimal for larger amounts of units. Is there a trick I am unaware of?December 17, 2022 at 7:57 am #34811
Are the special attacks specific to individual units? Are you trying to re-use most of the behavior tree for all the units, but then have specialized parts of the behavior tree for individual types?
If so, then you’ll want to use Binding nodes in your behavior tree. Binding nodes serve as placeholders for behavior trees that will be specified by the individual AI. When you add a binding node, you specify a binding name. When the behavior tree is assigned to your AI, you will notice that additional slots appear in your AI Mind inspector that allow you to select behavior trees for each of the binding names you are using.
For example, let’s say I have a behavior tree called Attack that has most of my AI behavior, including default attacks and animations. Then for Wizards I have a special ranged magic attack, while Archers have a different ranged arrow attack. I would then add a BT Binding node to my Attack tree and call it “Ranged”. Then when I click on the Mind of my Wizard, once I’ve assigned the Attack behavior tree a new slot called “Ranged” will appear. I can then assign the RangedMagicAttack behavior tree to my wizard. If I assign the same Attack behavior tree to my Archer, I can assign the RangedArrowAttack tree to its Ranged slot.
Let me know if that’s what you were looking for, and if I’ve explained it clearly enough.
You must be logged in to reply to this topic.