Storing an array for use later

Hello,

I am trying to figure out how to store an array of items for use later.

I can’t create the variable on the pawn as the pawn dies and the variable is gone. It has to be some sort of global variable that persists through death. Does such a thing exist?

I thought if I could use a hidden storage chest that might work but I can’t figure out how to spawn a hidden storage chest, and I don’t know how I would access it’s inventory if I did figure it out.

I also thought if I were to add a new item to the game for players to build and place and then I could use it, but I’m not sure how to find and persistently track the location of this item, let alone access it’s inventory.

Does anyone have any ideas I could try?

Thank you for your time!

Suppose you can try to make a blueprint contain the array. You can add blueprints to the scene and they will retain their values until the world resets.

You wanna save that array variable in the gamestate. It will persist over death. It will not over game quit.

Thank you for your replies!!! I will see if I can figure out how to save it with your advice :smiley:

Success!

Saving and restoring to functions within the gamestate works. However it appears to require creating a fresh new world. If I don’t then it doesn’t seem to work properly. Is there any way to make it work on an existing world so I don’t have to create a new world?

By world you mean map? Are you doing a TC or a Mod cause I am not quite sure what a Mod is capabale of. If you are doing a TC I might be able to help you, but only when I am back which will not be before sunday.

Yes, map sorry. The Island. It’s just a regular mod for the default map.

I would think mods should be capable of anything a TC is but I’ve never made a TC so I can’t be completely sure.

I was having another issue restoring some of the items from the array. I noticed that some of the properties of the items weren’t possible to bring over because there was no pin on the Add item blueprint for them, such as spoil time, color, attachments, I don’t even know what all has to be transferred. Maybe I would have to parse through them and update them once they are already in the inv, if that’s even possible. Plus there was a property called the Color ID which I couldn’t read because it said it was static. It looked like I should be able to use it since it had the get and set methods for it. There didn’t appear to be any way to set the arrays the same way it gets them from the My Inventory Component which would avoid all that individual property transferring nonsense.

I have tried the playerstate instead of gamestate but that doesn’t seem to work. Casting from the playerstate variable to the playerstate blueprint I created fails. Sorry I don’t have the devkit open to see what the exact names of everything are but if you want screenshots or even the entire mod to look through just let me know and I will do my best.

Thank you, Kenturrac! I look forward to any assistance you or anyone else can provide. I’m really happy it’s working at all after all this work but would love for it to not have to reset the map if possible. It’s going to be sad if I can’t do a simple thing like save an array and access it somewhere else without having to create a fresh new map. Everyone will lose their builds which would suck, but I figured it would happen sooner or later being an Early Access game.

Is there any way to copy/export builds from one map to the other yet? If not is this something a mod can even do?

Thank you!