How to save Class variables to a database?


I am having a problem saving class variables to an external database. So far I can get everything else in or out but there doesn’t seem to be any way to get a class variable out that I have found.

For example: On load I would like to be able to set the BP class that the Player Character uses out of a series of child Player Character BPs (Warrior, Wizard, etc.). The only way I can get it to work at the moment is to set a separate string (like “profession”) and do a whole series of branches comparing that string to finally narrow down the BP class. (If profession is equal to “wizard” then etc.) This works, and for something like the above example isn’t too much of a hassle BUT…

Now I am working on an inventory and I’d like to get the inventory in and out. It is an array. I may be going about this all wrong but the easiest way I could think of was to populate the array on character load using information from the database. So this is what I am trying to do…

The inventory items are each a child blueprint class of a main World Item class. So to populate I am using “Construct Object from Class”. I was thinking I could just go through the array and “Add” the array objects for however many inventory slots there are (the slots are stored out as another variable presently).

This seems like it would work without a problem but the only way I can see to reference the objects (Using “Construct Object from Class”) is the class variable. I have no idea how to get this variable out to the database as it doesn’t convert to a string or any other storable variable. SO that leaves me to make a side variable to compare it to and that would be ridiculous as the game will eventually have many, many items.

I know there is an easier way but I am too new to this to see it and I am probably thinking about this all wrong. I would appreciate any insight.

I am using a mySQL database, and VaRest to get the info in and out btw. So far working just great for everything else.

Thank you,

1 Like


I want to know the answer to this question too if possible, thanks.