Download

Calling Groups of Blueprints

Greetings,

So here is the issue. I have a function that chooses between whether to spawn a room with 1, 2, 3, or 4 doors.

I have BP_1_Door, BP_2_Door, BP_3_Door, BP_4_Door. Each of these are prebuilt rooms. They spawn properly. Now I want to have several available room designs so SpawnActor pulls from a list of multiple BP_2_Door. But I’m kind of stuck at how to do the whole Class thing that calls a bunch of grouped Blueprints.

In case I’m not clear, lets say I have BP_2_Door and BP_2_DoorB and when I get to the SpawnActor function I want it to select between either one of them randomly. But I don’t know how to set up a Class function that links BP_2_Door and BP_2_DoorB into the same thing.

You should try the Select node or use parent/child blueprint.

I use back to back Switch on Enums to choose which tiles to spawn at a given location on a map. Each Enum is for a data type such as Sea Level, Elevation, Temperature, Precipitation, etc. At the end of all the switches, it spawns a corresponding tile.

You could make it really simple though.

So, your Enum could look like:
0 - BP_2_Screen Door >Executes Spawn Screen Door
1 - BP_2_Wood Door >Executes Spawn Wood Door
2 - BP_2_Steel Door >Executes Spawn Steel Door

Somewhere in your blueprint, you set a BP_2 variable which is set to a number 0 through 2, and that variable is plugged into the switch. Then, it is all about how you set that variable. It could be random, or you could put a lot of logic into how you set the variable for more determined procedural results.

Or you could do it array way. Keep all blueprint pointers in array, then get them from array, call, do it in the loop.

Imo foreach loop method is superior:
first you can make array either in defaults or in construction bp, 2 ways to declare constant arrays, both very readable, you can set pointers in one local array, then ids of function called in another. I simplified this way all random events for my game, before i had mess of execution paths, ifs gates select on integer etc. Now i have “build event list” macro which builds it all, then simple loop to play that stage.

with above method, you can have multiple places to play all events (or place rooms etc). All use single data structure. This way you can first play it to make layout, then play again to place detailed decorations, then play again and place enemies.

With execution path approach you need to copy paste whole mess to new places, modify it to new tasks etc. Or make everything in single complicated graph. But what if you want to make layout first, then place detail only during runtime and only around player?