This feature is in Beta. You can publish an island with this feature, but be aware that changes may break your island and may require your active intervention.
With the NPC Spawner device, you can create unique creatures, enemies, and more with engaging roles that bring your gameplay to life. These non-playable characters (NPCs) can have health, patrol set paths, and even aid players in solving puzzles. Use this device to assign scripts and NPC Character Definitions that you can reuse across multiple NPC Spawner devices.
Include NPCs, characters with artificial intelligence (AI), in your gameplay to add an extra layer of immersion. You can customize NPCs to perform various actions, from reviving teammates to following players.
The NPC Spawner is different from the Character device, in that you can make custom configurations that alter how a character looks, moves, and behaves with the NPC Spawner.
The Character device, like the Guard Spawner device, is useful for a singular instance of a basic character. However, both are limited to Fortnite outfits. The NPC Spawner device can create instances of characters with either Fortnite uniform guards, wildlife, or custom NPCs with user-imported meshes'.
This is currently an Unreal Editor for Fortnite (UEFN) only device located in All > Fortnite > Devices > !Beta > NPC Spawner. limited to Fortnite outfits.
Using Brand Specific NPCs
Custom-branded NPCs are available in the NPC Spawner through a character definition.
Depending on the IP, you can find the unique NPCs in one or both of the following:
The NPC Character Type which can include unique modifiers.
Through the Cosmetic Modifier when selecting a Custom or Guard character type.
Branded assets have specific rules and guidelines for use. Check the brand rules for the IP assets you intend to use. To learn more about the various brand partners and content, see Game Collections.
You can only use brand assets in a project specific to the relevant IP property.
Contextual Filtering
Some devices are affected by a feature called contextual filtering. This feature highlights or shades options depending on the values selected for certain related options. This feature reduces clutter in the Details panel and makes options easier to manage and navigate.
User Options
With the User Options settings, you can set the spawn conditions, reference character definitions, and designate functions and events.
The default values are bold. Values that trigger contextual filtering are in italics.
Option | Value | Description |
---|---|---|
Spawn Count | 1, Type an amount | Sets the number of NPCs this spawner can have active at any time. When the spawner activates, it produces one NPC at a time. |
Spawn Through Walls | True, False | Determines whether NPC must spawn within line-of-sight of the spawner or if they can spawn behind obstructing walls. |
Spawn Character at Game Start | True, False | Determines whether the spawner is already enabled when the game starts to spawn NPC characters. Set this to False to have an animated character. |
None, Select a script | Overrides the default or assigned behavior of the NPC Character Definition assigned to this device. | |
NPC Character Definition | None, Select a Character Definition | Sets the character definition for spawning NPCs of a specific character type. Select from an existing character definition or create a new one from the dropdown. If you drag an NPC Character Definition into the viewport, this field is automatically populated. |
Additional NPC Character Modifiers | Add an Array element | Adds an extra list of modifiers to apply to the NPC. The character type you select in the character definition affects the available list of modifiers. To add a modifier, click the plus icon, and then select from the Index dropdown. Additional options for the modifier become available. Modifiers you assign to the device overrides modifiers you assigned in the Character Definition. Visit the NPC Character Definitions documentation to learn more about modifiers. |
Allow Infinite Spawn | True, False | Determines whether the spawner has a total spawn limit or not. |
Total Spawn Limit | 1, Type an amount | sets the maximum number of AIs this spawner can produce during its lifetime. |
Spawn On Timer | True, False | Determines whether the AI is spawned on the Spawn Timer countdown or spawned on events. |
Spawn Timer | 3.0s, Type an amount | Sets the minimum time between spawning AIs. |
Show Spawn Radius | True, False | Determines if the spawn radius will be shown or not. |
Spawn Radius | 1.0m, Type an amount | Sets the maximum distance from the device that AI can spawn. |
Despawn AIs When Disabled | True, False | When the device is disabled, this determines whether AIs remain spawn or despawn. |
Direct Event Binding
Following are the direct event binding options for this device.
Functions
A function listens for an event on a device and then performs an action.
For any function, click the option, then Select Device to access and select from the Device dropdown menu.
Once you've selected a device, click Select Event to bind the device to an event that will trigger the function for the device.
If more than one device or event triggers a function, press the Add button to add a line and repeat these steps.
Option | Description |
---|---|
Enable | Enables this device when an event occurs. |
Disable | Disables this device when an event occurs. |
Spawn | Spawns AI on this device when an event occurs. |
Despawn | Despawns AI on this device when an event occurs. |
Reset Total Spawn Count | Resets the count for the Total Spawn Limit when an event occurs. |
Events
Direct event binding uses events as transmitters. An event tells another device to perform a function.
For any event option, click the option, then Select Device to access and select from the Device dropdown menu.
Once you've selected a device, click Select Function to bind the timer to a function for that device.
If more than one function is triggered by the event, press the Add button and repeat.
Option | Description |
---|---|
On Spawned | Sends an event to a linked device when a player interacts with the button. |
On Eliminated | Sends an event to a linked device when a player interacts with the button. |
Using The NPC Spawner in Verse
You can use the code below to control an NPC Spawner device in Verse. This code uses all features of the NPC Spawner device API. Modify it to fit the needs of your experience.
using { /Fortnite.com/AI }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# Visit [here](https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse) to create a verse device.
To use this code in your UEFN experience, follow these steps.
Drag an NPC Spawner device onto your island.
Create a new Verse device named npc_spawner_device_verse_example. See Create Your Own Device Using Verse for steps.
In Visual Studio Code, open npc_spawner_device_verse_example.verse in Visual Studio Code and paste the code above.
Compile your code and drag your Verse-authored device onto your island. See Adding Your Verse Device to Your Level for steps.
Select your Verse device in the Outliner.
In the device’s Details panel, assign the object reference for the NPC Spawner to the NPC Spawner device on your island. You can use the eyedropper to pick the device in the Viewport or use the dropdown to search for the device.
Save your project and click Launch Session.
NPC Spawner Device API
See the npc_spawner_device
API Reference for more information on using the NPC Spawner device in Verse.