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.

Adding Save Things?

Sorry for the bad title, I couldnt think of a good one. I have a system for a scene, and it only works if you have $toggle == 1

So the scene works like

if $toggle == 1
stuff here
else
end



Now I want to know how to save that option. So when the user reloads the game, it doesnt reset. Anyone know how?
 
Add this above main:
Code:
class Scene_Save
  alias old_write_save_data write_save_data
  def write_save_data(file)
    old_write_save_data(file)
    Marshal.dump($toggle, file)
  end
end

class Scene_Load
  alias old_read_save_data read_save_data
  def read_save_data(file)
    old_read_save_data(file)
    $toggle = Marshal.load(file)
  end
end
 

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