how to add destroyed actors to a destroyed actor array variable?

im working on a save system that if the object is destroyed it will be destroyed when you load the game
my concept for it is have an array for all objects in game and an array for destroyed objects
so on load i can destroy all the actors in the destroyed array variable
but how do i make those destroyed objects go into the array of the destroyed objects? how do i get their id or index?

You can put the list of destroyed actors in the savegame.

When an actor destroys itself, it can say:

and some central process can say:

It uses the names from the world outliner. I assume this would work in a standalone version, it’s good to try…

well it worked? but only half way so it does save the deleted objects and deletes them on load but it also deletes extra objects

for example i have a nice shelf of boxes around 40 of them
i delete 2 by picking them up
save the game load it up
half of the boxes gone

the load game from slot didnt make much sense and didnt seem to work so i changed it with create save game https://cdn.discordapp.com/attachments/225448446956404738/704275745396097114/unknown.png

I’m afraid you have it a bit wrong. If you create the savegame every time it will always remove any progress you have made, because you’re replacing the savegame with an empty one every time :slight_smile:

Make the save game first, then my BP code above will work…

I don’t think that the loaded actors are the same as the actors which were spawned before. But they could have the same GUID. So I would expect weird non-deterministic memory related bugs.

Why don’t you just give every actor in the level a unique ID, store the ID’s of the destroyed actors in a save game, load it later and destroy the actors with the same ID’s (it would be better to simply not spawn them rather than spawning them and destroying them right after that)?

Would also work, I was assuming the actors were placed in the level…

well i would love to give them ids but i don’t know how to do that and if this concept works that might be easier to do so how
so if you say it will work thats good so yes ill try to create the save game first but where do i create it?

The ID is just an integer.

but how do i setup that integer etc

You have to make the actor a BP and put an integer in that BP, then just give it a number.

my actor is already a blue print do i just have an integer variable that is defaul 0 and it will work? how do i give it a number? do i have to make 10000 bp?

If you have a small number of BPs, you can make the integer visible and set it in the level. If you have a large number of BPs, you need to make another actor that gets them all and gives them a number :slight_smile: