How Does Saving Work With AGS?

Started by Dimbeak, Sun 13/05/2018 22:47:22

Previous topic - Next topic

Dimbeak

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

Cassiebsg

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).
There are those who believe that life here began out there...

Crimson Wizard

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

SMF spam blocked by CleanTalk