How do I implement autosave?

From OHRRPGCE-Wiki
Jump to navigation Jump to search

What is autosave? Well this is the capacity for a game system to save automatically a party. This very used in modern games!! Autosave implies that you don't have save point. You may not believe it but the OHRRPGCE can do it (Yes he can! just like the president! ^_^)

To implement the autosave, just add the following script

# script that implements auto save
plotscript, autosave, begin

  save in slot (1)

end #end for the script

Compile your script. Then, go under custom.exe and import your edit the maps. Then, go to the "general map menu". Go down to each step script: then use the arrows until you see each step script : autosave. To suspend the save you have 2 options

1- Using tag

This option implies to modify the script

#-----------------------------------------
# script that implements auto save
plotscript, autosave, begin

  if (check tag (tag :autosave)==ON), then, begin  #if the tag is on then....
    save in slot (1)
  end

end #end for the script

#-------------------------------------------

As you can see the tag has to be turned on so that the player can save the game so be sure that you turned it on in your intro script and that it stays like this (expect when you don't want it indeed). If you are not sure if the tag in on or of, feel free to use "show value" To choose this option you really have to understand how tags works , else the player may complain that there's a bug and that save didn't work!

To test to see if it works, you can use show value or go in front of a npc and leave the game. (If you came back in front of the Npc you were when the party loads then, it works! Congratulations! You've implemented autosave!)


2- Using the command (set each step script (id))

The plotscript dictionary gives a perfect definition for the command "Changes the script that is run when you take a step". To use it you'll just have to include the command line in a script, or( make a new one) which will be launched a few time before you want the save system to be unactive.

Let's take an example : you want the save system to be unactive while the main hero plays a mini game which consists in pushing rocks.

At the very beginning of your mini game script include the line

Changes the script that is run when you take a step


set each step script (none) #no more each step script
# here the command if pay 

Now, when do you need to active the save system again? Well this easy! At the end of the playing script just before the command "resume player"


set each step script (@autosave)
resume player
end #end for the script

3- Adapt the load menu and the game over script to have a coherent game play

  • Create a new load menu

To make the gameplay perfectly coherent you need if you choose to use autosave to adapt the load menu and the gameover script Read "How do I make title options like Start Game, Continue Game, etc" and implement it. It is rather complex (it uses the autorun map and global variables among other things) so feel free to ask questions on the forum.

  • Adapt the game over script

At the end of you game over script, you need to reset the game. To do so you need to key in the name of very first script that launches when game.exe reads the .rpg file. To find it edit the general game data and then go into the special ploscripts. The name you need is the name of the "new game" special plotscript!

To make the reset game effect efficient you need to understand how the bitsets "skip title screen" and "skip load screen" works. Even you don't add screen before the title game screen I strongly advise you to read the article!


Some things to remember[edit]

  • Each step script means that each time you press an arrow, the game is saved. This implies that the script is launched many many times : so be sure that it stays light (with only a few lines of code).
  • The player has nothing to do to save and it may seems strange to him if the gameplay is not adapted. It is strongly recommended then to adapt the game menu creating a menu with option like "Start Game", "Continue"
  • Just like the traditional OHR save system the save system is not active will battles and some zones
  • You may want to disable it while mini games for examples be sure you use one of the 2 ways advised below to prevent mistakes
  • There's a difference between autosave and the plotscript command that has the same name: the command autosave is used to prevent the programmer to repeat "save from slot" It is one of the command that are less used. Do not mistake this one with the other!
  • If you are afraid that your game may become too easy click above and choose another save point! If you have understood how to make it unactive, you shouldn't have this kind of problems!
  • Feel free to ask questions on the forum of Castle Paradox (especially if you have troubles making autosave inactive)! It will help not only you but also the one who will come next and that could ask the same questions!

See Also[edit]