x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to save Class variables to a database?

Hello,

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,

-Tom

Product Version: UE 4.18
Tags:
more ▼

asked Jan 30 '18 at 08:52 AM in Blueprint Scripting

avatar image

Valgrim Ladrona
3 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question