I’m very new to UE and Blueprint. A large part of the game I’m making requires the player to combine different elements to create new ones (i.e. chocolate & vanilla to make a new, swirled flavor). My best assumption is that each element would be a different actor, and scripted to react to each other. I just have no idea how to do it.
More assumptions: this ‘combining of assets’ mode can be triggered at a certain space (i.e. a specific countertop). I would need to give the player control over these elements, and be able to allow the player to access these elements through some sort of inventory.
I have looked through several video and written tutorials, but I’m still a bit lost. How would you go about approaching this?
What exactly is your use case?
I would use an interface “Combinable” for example.
This has a function “CombineWith” with an object reference or class as input.
As Return you have a class(the new combined) and a boolean.
Being these objects actors is not necessary (because you only use them in the inventory I guess)
The body of this function checks if the input is of a certain Type.
If it is, you return a the new type. and true(indicating you can combine them)
If not, you return nothing and false, indicating you can’t combine them.
Make sure you can combine both items with the same item.
Chocolate can be combined with Vanilla
Vanilla can be combined with Chocolate
When calling this function check if the class is valid and you have a success. Then you can remove both items and spawn a new one with the class.
Thank you so much! I’ll give this a shot. I’m not sure what you mean by use case.
What exactly do you want to combine for example.
I want to create an ice cream store that can be run by the player. So the elements I was asking about earlier would be the flavors and flavor combinations. Does that help?