Save and Load Dead Enemies
Hello, I am trying to save enemies the player has killed in my save game object and when they are loaded they get destroyed immediately. I have tried several ways such as storing an IsDead? boolean in the enemy and then saving it to an IsEnemyDead? in the game save then when loaded if it is true it destroys the enemy but the casting to Enemy failed, I tried using an array but that didn't work either. Any Ideas?
asked Jan 28 '19 at 04:41 PM in Blueprint Scripting
How do you spawn these enemies into the level? You must have some method that says Enemy "X" goes here, Enemy "Y" goes there. So whatever that method is, you should have an array of bools and when Enemy "X" is killed set the bool to true. Save this array out to your save game object. Then when you load the game back up have the spawner check the bool array and see if the enemy was killed, if yes, "spawn and destroy" or "skip" the index and move to the next. If they are statically placed, have a function in the level BP that checks this bool array against the enemies and if they are killed destroy the enemy instance.
answered Jan 28 '19 at 05:36 PM
Nebula Games Inc
Follow this question
Once you sign in you will be able to subscribe for any updates here