Skip to content

Tutorial: Spawn an AI ​

This tutorial uses the FlowPilot_Tutorial level that ships with the plugin. You create a flow that spawns an AI when the level starts, then change where it spawns.

Prep work ​

Open the FlowPilot_Tutorial level. If you play it now, nothing happens besides the player character spawning.

The FlowPilot_Tutorial level.

Create the FlowPilot asset ​

  1. In the Content Browser, create a FlowPilot asset from Gameplay › FlowPilot.
  2. Name it FP_Tutorial and save it.

INFO

Saving an empty FlowPilot asset shows a data validation warning. That is expected: the asset has no Tasks yet.

Run it from an Actor ​

A flow runs on any Actor with a FlowPilot Component.

  1. Add an Actor to the level, and add a FlowPilot Component to it.

    Adding a FlowPilot Component to an Actor.
  2. In the Details panel, set Flow Pilot Asset to FP_Tutorial.

    Linking the FlowPilot asset.
  3. Tick Auto Start On Begin Play so the flow starts with the level.

  4. Leave Execution Mode on Run Once.

Spawn the AI ​

  1. Open FP_Tutorial.

  2. Add a Spawn Class Task: drag it from the Tasks Palette onto the Tree View, or use + Add Task.

  3. In Task Details, set Spawn Class to BP_SimpleAI (included with the plugin).

    Spawn Class settings.
  4. Save and press Play. The AI spawns in the level.

    The AI spawned by the flow.

Change where it spawns ​

The AI spawns at the Actor that owns the FlowPilot Component. Two properties control this:

  • Location Type: World spawns at the Spawn World Location and Spawn World Rotation you enter.
  • Location Type: Reference spawns at the Spawn Location Reference, a Flow Actor Reference:
    • Self: the Actor running the flow.
    • In Level: any Actor you pick in the level.
    • Runtime: an Actor found by GameplayTag.
Spawn Location Reference set to an Actor in the level.

Try each one, then continue with Debugging Flows to watch the flow run.