Health System, Save after Death ? /World Reload ?

Hello,

I have built a simple health system that deducts 1 health point each time, and if the character falls or is otherwise destroyed, the level reloads either from the beginning or at a checkpoint, and the health is restored. How can I save the deducted health points until they reach 0 and then reset all checkpoints

Are you using ‘reset level’ ( restart player ) or ‘open level’ to restart?

Then you could save the health in the game instance. It would not be disturbed there.

I use, open level.
How to save it in game instance ?

I cant find restart player :confused:

You can store it in the GI. In the player, on begin play, then can load from the GI.

Thanks a lot, but i dont get it… i dont even have a framework and dosent know what it is and how to use it. It seams not right for my type of project.

I also have a savegame from which i load the checkpoints.

1 Like

You didn’t mention you have a save game. Make the player save and load the health from there.

Game instance is useable in every project, by the way. It’s just like the save game, but only carries info between levels.

Yes but how? I try for 10h now, and every time my level load my health is restored. i realy dont get it…

1 Like

You know how to save stuff, right?

So, when you get to the checkpoint, put the health in the SG or GI.

In the player, on begin play, they read the SG ( or GI ), and set their health from the last checkpoint. That’s it :smiley:

Yes, but i cant use my variable from Save Game ( health ) in my ThirPersonCharacterBlueprint … or at any other Blueprint …

1 Like

Why not?

I dont know ^^ also i cant load mulitple Save Games, as i need one for Checkpoints and one for Health but there is only one Event Begin Play to load from - i feel like i do somthing realy realy wrong on this issue…

You can put everything in one save game.

Or, you can load more than one save game

When i get damage it should make a save game and then showing up in my ui going from visible to hidden, but that is also not working, then when i die is should be not restore my health icons until i got hit 4 times.

But nothing of it is working. May i can send you my project ?


Also i have decrement by 1 but as soon as i hit the actor my Gesundheit is 0 …

I can see the problem from here

image

You need to watch some more save game videos :slight_smile:

You only need to make the SG once, then use it. If you create it every time, you’re making it empty every time.

Okay, but still, why is my viriable allways -4 on decrement and not -1… and why is nothing showing up in my UI ? -_- i feel so empty hahaha

and without Create Save Game Object i cant Save Game to Slot.

But after i get damaga i would like to save my health in different slot ^^

i found a other solution so player will get back all healthpoints on checkpoint :slight_smile: its not what i wanted but the mechanic fits well so, thanks for you time :slight_smile:

1 Like