Triggering an event from a collision box

I am trying to make a procedurally generated world where the next two rooms will spawn when the player enters the room leading to them. At the moment I am able to get them to spawn as many rooms as I want by placing a loop on the “Spawn Rooms” function, but that’s not what I need.

At the center of the world is an actor called “Course Generator”. This is used to spawn all the rooms. On “Event BeginPlay” it spawns the first room, then the second two leading off, as you can see below. After that, I want to move into the right room in-game through that door and have the next two rooms spawn.

I have tried varies things, but I can’t get it to work from the collision box. I have tested the collision box is working and that the cast is working by having the player character explode while it goes through and that worked fine, but I can’t get the rooms to spawn for some reason.

I think we need some more info on the rest of the code or where it is failing. We can’t really tell what’s going wrong when what you have given so far works (the collision and event call). Can you simply spawn the rooms without the collision and instead use a keypress after begin play?

doubt youll get a reply there the question is from over two years ago.

its a pretty simple thing though. if they want to have more rooms spawn off the one they just entered, then you would simply need to have a room actor, have a collision volume that cover the entire room, then have designated locations where you would spawn the further rooms. for the script you would have on begin overlap → check is player → for loop → spawn room actor. you would also need to plug in the locations where you want to spawn the room. the locations could be set either with scene components or you could convert local space to world space.

the issue with this approach is that it doesnt take into consideration if overlapping rooms happen. so you may also want to add a step which checks for overlaps where you attempting to place a room. this approach may also lead to a grid style layout so you may want to add in variations to the rooms, some with two exits, some with 3, others like a hall. though that leads to another issue of door placement since you may spawn a room with 4 doors next to a hall which doesnt have a door facing the room with doors.

Oh, I’m quite new to the community and thought I was browsing new threads lol. Glad to see how active you are around here; I hope to share my knowledge as I learn along with others.