Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: SilverSpook on Fri 14/08/2015 10:59:07

Title: Resetting To Earlier Game State On Death
Post by: SilverSpook on Fri 14/08/2015 10:59:07
Hi guys, just trying to figure out how to reset the game back to a certain point when the character is killed, similar to what occurs in Gemini Rue when you get shot.  Is there a way to just save the state of the game before combat and then reload automatically that state when the player dies?
Title: Re: Resetting To Earlier Game State On Death
Post by: Mandle on Fri 14/08/2015 11:05:03
I believe you just tell AGS to create a savegame file called Autosave or whatever just before the combat and then tell AGS to load Autosave if the player dies?

Not sure of exact syntax but I'm sure it's right there in the manual...although I would probably just take a look at the save/load game functions in the default game Global Script to find the keywords and then autofill it in my own script....I'm kinda lazy that way...
Title: Re: Resetting To Earlier Game State On Death
Post by: Crimson Wizard on Fri 14/08/2015 11:13:18
You could use built-in AGS functionality, if it suits you.

Check SetRestartPoint (http://www.adventuregamestudio.co.uk/wiki/Game_/_Global_functions#SetRestartPoint) and RestartGame (http://www.adventuregamestudio.co.uk/wiki/Game_/_Global_functions#RestartGame).
These functions work with a special AGS save slot #999.

If you do not like that, it is not that hard to create your own autosave system, using SaveGameSlot (http://www.adventuregamestudio.co.uk/wiki/Game_/_Global_functions#SaveGameSlot) and RestoreGameSlot (http://www.adventuregamestudio.co.uk/wiki/Game_/_Global_functions#RestoreGameSlot).
Title: Re: Resetting To Earlier Game State On Death
Post by: Mandle on Fri 14/08/2015 13:31:46
Quote from: Crimson Wizard on Fri 14/08/2015 11:13:18
You could use built-in AGS functionality, if it suits you.

Check SetRestartPoint (http://www.adventuregamestudio.co.uk/wiki/Game_/_Global_functions#SetRestartPoint) and RestartGame (http://www.adventuregamestudio.co.uk/wiki/Game_/_Global_functions#RestartGame).
These functions work with a special AGS save slot #999.

If you do not like that, it is not that hard to create your own autosave system, using SaveGameSlot (http://www.adventuregamestudio.co.uk/wiki/Game_/_Global_functions#SaveGameSlot) and RestoreGameSlot (http://www.adventuregamestudio.co.uk/wiki/Game_/_Global_functions#RestoreGameSlot).

Ahhhhhh much more useful than my reply and also I learned something awesome...I had no idea about SetRestartPoint...This will be very useful in my current project actually...

Cheers!
Title: Re: Resetting To Earlier Game State On Death
Post by: SilverSpook on Sat 15/08/2015 04:07:44
Thanks guys for the quick and useful replies!
Title: Re: Resetting To Earlier Game State On Death
Post by: Mandle on Sat 15/08/2015 06:50:55
Quote from: SilverSpook on Sat 15/08/2015 04:07:44
Thanks guys for the one quick and one useful replies!