Version:

Creating AI Spawn Points

Creating AI Spawn Points

You can use AI spawn points to define the exact location that an enemy AI appears in the level when activated.

To create AI spawn points

  1. In the viewport, right-click in the center of your maze and choose Create entity.
    [Image NOT FOUND]

  2. In the Entity Inspector, name the new entity AiSpawnpoint01.
    [Image NOT FOUND]

  3. Click Add Component. Under the Gameplay category, click the Spawner component.
    [Image NOT FOUND]

  4. In the Spawner component, next to Dynamic slice, click (...).
    [Image NOT FOUND]

  5. In the Pick Dynamic slice window, navigate to StarterGame\slices. Select ai_slice.slice and click OK.
    [Image NOT FOUND]

  6. Add a Lua Script component to the AiSpawnpoint01 entity. To do this, make sure the AiSpawnpoint01 entity is still selected in the Entity Outliner. And then in the Entity Inspector, click Add Component and then click Lua Script.

  7. To add the script to the Lua Script component, next to Script, click (...). Navigate to StarterGame\Scripts\AI. Select AISpawner.lua and then click OK.
    [Image NOT FOUND]

  8. In the Lua Script component’s GroupId box, enter Group0.

    This links the Spawner component on this entity to the AiTrigger entity’s Lua Script component, telling the trigger what group ID to spawn.
    [Image NOT FOUND]

  9. Press Ctrl+S to save your level.

Next: Adding Patrol Waypoints