procedural room spawing

Hello all! I had a question for a Blueprint I am working on at the moment. I have attached photos below, but basically what I have going on is a room that creates an exact copy of itself once the player touches a collision box. After walking forward further, they touch a second collision box that destroys all assets of the BP. What I would like to know is how can I modify this code to either
A: only spawn a certain number of rooms before stopping the spawn logic, as right now the player becomes trapped in an infinite hallway.
or
B: How to make new hallways spawn that could lead the player in different directions I.E. by adding corners or different hallway models to pull from. Right now the logic just tells the code to spawn the new hallway -200 units on the x access each time, so I assume this would be simple, I just haven’t puzzled out how to make it work yet.



Instead of progressively destroying components, you can just destroy the actor :slight_smile: ( one call ).

To make the game vary, you either need to change the rotation you’re spawning at, or have more models you can choose from randomly.

As for stopping after a while, just set a counter. Each time a spawn takes place, increment the counter. Don’t spawn when the counter reaches a certain amount.

I made a maze that works this way ( in this vid ):

I can tell you that you only need a few pieces to make a very confusing experience. But, choose your pieces carefully. Also, if you destroy too soon, the player can see, but if you destroy to late, rooms can end up overlapping… :slight_smile: