Setting ItemInfo In Randomly Generated Class


I am working on a system where an actor in the game world is set to a random class (BaseWeapon, BaseArmor, BasePotion, etc) and when the Actor is picked up, it is placed in the appropriate slot. I have got the random class portion working. I put several of the Pickup Actors in the level and added a print string for debugging. When I interact with the Actors, it will randomly select one of the three classes. That is working great. The issue is that the rest of the Item Info for those random classes is being set to the Item Info stats for the Pickup Actor. The way I have it connected now is all of the Item Info pins (ItemName, ItemType, ItemRarity, etc) for the Pickup Actor are connected to a Set Item Info node, except for the Item Class which is randomly generated.

I am thinking that I need to set the Item Class first, then get the Item Info from whatever random class was chosen and then set the Item Info that will be placed into the inventory. Am I on the right track here or am I way off?

Any help would be appreciated.


I remember doing this ItemInfo Quest System Video Tutorial, i think it was from Titanic Games, I coudn’t get the item slot switching to work to transfer from the inventory panel over to the preview panel and then put the weapons unto my own character. It wouldn’t swap over the items. because the whole system relied on swapping everything over from the inventory panel and it took five hours to wire it all up and enter in all of that code for that system. I still don’t know what’s wrong with it or where the trouble is coming from, so I abandoned it and just left the way it is in the game for now until I can get more knowledge on how to fix it.

Is it possible to access the variables in an Actor Blueprint from the Actor’s class? For example, I am randomly generating a class to be be added to my inventory, but I want the Item Info from the generated actor to be set to the item info for my inventory.

This is probably the same trouble I’ve been running into that prevented the inventory system from working properly So when you generate a new actor item is it being put under a different iteminfo class variable and not being put under the inventory item info class variable? Because I was getting an error ‘Iteminfo variable already exists in another bp, you cannot use the same name.’ I was running into this kind of trouble. So I continued to try to code it, only to find the inventory slots couldn’t work because
the iteminfo class was pointing to a different iteminfo class other than the main iteminfo inventory class and I didn’t know how to change it.

If you put ItemInfo in the base class, all child classes of that base class inherit the ItemInfo variable so you don’t need to create it again. If you can see it in the panel, go to the eye-shaped icon near top of panel and click “show inherited variables.” If you look in details panel of your child classes, the ItemInfo is shown even if the “show inherited variables” is not active.

I think we are talking about two different things. In your case, you want to take the ItemInfo from the actor picked it up and send that information to the inventory and to the inventory slot.

What I am attempting is having a class randomly generated when an actor is picked up, then getting the Item Info of that generated class and sending it to inventory and slot. I’m running into the problem of not being able to access the Item Info from the random class that was generated. So I just made a static mesh to serve as my pickup mesh and placed that in my baseItem class. So all of my child classes have a static mesh that serves as the pickup mesh and a skeletal mesh that will be the equipped armor, weapon, etc.