What's going wrong with my save system?

I’ve been tinkering with a save system based loosely off Vendetta’s but without the save_flag business.

Instead at the end of an episode I use the stats to set another version of the stat

example

*set sname name

then at the start of an episode do the opposite

*set name sname

but for some reason it just resets the stats to the default settings. What am I doing wrong?

From what I see in your code (episode01), when the player dies, you send them to *label episodeone which is where you save the stats they currently have. You need to send them to a place that restores their saved values.

Ah, I will try and work something out.

edit: Guess I’ll have to use the save_flag thing but I couldn’t get it to work either which is why I tried to simplify it for me.

*randomzombiescene1 (the point before a random zombie scene happens)
*set checkpoint randomzombiescene1
*set sname name
*set sweapon weapon

  • scene code here -

If at any time you die, *goto load

*load
*set name sname
*set weapon sweapon
*goto {checkpoint}

Not tested it but I’m convinced that will work in theory, just remember to have lots of *set checkpoints/weapons/names (that match the label name of the scene you’re saving progress at).

What I want to do is have save points at the end of an episode so if you die you go can either restart completely or just restart the current episode

Are your episodes different scenes? (txt files?)

At the end of an episode, say 1 in this example, put:

*set sname name
*set sweapon weapon
*goto_scene episode 2

At the beginning of an episode, right at the start of the file put:

*set name sname
*set weapon sweapon
*set checkpoint “episode2”

It seems simple, but I can’t see why it wouldn’t work - obviously you’ll need to save/restore any additional variables you want too.

EDIT: I forgot when you die:

*label death
*Choice
#Restart
*set name “”
*set weapon “”
*goto_scene episode1
#Restart From Last Checkpoint
*goto_scene {checkpoint}

@CJW

Yeah each episode is a different txt file.

I’ve put a save label at the end of each episode and a load label at the start of an episode which is skipped if you get to the episode from the previous one.

Going to test it out on my pc before reuploading it.

edit: tried it and it sort of works but the stats didn’t change to what they should have been

You don’t need to load at the beginning of an episode, you need to load when you die, no?

Could you post your code?

@CJW

When you reach a death scene you have a choice to restart the episode which sends you to load.

the code looks like this

*goto episodeone

*label load

*set name sname
…etc
*goto episodeone

*label episodeone

start the episode

So if the player gets to the episode from the pilot it goes straight to the start and skips the load bit but if the player dies they can go back to load and begin the episode again with the stats they started with (or at least that’s what I want)

I’d strongly recommend breaking the episodes up into different .txt files and using goto_scene - you’ll be jumping all over the place in one file.

In the mean time, what’s happening with the variables. What are they showing? You said it “sortof” works.

I do this in ZE. Each time I end a chapter, I use:

*label FinishScene
*set save_flag “save”
*set return_to_scene “NextScene”
*page_break
*goto_scene savegame

In the above code, NextScene is the name of the next consecutive scene.

If a player dies, I use:
*label RestoreScene
*set save_flag “restore”
*set return_to_scene “SameScene”
*page_break
*goto_scene savegame

Where SameScene is the name of the current scene.

In scene savegame, I let the player choose restarting the scene or starting over:

`
*if save_flag = “restore”
*page_break
You have died.

Luckily, your progress has been saved, and you may continue from the last checkpoint.

Do you want to continue from the last saved checkpoint, or start the game over?
*choice
#Continue from last saved checkpoint
GAME RESTORED!
*page_break
*if return_to_scene = “ThirdFloor”
*goto_scene ThirdFloor
–repeat–
#Start the game over
*ending

`

@CJW

They are separate txt files. the sample I showed you was just from episode01.txt

Atm the player is put back to the start of the episode but with the stats they died with.

Check Jim’s example, see if that’s what you’re after.

I’ll test it out tomorrow thank you both for your help

@JimD

Tried using your system but it still doesn’t work right, it lets the player go back to the start of an episode but it defaults the stats?

so if my stats are 45 and 45 at the start of an episode and by the time I die they are 60 and 50. When I restart the episode instead of giving me 45 and 45 it gives me 10 and 10?

Is your game online? A link to the directory would help tremendously (so we can see ALL the code)

Yeah its on dropbox now

will this do?

http://db.tt/LGeWYo5O

On a quick look, your code looks correct. I’m heading out today and won’t be near a PC but I will look at it early tomorrow if no one else can help.

Ok thanks.

Following has been extracted from the end of your episode02.txt

`
*label end_of_episode
*Set save_flag “save”
*set return_to_scene “episode03”
*page_break
*goto_scene savegame

*label dead
*set save_flag “restore”
*set return_to_scene “episode01”
`

Two problems here:

  1. *set save_flag “save” – you have a capital S on *set, so it’s not setting properly. You’ll need to fix this in each episode file.
  2. *set return_to_scene “episode01” – this should be episode02 in this case (episode02.txt), to return to the start of the actual episode during which the player died. You need to amend both return_to_scene settings accordingly each time you copy/paste this bit into a new episode.

Didn’t spot anything in the actual savegame file itself so it should all work fine after these fixes.