Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: eissen_eiram on Sat 05/05/2012 06:16:02

Title: HELP: AUTO SAVE after QUIT GAME
Post by: eissen_eiram on Sat 05/05/2012 06:16:02
Hi, can someone help me on how to auto save a game after the player clicks on the quit button or X button (exit)?
Title: Re: HELP: AUTO SAVE after QUIT GAME
Post by: steptoe on Sat 05/05/2012 06:49:20
Hi

I can't understand your reasoning behind saving game when quitting the game.

Perhaps you can elaborate?

Title: Re: HELP: AUTO SAVE after QUIT GAME
Post by: eissen_eiram on Sat 05/05/2012 07:25:34
So that the player wouldn't have to return to the last saved game. Let's say, the last save game was in level 2 and he proceeds to level 6. When he clicks exit or back to Main Menu (or any accidents of the like) the game would automatically save if for them. They wouldn't have any problems of going back to level 2.

What I mean is that when the player clicks on return to main menu, the game will automatically save. They don't have to click save anymore coz' the game will do it for them. Something like that.
Title: Re: HELP: AUTO SAVE after QUIT GAME
Post by: steptoe on Sat 05/05/2012 07:56:31
Perhaps you should set up AutoSave points for each level at some point (once each level is completed and just before going to next level maybe?) so that the player can go into the Saved Games Box (GUI) and load any of the Auto Saved Games.

I have used this method myself by player walking into Flag pole Saving Points.

AutoSave script.

Put this where you want to AutoSave (amend and place script where required):


Game.DoOnceOnly("Level 6");
SaveGameSlot(100, "Level 6");
Display("Auto Saved: Level 6");


Check out 'SaveGameSlot' in the AGS manual.

This is all I can think of at the moment if it's what you mean?

Title: Re: HELP: AUTO SAVE after QUIT GAME
Post by: Khris on Sat 05/05/2012 12:21:08
The Quit GUI is hardcoded into AGS so you have to replace it entirely.
Create a new GUI, set its name to gQuit and visibility to "Pause game when shown". Add a label that says "Really exit the game?" or something to that effect.
put two buttons on it and label them accordingly (e.g. btnQuitYes and btnQuitNo).
Double click a button to create its onclick function.

In btnQuitNo_OnClick, put  qQuit.Visible = false;

In btnQuitYes_OnClick, put  SaveGameSlot(998, "Auto Save");
  QuitGame(0);


Final step: search GlobalScript.asc for all occurences of "QuitGame(1);" and replace them with "gQuit.Visible = true;"