Ahhhh here we go. SO!
You create spawners!
Make an actor. Base actor. Let’s call it “BP_Spawn_Parent”.
Give it a collision volume as large as you want the distance to be.
When the player overlaps that collision volume, using OnComponentBeginOverlap, spawn your NPC using SpawnActorFromClass!
Set that spawn as a variable in the spawner actor. That will be on the Return Value of the SpawnActorFromClass node. What this does is sets your spawned actor as a variable- you’ll see why in a moment!
Next, make your variable for the actor to spawn. Make it a variable of “Actor” so you can pass ANY actor or their children in here, and make it a class, so the violet option. Then click the eye, so it is instance editable. This means any copies can have different values. It should look like this:
You’ll use the actor’s spot as the Spawn Transform for the Spawn Actor From Class node.
Lastly, as the first part of the Event, add an “IsValid?” check and pass in “Spawned Actor”. On True, which means the actor is spawned, you do nothing. On False, just spawn, because there isn’t one already there. What this does is make sure when the players run away and come back, it doesn’t cause them to multiply the spawn and put more instances of the actor there when there is meant to be only one.
You should have something like this:
Let me know when you get all of this done, and I’ll show you how useful this is when creating children! All you have to do is change ONE value and it will create a new spawner for a different type of NPC.
Then after that, I’ll show you how to cull actors beyond a certain distance. As long as they have a spawner, they’ll come back when they’re needed!