How can I enter data into a Data Table that is based on a struct, which has another struct data type for a variable?
I'm working on a weapon system for a game I'm working on and have run into a bit of a roadblock. What I'm attempting to do is use a data table to house my items for quick data management using CSV files. I have a Stats struct that I'm using to house a number of the combat related pieces of information on the weapons. In the table, this struct ends up being a struct reference variable and when looking in the table, it is displaying each of the variables of that sub struct as one single clump.
I want to be able to create a CSV and drop each value in. Does this mean I'll have to group a bunch of them together or is there a method that doesn't suck to work with that I can use to enter the data cleanly and have it imported?
What I have so far is these 2 Structs:
And I've created these 2 Data Tables. The problem comes with the "Stats" variable in the Main table. I created a second table from the second struct while trying to figure things out so I've included that as a "What the hell." type of bonus.
Any help would be greatly appreciated! And thanks ahead of time to anyone who looks at this and takes a crack at it.
asked Jun 15 '19 at 10:45 PM in Blueprint Scripting
Depends on what you consider clean / sucky.
The Z column above is a material struct that is a part of another struct - that would be the equivalent of your Stats. I created an empty Data Table, added a single row and exported it as CSV - this shows me how the formatting should look like for a nested struct.
As you can see, it spits out quite a bit of gibberish. Luckily this can be cleaned up, I did it for the the Opacity, Colour and Glow. This has to be done only once and once you have a clean line with correct formatting, it can be duplicated freely, populated cleanly-ish with the desired data and reloaded back into the Data Table. It is still a clump but I found it quite manageable.
In case you want to store arrays of structs inside another struct, avoid CVS. Go for *.jsons - way more manageable.
Also, there are some changes heading Data Table ways, some really needed QoL improvements, like copy-pasting rows.
answered Jun 15 '19 at 11:28 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here