Help Request: Creating a waiting system for a theme park simulation

Hello,

I am currently trying to create a system that mimics the fact that several people are waiting in a line. This involves that they should be able to stop and start moving again when they are required to. To simplify things, each people or group of people waiting in line should never overtake each other. This means there might be an order that each people sticks to. This system should be similar to a waiting line for an attraction in a theme park.

In short, I would like to have advices about how to tackle this problem in terms of scripting in blueprint. (as I am not a programmer)

In your attraction actor:
-add a spline component
-add a “waiting line”-actor array.

Your waiting line actor consists of
-a trigger box,
-a “occupant” reference to a park guest.
-a reference to a park attraction actor

Along the spline of the attraction spawn these “waiting line”-actors and add them in the attractions waiting-line array, so you have an array pointing from the first to the last “waiting line” actors, the first one being the waiting line spot that is connected to the attraction and the last one being the waiting line spot connected to the normal walking areas.

When a park guest wants to enter the waiting line, have the park guest
-look up the attraction actor
-in there look in the waiting line array
-check if the waiting line actor in the last array slot is occupied or not (by checking whether the “occupant” reference is valid). If the first spot is occupied (“occupant” is valid) the waiting line is full and you can make him do something else.
If the last spot is not accupied (the “occupant” reference has not a valid park guest) then he can get in line, aka get the location of the first waiting line spot and make an AiMoveTo that location for the park guest.

In the waiting line actor, have a “OnComponentBeginOverlap”-event for the trigger box.
In that event check if the overlapping actor (“other actor” in the event data) is a park guest (cast “other actor” to “Park Guest” class and check if its valid). If so, set “occupant” to that park guest.
If the current spot is index 0, check if the attraction can be entered. If so, have the park guest enter the attraction and clear the “occupant” reference.
If it’s not array spot 0, check if the next spot towards the attraction (current array index - 1) is occupied. If so, you’re done. If not, tell the guest to move to the next waiting line spot towards the attraction (current array index - 1) and clear the “occupant” reference. That way the park guest will recursively walk towards the first free spot.

In the waiting line actor, have a OnComponentOverlapEnd-event for the trigger box
In that event check if the “other actor” of the event data is a park guest. If so we know that the currently occupying park guest has left the waiting line spot, so clear the occupant-reference.
Look up the waiting line array, get the next waiting line spot towards the walking space (current waiting line spot index + 1) and check if its occupied. If so, get the occupant and tell it to move to this waiting line actor.

When the attraction ends a cycle and all guests have left the attraction, have the attraction look up the waiting line array.
Have the attraction look up whether there is a person in the first spot (array position 0, check if “occupant” is valid). If so, get that spot, get the occupant and tell the occupant to enter the attraction.

That means when the attraction tells the first guest in line to leave the first waiting line spot, it’ll trigger the “OnComponentOverlapEnd”, which clears the reference of the occupant and makes the first waiting line spot tell the second waiting line spot “hey, if you have a park guest, tell him to move to me”. That’ll cause a chain reaction to make all park guests in line move forward one spot. And then it’ll cause another “OnComponentOverlapEnd”/“OnComponentOverlapBegin”-chain reaction until the park guests can’t move further due to the attraction being full or no park guests being in the waiting line.

Maybe i overlooked something or missed something, but that’s roughly what my first idea would be.

I could not expect better in terms of explanation. Now I have a good base to start with. Thanks StefanHohnwald!