Hi guys,
this has bother me quite long, probably some of you can give some help here,
I am creating a game that relies a lot on data, not spawned actor.
I have an Array of Class, in the array let’s say i have Sword/Spear/Knive
each of the item there is child from master weapon class it has data structure variable inside about the damage, durability, etc.
I can access the struct value if i spawn actor from class then cast the actor to “master weapon class” from spawned object/actor class
however i don’t want/need to spawn the actor, but i need to access the struct value directly from the class itself
It feels stupid that i can’t access the data from itself, or i don’t know how
The simple question is can i get my variables inside the structure in the class from the class itself
Instead of an array of class you’re better of looking at data tables. I use them a lot for strategy games. They take a struct for columns and you use them via rows. It’s far more powerful than an array of Class.
I think they reside in Misc. (Contents → new → Misc… Datatables) and take a Struct to be constructed. You use them with “Get Row” or searching “data table” in blueprints.
Lets say i have an array named ALLKNIVES contains
*Knive_Blue
*Knive_Red
*Knive_Green
They are all ObjectBP, created as a child of Knive_Master
Knive_Master has BP_Structure_Knive variable based on a blueprint structure, contains
*Damage
*Durability
And lets say we do For each loop of array ALLKNIVES, it will loop 3 times and have each knive as the output object every cycle
then
i cast the object to Knive_Master in order to get BP_Structure_Knive variable so i can break it and get the knive damage and durability value. But it failed
This works if the object is an actor which needs to be spawned to the world, but it’s failed, probably because it’s an object data type