Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

New Game Database

Status
Not open for further replies.
I really feel like I should know how to do this, but I don't.

I'm changing $data_weapons into an alterable database (it works just like Game_Actor(s)) to work with my weapon customizing script. However, I have no idea how to make the game save and load the data when you save and load a game file. Am I missing something really obvious?
 
I think I should have been a little clearer. I'm not using $data_weapons at all. I'm writing a new class, which is used in a similar way to Game_Actor(s) (Game_Weapons is an array of several instances of Game_Weapon, and each of the variables of Game_Weapon are alterable in-game), and I want to save it so that you keep the weapons when you load.
 
You can use something like this for a template.

Code:
class Scene_Title
  alias_method :yourname_scriptname_scnttl_cng, :command_new_game
  def command_new_game
    yourname_scriptname_scnttl_cng
    $your_object # create it here
  end
end

class Scene_Save
  alias_method :yourname_scriptname_scnsv_wsd, :write_save_data
  def write_save_date(file)
    yourname_scriptname_scnsv_wsd(file)
    Marshal.dump($your_object, file)
  end
end

class Scene_Load
  alias_method :yourname_scriptname_scnld_rsd, :read_save_data
  def read_save_data(file)
    yourname_scriptname_scnld_rsd(file)
    $your_object = Marshall.load(file)
  end
end
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top