Download

Procedural rooms generator issues

Hi all.
I am new to UE4 and I am trying to generate a sequence of rooms but I seem to be having issues achieving this. I have an array that has 3 static meshes (3 different rooms with 3 different ceiling heights). I want a sequence to make a BP that every time I am running the game it randomizes the order of how these rooms appear. If a room is generated once it shouldn’t be generated again. A good scenario for the sequence of these 3 rooms is like the one below.
[ATTACH=JSON]{“data-align”:“none”,“data-size”:“medium”,“data-tempid”:“temp_210119_1608676463134_263”}[/ATTACH]
https://forums.unrealengine.com/core/image/gif;base64

I seem to be almost close to the solution but I having an issue with my BP since I am not always generating different rooms as I was expecting according to my BP. BP below:

[ATTACH=JSON]{“data-align”:“none”,“data-size”:“medium”,“data-tempid”:“temp_210120_1608676662224_836”}[/ATTACH]

Even though when I hover over each of the static mesh nodes and the input has a different mesh I get the result below.

fa94d6c4a7a3dd3faeff93560b52a90316de9cd2.jpeg](filedata/fetch?id=1845866&d=1608676752)

Appearing only 1 type of mesh.

Am I missing something here? Is my process not correct in removing the used meshes in between the static mesh nodes?

Any help would be greatly appreciated.

Thank you very much.

Hi man,
pay attention to the “set staticmesh1”,
That node is plugged with the “Get” , and that node is plugged with the “Random Integer”.
Now see how you connected the Get to 2 nodes the “Set static mesh 1” and “Remove”
So the Get will be “Fired” two times, and he will ask for a " Random Integer 2 times" !
And the node will give you two different values ! making you set a varialbe and deleete another.!

I suggest you to just take your array of rooms and use the node Shuffle
This will rearrange your array in a random order,
Than you can just loop for each and set the staticmesh0 to room0 … .

Solved! Apparently, the issue was that once a random mesh has been retrieved from the array of meshes it has to be promoted as a new variable.

Look BP for solution.