why dont you make an Inventory Struct Array that contains the ItemId (index on a bigger item Array) and CategoryId. on sell action, fetch items in your inventory of that category.
Hi, I’m trying to find a way to show and make editable certain variables depending on enum value.
I have a “MasterItem” BP with punch of variables it gets from a structure and I want to hide all variables I don’t need for my item. Here is an example, enum1 = weapon, enum2 = armor, enum3 = healthPotion
enum1 exposes weaponType, range, damage, sellValue
enum2 armorType, protectionRate, sellValue
enum3 health, cooldown, sellValue
I want to do something like this and hide all other variables from the list that I do not need to see for that item. Is that possible in BP and how to do it?
I am very early into development and I just want to hide unneeded variables for the items I’m making, currently have just a few test items. Hiding unneeded variables would make it look cleaner and only show me variables that are needed for current item.
I don’t mean to hide it from the engine, just from user, don’t like seeing a ton of variables if i only need say damage and range values for a sword.
i dont think you can hide it from the engine so instead, i would filter it.
and to do that you need to filter it using some sort of logic, thats why i suggest you using a categoryId.
**other approach would be to set different parent classes (weapon class, item class, etc etc) and set the parent of each item to that class. on get all actors of class you would use the parent and it should fetch up those children. havent done it before but thats the theory. it “should” work, if you dont want to use structs (could even be more efficient too) DONT, wrong approach
If you having useless variables to specific types of classes then it means you need to create sub base classes thats common practice since first versions of UE, make base class for a weapon and for armor or whatever you got more. You can also place some base code, for example in case of armor you just make armor giving code ins armor base class and in sub classes you only set mesh and varable on how much armor to give.
i was wondering about that. i get the concept of parent/child class, and in theory you could access the children knowing the parent but i cant seem to find a node or function that lets me check if the children’s parent is “insert parent here”. im using blueprints, or this is c++ functionality only?
still not sure if im implementing this correctly (very beginner in ue4). Parent class: Weapons, Child:Dagger. Dagger has its own values, like damage, mesh, etc etc. any child of parent class Weapons can be added to the Array of class Weapons. later on, on whatever logic you use that you need to showup only the weapons, you take them from the weapons array. hope it helps
Thanks, I will try it out when I get some free time.