Language:
Page Info
Engine Version:

12. Make a Task

Choose your OS:

Tasks are nodes that "do" things, like move an AI, or adjust Blackboard values. They can have Decorators attached to them.

This Task is basically a re-creation of the Move To node, with one major difference: this Task will have the AI always run towards the Player's Pawn, instead of its location. Also, it helps to break things down and see that if you don't ever execute Finish Execute the Task Node will continue to process, and the AI MoveTo node shows this perfectly.

Steps

  1. Open the FollowerBT Behavior Tree by Double-clicking it in the Content Browser.

  2. Click New Task button.

    It will create in the same folder as the Behavior Tree.

  3. Rename it in the Content Browser to "RapidMoveTo".

  4. The editor should have already opened it for editing, but if not, Double-click it in the Content Browser.

  5. Create the following graph:

    Copy Example

    Click the image to expand it, or click here to open it in the window.

    variables.png

    The variable names, types, and values for this Blueprint:

    Variable Name

    Type

    Value

    AI_CON_Ref

    Follower_AI_CON_C

    None

    TargetToFollow

    BlackboardKeySelector

    None - However, this variable has its "Editable" flag set to True so you can change it, per instance, on the Behavior Tree.

Here is what is going on in this graph:

  1. The Event Receive Execute is the event that is called when the Behavior Tree runs this task node.

  2. We store the Follower_AI_CON like we did in the previous step.

  3. The Cast to Actor node pulls the "TargetToFollow" object value from the Blackboard and casts it to an Actor so we can use it in the AI MoveTo node.

  4. On success, the task will run the Finish Execute node successfully.