Blueprint receives multiple static meshes to spawn a specific bp

Hi, I’m trying to make a game that’s similar to a cooking game. The players insert multiple objects into a pot, and the pot spawns a corresponding blueprint actor. I’ve seen sequences with arrays where a random actor can be spawned but not a specific one. Any suggestions?

There are many ways to do this depending on how modular or strict you want your game to be. If you have a predetermined set of recipes, you could do the following:

Every ingredient gets assigned a unique ID
Then create a Map variable with String as the key, and Actor Class as the second value. Lets call it RecipeMap.
Then populate your RecipeMap by creating keys using the various ID combinations

Example:

Batter, ID=0
Egg, ID=1
Cinnamon, ID=2

Create RecipeMap entry with key “0,1,2” and then assign the actor class to “BP_Cake.”

There are several problems with this though - first, you will have to hand-create all possible permutations based on ingredients, so the more ingredients, the more entries on that table. Second, you will have to come up with a ruleset to create the keys. For example, there is a key for “0,1,2” but not one for “1,0,2” (even though they have the same ingredients). So perhaps you order your IDs from smallest to largest to get around this problem.

Another approach would be more procedural - this gives you more flexibility, but it takes a lot more thinking to design right. Perhaps your pot can contain an array where all ingredients are added (still add IDs to the array). Then using some ruleset use “Contains” to look for ingredients in the array (pot) and decide what to spawn from that.

When you figure it out post in this thread and let us know how you solved it :).