Hi everyone! 
I’m trying to understand how to make an NPC queue system from scratch in Blueprints (Unreal Engine 5.5).
I’m not necessarily looking for someone to fix my current setup — I’d really like to learn how to properly build it step by step.
Here’s what I want the system to do:
- 
NPCs spawn at a set distance in front of the seller (I want to control that distance with a variable).
 
- 
Each new NPC spawns behind the previous one, keeping an adjustable spacing (DistanceBetweenNPCs).
 
- 
There’s a maximum number of NPCs at once (MaxNPCCount).
 
- 
NPCs should walk toward the seller, then stop in line before reaching them.
 
- 
When the first NPC finishes (for example after an interaction), it should move to the side, walk away, and despawn.
 
- 
The rest of the NPCs move forward one position, and a new NPC spawns at the end of the line to replace the one that left.
 
So basically, I want to build a clean queue or line system where NPCs always maintain their spacing, take turns, and recycle smoothly.
If someone could explain how to set up the logic — like how to manage positions, timing, and movement between NPCs — that would really help me understand it.
I’d rather learn the structure and reasoning than just copy a fix.
Thanks a lot for any guidance or step-by-step explanation 
             
            
              
              
              1 Like
            
            
           
          
            
            
              Here’s how I imagine your system in simplest form would look like.
Make independent Manager, Spawner, Que Line, NPC, Seller, and Exit classes that handle their own small task.
- Spawner: An actor indicate location
 
- Que Line: An actor that holds an array of location that can be adjusted by variable (DistanceBetweenNPCs)
 
- NPC: A pawn and AI logics to move to a location
 
- Seller: An actor with a collision to collide with NPC
 
- Exit: An actor with a collision to collide with NPC
 
- Manager: An actor that handles communication between actors. It should hold the MaxNPCCount, CurrentNPCs array, and references to all the system actors on the level.
 
Manager handles spawning
- Manager has a timer event loop to check 
CurrentNPCs->Num < MaxNPCCount to SpawnNPC 
- On SpawnNPC, spawn NPC on Spawner location and track it in CurrentNPCs array
 
- Get
 QueLine->GetLocation(int index) and tell newly created NPC->SetGoalLocation() 
Manager handles spacing
- Make a function 
UpdateQueLineLocations() for updating each NPC in CurrentNPCs.
NPC->SetGoalLocation(QueLine->GetLocation(int index)). 
- NPC on SetGoalLocation would do a AI move to location on that.
 
Manager handles destroying
- Seller and Exit actor should have collision trigger with NPC. OnCollisionEnter delegate an event with an actor variable. Manager should bind events on begin play.
 
- Manager listen to Seller and Exit collision events. This is where your game logic would dictate how it works for NPC and seller. 
NPC->AtSeller() or Seller->HandleNPC() 
- After the NPC is done with seller, another delegate tells Manager to find NPC an exit. Manager remove the exiting NPC from CurrentNPCs. Then call 
UpdateQueLineLocations() Keep track of the exiting NPCs. 
- On Exit’s OnCollisionEnter, Manager remove and destroy the existing NPC.
 
You can modify Manager to have more QueLines, more Seller. And modify QueLines to update its location array. Make Object pools for NPCs.
             
            
              
              
              1 Like