Random item generation design pattern

Hi,

I’m working on a (loot) game and want to generate random loots like in Diablo, POE, etc…

I’m currently struggling with the “good” design pattern to adopt to achieve this in blueprints, I almost get it working but I don’t think my design choices are that good.

Here is what I’ve done so far:

  • Actor Blueprint: BP_Item (base item configuration)
  • Actor Blueprint: BP_Weapon (inherit from BP_Item) (base weapon item configuration)
  • Blueprint function library: LIB_Loots (functions to generate random loots)
  • DataTable: DT_ItemsTypes (one handed weapon, potion, shield…)
  • DataTable: DT_ItemsQualities (common, rare, magic…)
  • DataTable: DT_Items (Sword, Great Axe, Health Potion…)

So in my “GenerateLoot” function (from LIB_Loots) I do some stuff to “choose” the loot and then I get the “Blueprint Class” I have to create (BP_Weapon for exemple) and here my problem (for now)

Based on the class’s name, I don’t know how to Instantiate the objet (don’t need to spawn it)
I first look at “Create Object” node, but it seems to work only for blueprint inherited from Object class (and I read that you can’t use a construct in it ? oO) and my blueprints are inheriting from Actor (here is maybe a mess to start with)

Then I tried to use “Spawn Actor From Class” node, but it seems that I can’t use it in my “LIB_Loots” (blueprint function library), either in my Blueprint actors

To “solve” my problem I need Blueprints acting like Object (but with a construct, as I will generate the random attributes in it) but I don’t know how to do it.

Finally, maybe my “setup” is in the wrong way (and that’s ok), if so do you have any suggestion ?

Thank you for reading !