Save actor's destroyed(picked) state between levels

The one that starts with begin play

Hmm that should work. It worked on my end. Send a picture of your begin play function in the level blueprint. Would it help if I made a sample project and put it up on a google drive to download so you can take a look at all of the code going on?

That would be great. Then I could see the exact mechanics in action an see what’s causing mine issues
I’m on engine 4.12 if that’s any help with the issue

Okay I’ll have it done by tonight. I’ll keep all of the blueprints I make in the same place as the first person character bp

That’s the link to the download for the project.

ok im lookin at this now and its startin to make more sense when im seeing it in action ill work on this and see if i can impliment it.
altho why are there now 3 actors on the level?
the pick up actor
the items destroyed actor
and now also an inventory actor

Ok mate I added all this and i got it to save the items destroyed
only now a few things happened the items didnt got to my inventory (i fixed that one tho) when i press the save button my toon teleports back to the start position
and when the game loads, it loads with all the destroyed actors gone, but they are also gone from my inventory
do i need to add something to the user index on the load game from slot or something to fix this?

I also have an inventory array variable in my save bp aswell, i think thats what i neem to get my inventory to actually load and save, but where in those new load and save functions you made would i add that array?

sorry im being such a pest to ya mate btw

It’s no problem. Your inventory isn’t saving because you need to set the save variables to match the inventory ones in the save function. Also you need to save your players world position and rotation if you want to load them later. The way that saving works in a game is the following:
you aren’t actually saving any data outside of your save bp. You are cloning all data from other places and then cloning them back when you load. I know it’s tedious, but everything must be saved to load it later.

Also there is a third actor in the level because I prefer to keep all of my inventory variables separate from my FPCharacter blueprint for easier data management. It prevents the FPCharacter bp from becoming too cluttered. that actors sole purpose is to store all of the inventory items. Also note: the item actor that is in the level is NOT the same as the inventory struct that you are adding to your inventory struct array. They are completely different and hold completely different data.

I can upload an amended project that addresses those last issues if you want

ok i think i have it all sorted, my character now saves the items in my inventory and the items destroyed are also saved.
I had to work around this ( i;m probly doin it the wrong way but so far its workin lol) by having 2 saves, your suggested save now works for saing items destroyed in level, and the second save is the old one i had for saving the gear in my inventory and itseems cause they both use the same save slot name the load attached to begin play loads them both and now when i stop and start the level and reopen maps the items stay in my inventory as meant to and the items in level stay destroyed.

like i said probly the wrong way but its workin :stuck_out_tongue:

you gotta save rotation and position aswell? omg UE seem to be goin out of their way to make saving so hard n tedious

i suppose that includes the armour and weapons a character wears has to be saved too? smh lol oh i feel a migraine comin on

Well you can consolidate the two saves and you should definitely! there may be a point when they both try to save at the same time and it will corrupt data. And yeah it is tedious but EVERY game engine is like that.
In fact any piece of code is like that. While programming, you have to account for EVERY bit of data and address it by each variable. There’s no way around that. Once the concept settles in, it’s really not a headache, I promise. You get used to it and expect it eventually.

But long story short, yes. You need to save every variable that you want to load. It’s like making a sandwich. Most people would say:
first you get the bread, then you get the peanut butter, then then knife and then you spread it and eat it. In programming it’s more like: First you flex your arm, then you raise it, then you move your fingers, then you move your arm, then you touch the jar, then you grab the jar, then you lift the jar, etc. etc.

I’ll upload the amended one. Also I changed the load function! the foreach loop completed wire should be the one that continuies the function

Hmm guess i’ll look up some info and tutorials into doin some of that stuff

just 2 more questions mate then i’ll leave you in piece.

can all these variable be added to the save and load function you gave me like characters location?

and second now i have the level save sorted out for destroyed actors. how will i add this to all other levels i make?
do i just have to add the destroyed actor bp to the level or will something else be needed?

Yes they can. In fact they should. You can just keep adding variables to the save function right before the Save Game to Slot node. Just remember to duplicate that variable in your savegame bp so that it has something to reference when saving. Ive added this to the amended project.

You’re exactly right. just add the same actor to each level. All it does is track data and its empty except for the code. The reason you do it like this is because the code is not activated UNLESS its a “live” actor in a level. So you make code that sits in the level waiting to be called. If you just make a blue print and all its doing is sitting in your content browser, it is never active in game. This method is important because good code is simple and has simple functions in many different places to be called rather than one giant complicated function in one place. Its easier to organize and reuse code this way.

This is the link to the amended project:

Funny enough I came to this page because I was looking for a solution to the same problem a year ago. And when I saw the original question I kind of came up with a solution on the spot that obviously didn’t actually work in the application. I actually never had this working fully and working through this with you has actually got this working for my own game lol :slight_smile:

on which stream of the “save to game slot” do i add the variables? your save function has 2 streams to it lol
what dont the variables have to be somewhere on the load function aswell?

Both streams because one is for “if no save data exists then make a save slot” and the other is for “if save data does exist write to that slot”. Both are needed to have a full save system and both streams are pretty much a copy of the other that run on the condition of if save exists or not. And the load function does have those variables being set, but the save function and the save game bp are two different things. One is the function and one is the blueprint that holds the data

LOL then we both benifited from this, thats good to know :stuck_out_tongue:

Thanks mate i really appreciate all this help and info i’ll leave you alone now since we pretty much turned this question page into a full book lmao. thanks again bud i owe ya one.

thats the game im workin on if ya ever wanna keep an eye on it lol

LOL be glad there is no option for private messages here mate or id hold ya to that an really end up torturing ya lmao