HELP: AUTO SAVE after QUIT GAME

Started by eissen_eiram, Sat 05/05/2012 06:16:02

Previous topic - Next topic

eissen_eiram

Hi, can someone help me on how to auto save a game after the player clicks on the quit button or X button (exit)?

steptoe

#1
Hi

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

Perhaps you can elaborate?


eissen_eiram

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.

steptoe

#3
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):

Code: ags

 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?


Khris

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
Code: ags
  qQuit.Visible = false;


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


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

SMF spam blocked by CleanTalk