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.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #34802

    Moloch
    Participant

    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?

    #34811

    prime
    Keymaster

    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.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.