Language:
Page Info
Engine Version:

9. Behavior Tree Setup

Choose your OS:

Since you already have all the assets necessary to fill out the tree, you're going to be building this Behavior Tree:

finalBT_Setup.png

Before we get into the steps to create this Behavior Tree , let's talk about what it does (or rather what it will do once we create the necessary EQS bits).

  • We enter the graph at the top Sequence Node, and then start executing it's children from left to right, and will keep executing as long as its children are successful.

  • First is the EQS Query node that runs the FindPlayer template. We only allow this node to execute once every 0.5 seconds, and if it fails, the tree is locked out of executing the other nodes by the Cooldown Node returning failed, thusly failing its parent sequence node.

  • But, if the EQS Query is successful (it finds the player), then the second EQS Query is allowed to execute, finding the AI a place to hide.

  • Finally we move to the place that the second EQS Query found.

Steps

  1. Double-click the RunnerBT Blueprint in the Content Browser to open it for editing.

  2. Add a Sequence Node (right-click in the Graph Area arrow_button.png Composites arrow_button.png Sequence)

    addSeq.png

  3. Connect the Root Node to this new Sequence Node

    connectSeq.png

  4. Create a Run EQS Query Node (right-click in the Graph Area arrow_button.png Tasks arrow_button.png Run EQSQuery)

    addEqs1.png

  5. Connect it to the Sequence Node

    connectEqs1.png

  6. Select this Run EQS Query Node, and in the Details panel, set the Query Template to FindPlayer

  7. While still in the Details panel set the Blackboard Key to ActorToFleeFrom

    setEqs1props.png

  8. Add a Cooldown Decorator to the Run EQS Query Node (right-click the Run EQS Query Node arrow_button.png Add Decorator... arrow_button.png Cooldown)

    addCooldown.png

  9. Select the Cooldown Decorator and set its Cool Down Time to 0.5

    setCooldown.png

  10. Create another Run EQS Query Node (right-click in the Graph Area arrow_button.png Tasks arrow_button.png Run EQSQuery)

    and connect it to the Sequence Node

    addEqs2.png

  11. Select the second Run EQS Query Node, and in the Details panel, set the Query Template to FindHidingSpot

  12. Again, while still in the Details panel, set the Blackboard Key to FleeToLocation

    setEqs2props.png

  13. Position it to the right of the first Run EQS Query Node

  14. Create a Move To Node (right-click in the Graph Area arrow_button.png Tasks arrow_button.png Move To)

    addMoveTo.png

  15. Connect it to the Sequence Node

    connectMoveTo.png

  16. Select the Move To node and set Blackboard Key to FleeToLocation

  17. While still in the Details Panel, set Acceptable Radius to 0.5

    setMoveTo.png

  18. Position it to the right of the second Run EQS Query Node

    finalBT_Setup.png

With everything connected the Behavior Tree will is ready and no further edits to it will be necessary.