How to Adjust Spawn Amounts V3

This page covers how to use the features of Procedural NPC Crowds in Blueprints.

How to use the Spawning Loading Framework in V3:

  1. Navigate to your player character or any actor you wish to manage spawning for.

  2. Add a AC_NPCSpawnActivator component.

  1. In the details panel change the max spawn distance and check interval to your liking.

  1. Now go to your Spawner blueprint, in the demo content, this is called BP_Spawner_V3

  2. Add an AC_CrowdSpawnerV2 component to your spawner if it doesn't already have one.

  1. In the Details panel, select whether you want to use C++ or Blueprint spawning. For single-player games, C++ is recommended as it's slightly faster. For multiplayer games, use Blueprint so you can determine which client or server calls it.

  1. In the details panel, find the Crowd Spawner section and set the variables. They may already be preconfigured if using the demo content.

Note: Is Pawn bool should only be used on the NPC characters as it tells the component to destroy rather than spawn, leave it false on the spawner.

  1. To set up your NPC character:

    1. Add the AC_CrowdSpawnerV2 component to your character.

    2. Set Is Pawn to true.

    3. If you're using the CPP Spawner, the setup is complete, and it should now remove them from the level when out of range.

    4. If you're using blueprints, there's one more step

  2. To use blueprints for spawning and destroying, first disable the "Use CPP Spawning" boolean. Then, scroll down until you see the events.

  1. Use the "On Spawn" event or "On Destroy" event to call the "Spawn NPC BP" or "Destroy NPC BP" node from the event graph, as shown below.

  1. Once completed, you should have either C++ or Blueprint spawning for NPCs in your level. Ensure you follow How to Add to a Custom Level with V3 to learn how to set up the spline for placing spawners and pathpoints.

How to use the Spawn Limiter:

If you need to limit the number of NPCs that can spawn, here is how you can do that. This only works with blueprint-based spawning; C++ spawning is not supported.

  1. Find your spawner actor in your content browser and open it.

  2. Go to the blueprint event where you spawn your npcs.

  3. now search for "ProceduralCrowdsSubsystem" in the blueprint context menu.

  1. Drag off of the Procedural Crowds Subsystem node and call "Limit NPC Spawned" plug it into a branch check with the true being the execution result.

  1. Now go to your NPC character and open it up.

  2. on begin play of your NPC Character call "Increment NPC Spawned" from the Procedural Crowds Subsystem.

  1. Now create the end play event by searching for it in the blueprint context menu.

  1. Call the Decrement NPC Spawned Count on Event EndPlay.

  1. Thats it, your NPC count will now be limited to whatever you set in the Limit NPC Spawned function.

Last updated