Essentials Docs Wiki

The Essentials wiki has moved and is now at: Essentials Engine wiki

This wiki will no longer be updated.

READ MORE

Essentials Docs Wiki
Advertisement

This page describes how Essentials saves and loads the game.

Loading[]

LoadScreen

The Load screen.

When the game is started, the player is offered the choice to start a new game or to continue their saved game (if there is one).

The script section UI_Load contains the scripts that display the Load screen.

Saving[]

SaveScreen

The Save screen.

One of the options in the Pause menu is to save the game. When this option is selected, some information about the current game run is shown, along with a prompt asking whether the player is sure they want to save.

If you need to ask the player whether or not they want to save their game (e.g. at a battle arena), you can run the script pbSaveScreen. It will return TRUE if the game was saved, and FALSE if it wasn't. Note that the player still has the option to say no to the save. If you want an event to rely on the player saying yes to that save, put the script in a Conditional Branch.

Note that, as the player can save on (nearly) any map, every map's name should be presentable to the player (e.g. "Professor Oak's Lab", not "Map054").

The script section UI_Save contains the scripts that display the Save screen and provide the save confirmation prompts.

What information is saved?[]

All the game information that is saved is listed in the script section Game_SaveValues. These listings describe what the information is, how to refer to it in-game, and how to initialize it when starting a new game.

SaveData.register(:bag) do
  ensure_class :PokemonBag
  save_value { $bag }
  load_value { |value| $bag = value }
  new_game_value { PokemonBag.new }
end

SaveData.register(:player) do
  ensure_class :Player
  save_value { $player }
  load_value { |value| $player = value }
  new_game_value {
    # Get the first defined trainer type as a placeholder
    trainer_type = GameData::TrainerType.keys.first
    Player.new("Unnamed", trainer_type)
  }
end

All the saved game information is stored in the save file "Game.rxdata", in the folder "C:\Users\USERNAME\AppData\Roaming\GAMENAME". If that folder doesn't exist (i.e. your operating system is not one of the later Windows versions), then the save file will be put in the game folder instead.

Tips[]

  • If you are adding extra variables to your game that need to be saved, you will need to create another SaveData.register chunk of code to make the game recognise that it should be saved and how to use it.
    • Alternatively, save your new variables as part of one of the sets of information that is already saved (e.g. $game_player).
  • You could show different or additional information in the Save/Load screens. For example, the number of times the player has saved the game, the player's money, how long it has been since the player last saved, etc.
  • You could allow multiple save files, either all for the same game run or to allow multiple players to play their own separate runs of the games at the same time.
    • You could allow the game to autosave every so often. Ideally this autosave would be its own save file and wouldn't replace the regular save file.
Advertisement