Save/Load Health

My character has the Health Extension and has the healthbar (changes width according to his health) to reflect his health status.

How do I save his health status to other scenes. So that when I go back and forth to other scenes his health don’t just goes back to full :sob:. If someone could share their ideas I’d really appreciate it.

Create global variable
Right before set that variable to your player health
Then in next scene At beginning of the scene you set player health to that variable

1 Like

Is it ok to ask for more details on how to do it?

Here is how I do it.
Save the player health into a global variable right before you need to change scene.

Then load it back into the player at the beginning of the next scene (I have this in an external event that is shared by all scenes)

1 Like

I’m still having trouble on saving my healthstat :sob:.

Do I do this?

then this to the scene where I want the health stat to be saved?

You have some event that change scene

Just for example imagine you have event that if player touch the door you change scene to next level

In that event you have action like

Change scene to Level2

What you need to do is shove in above that action
Change SOME variable set to Player.Health::Heath()
Change scene to level2

I assume my expression of player health is wrong but you will find correct one trying to type it (auto fill will help)

Where in that Level2 scene you need event like
Condition
At beginning of the scene

Action
Change Player Health set to SOME variable

IDK what is proper name of action to change player health since i do not use health extension
Yet i bet there is some

I am not using health extension but that should be correct
IF its not i would check if these actions work with key presses

For example set that if you press 1 key you change variable to 20
And print that variable to some text object to see is it changing
Then use if 2 key pressed set that variable to health of your player and see if it is working
Now press 2 and 1 one after another to see if its switching correctly

Next use press 3 key and action to change health of your player to 30
And if its working now use 4 key to set player health to that variable and again go 3 4 3 4 to see if its switching properly

This worked well! Thank you so much!

1 Like

Thank you, too @themitchnz

1 Like