Get all actors in a level instance

So I have a random level generator which creates two separate corridors which two players race trough. The corridors are created with premade rooms that I load with Load Level Instance (by Name).

I have some events that I only want to apply to only one players corridors, for example slow-motion that affects enemies, environmental objects etc. The event is sent to the game mode which broadcast that event and then the affected actors check if they belong to the correct corridor. As I can’t figure out a way to tell actors inside a room which corridor they belong to during the generation itself my current plan is this:

  • Create a room manager that I put in each room with an array of all the actors in the room
  • When ever a room is loaded the manager adds itself to the game mode and get what corridor is currently being loaded
  • The manager can the apply the tag to the actors in the room
  • Wait until all the managers have been added to the game mode for the first corridor and then repeat for the second

My problem is that I want to make editing the rooms as simple as possible. I don’t want to have to manually add every actor to the managers array. So either the managers would have to get all of the actors in the room without accessing actors from other rooms, or whenever I place an actor in the editor it is automatically added to the managers array.

Looking for any tips on how to solve my issue or suggestions for a more simple solution.

Any advice is much appreciated

1 Like

I can think of two approaches

  1. Have a central actor in each room ( manager ) and all of the changable objects in the room are blueprints. On begin play then consult the manager on what to do. Because you can set the manager on the blueprints when you save the level, I think the objects in the respective rooms will be looking at the correct manager

  2. Other way around, the manger talks to plain meshes with tags. You can have a volume as part of the manager that surrounds the room so it knows which actors to talk to.

In 2, the manager can just start by getting all the actors with tag within its volume.

1 Like

This is exactly what I was looking for. Although I’m a little lost on what the volume would be. Is it a specific volume object or just any kind of mesh? Also how would I get the actors only within the volume, just check if they are overlapping?

The manager is a blueprint, the volume is just a collision box in the blueprint :slight_smile:

and you can

Ok, pretty simple then. Thank you very much

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.