Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Dimbeak on Sun 13/05/2018 22:47:22

Title: How Does Saving Work With AGS?
Post by: Dimbeak on Sun 13/05/2018 22:47:22
Hello!

I wanted to know how global variables work with saving.

For instance, what if I want to do something Undertale-inspired and have some global variables that remain constant even when you save and reload games? How would I go about doing this?

If the game does this automatically, then how do global variables get reset in the first place?

Thanks
Title: Re: How Does Saving Work With AGS?
Post by: Cassiebsg on Mon 14/05/2018 08:34:25
All variables (global or variable) are saved into the save game.
To "reset" any variable you just code it. As in change the variable to it's initial state your self when need to. Or restart the game (as in do not load a save game).
Title: Re: How Does Saving Work With AGS?
Post by: Crimson Wizard on Mon 14/05/2018 09:29:28
Quote from: Cassiebsg on Mon 14/05/2018 08:34:25
To "reset" any variable you just code it. As in change the variable to it's initial state your self when need to. Or restart the game (as in do not load a save game).

Restarting game = loading save game.

In AGS there is a special save slot 999, where game is getting saved at the very beginning, os loading it works as restart. Although you may do SetRestartPoint to save it again and change where it restarts to.

Quote from: Dimbeak on Sun 13/05/2018 22:47:22
For instance, what if I want to do something Undertale-inspired and have some global variables that remain constant even when you save and reload games? How would I go about doing this?

This is possible if you write and read custom file. See File functions in the manual: http://www.adventuregamestudio.co.uk/manual/ags55.htm#topic49