Best way to save Character and specific items

Hi There,

I need to save and load many characters (done, no problems there), but each character needs to save specific items chosen by the player, and each character could have 4 of of 20 items specific to its class. Currently I use an array within a struct within a save game object to save characters but each character needs to have svae array of specific items with it(or specific to that character instance). I tried adding an array to the character parent hoping each child saved will keep its array of items but no dice on load.

Is there a way to do this, been trying to figure this out but hitting dead ends. Maybe somebody has an elegant solution that I havnt thought of yet.

Hope this makes sense.
Thanks in advance to helpee’s

What I may need is something like a container holding a list of array’s in my struct… so char with index 0 corresponds to array 0 in container A

Just a hunch, you may be experiencing issues with setting values of an array in your custom struct. Your issue may be irrelevant to your game save data because the array in your struct might not even be set in the first place. I can’t recall the specific user, but they discovered that when fetching arrays from structs it only provides you with a COPY of that array and not an actual reference. So editing the array directly in the struct is fruitless because nothing is actually referring back to the array. Check your array values right before you send it to your save game object to write to memory to see if your data is as expected. I’ll let you know a work around for this if you need it.

Hi MK,

Thanks for the reply.
Seems I wasn’t able to save out actual items for some reason, but I could save the images that reference each item.
I was then able to save out an array of images for all characters and with some complex math I can get ref images based on the character save index.
The long way around but working…
Solved I guess.