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.

Need help finishing my Autosave Script.

I finished an autoload script but without the autosave it's useless!

Alright here is the script...
Code:
begin
  $data_actors        = load_data("Data/Actors.rxdata")
    $data_classes       = load_data("Data/Classes.rxdata")
    $data_skills        = load_data("Data/Skills.rxdata")
    $data_items         = load_data("Data/Items.rxdata")
    $data_weapons       = load_data("Data/Weapons.rxdata")
    $data_armors        = load_data("Data/Armors.rxdata")
    $data_enemies       = load_data("Data/Enemies.rxdata")
    $data_troops        = load_data("Data/Troops.rxdata")
    $data_states        = load_data("Data/States.rxdata")
    $data_animations    = load_data("Data/Animations.rxdata")
    $data_tilesets      = load_data("Data/Tilesets.rxdata")
    $data_common_events = load_data("Data/CommonEvents.rxdata")
    $data_system        = load_data("Data/System.rxdata")
    $game_temp = Game_Temp.new
           def initialize 
           $game_system = Game_System.new
            $game_map = Game_Map.new
            $game_player = Game_Player.new
            $game_switches = Game_Switches.new
            $game_self_switches = Game_SelfSwitches.new
            $game_screen = Game_Screen.new
            $game_party = Game_Party.new
            $game_troop = Game_Troop.new
            $game_variables = Game_Vairables.new
            $game_actors = Game_Actor.new
            end
     file = File.open("Save1.rxdata" , "wb")
          characters = []
    Marshal.dump(characters, file)
    Marshal.dump(Graphics.frame_count, file)
        $game_system.save_count += 1
    $game_system.magic_number = $data_system.magic_number
    Marshal.dump($game_system, file)
    Marshal.dump($game_switches, file)
    Marshal.dump($game_variables, file)
    Marshal.dump($game_self_switches, file)
    Marshal.dump($game_screen, file)
    Marshal.dump($game_actors, file)
    Marshal.dump($game_party, file)
    Marshal.dump($game_troop, file)
    Marshal.dump($game_map, file)
    Marshal.dump($game_player, file)
        file.close
        $scene = Scene_Map.new
  end
  while $scene != nil
$scene.main
end
I based it off of my autoload...
Eroor is line 32 undefined methos save_count.
 
something +=1 is the same as saying something = something + 1

I should have helped too...

I don't believe you can access the save_count variable out of the game_system class because what you are doing there is basically calling the save_cout function of game_system.
 

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