Custom Save System

Discussion in 'RGSS3 Script Requests' started by CRBeam, Jun 23, 2012.

  1. CRBeam

    CRBeam Villager Member

    Messages:
    27
    Likes Received:
    5
    Location:
    Reno, NV
    First Language:
    English
    I need a save system with a customizable # of save slots, the ability to delete a save from the load menu, Autosave on the save index you loaded your game from or in the case of a New Game the first empty slot, and that disables New Game if all save slots are taken. I appreciate any help as i've searched all over and haven't found anything close to what i'm looking for.

    -EDIT: I would also like the ability to disable the autosave save feature.
     
    Last edited by a moderator: Jun 23, 2012
    #1
  2. mobychan

    mobychan CodeMaster Veteran

    Messages:
    297
    Likes Received:
    44
    Location:
    Baden-Würrtemberg - Germany
    First Language:
    German
    Last edited by a moderator: Jun 23, 2012
    #2
  3. CRBeam

    CRBeam Villager Member

    Messages:
    27
    Likes Received:
    5
    Location:
    Reno, NV
    First Language:
    English
    I had already looked at both of those and Todd's Autosave is set up to autosave to a pre determained save slot, regardless of what save game you load (default is the first slot). I need it to save to whichever slot you loaded from. Yanflys has many of the features I'm looking for, but niether of them will disable new game if there are no open slot's. If Someone could tell me how to change this :

    def self.call

    DataManager.save_game_without_rescue(0)

    end

    To somthing that saves on the same index you loaded from, I could make it work, but I would still need a small script to disable new game when all the save slots are full.
     
    Last edited by a moderator: Jun 23, 2012
    #3
  4. mobychan

    mobychan CodeMaster Veteran

    Messages:
    297
    Likes Received:
    44
    Location:
    Baden-Würrtemberg - Germany
    First Language:
    German
    The index of the last save file(=> loaded file)



    Code:
    DataManager.last_savefile_index
    
    And determining if the slots are full could work like this(I didn't test it yet!):



    Code:
    def save_files_full?
      for i in 1..DataManager.savefile_max
        num = i
        num = "0#{i}" if i < 10
        return false if Dir.glob("Save#{num}.rvdata2").empty?
      end
      return true
    end
    
     
    #4
  5. CRBeam

    CRBeam Villager Member

    Messages:
    27
    Likes Received:
    5
    Location:
    Reno, NV
    First Language:
    English
    Thanks that was just what I needed, but now when I start a new game it saves over the game in the first save slot. Could someone please edit this:



    Code:
    def command_new_game
    	 DataManager.setup_new_game
    	 close_command_window fadeout_all
    	 $game_map.autoplay
    	 SceneManager.goto(Scene_Map)
    end
    To automaticaly save on the first open slot?
     
    Last edited by a moderator: Jun 24, 2012
    #5
  6. mobychan

    mobychan CodeMaster Veteran

    Messages:
    297
    Likes Received:
    44
    Location:
    Baden-Würrtemberg - Germany
    First Language:
    German
    You'd have to loop through all possible Save Files and check if they're empty:



    Code:
    def get_first_empty_file
      for i in 1..max_files
    	if Dir.glob(DataManager.make_filename(i)).empty?
    	 return i
        end
      end
    end
    
    take i - 1 and use it as index for saving ^^

    (I didn't test this, but it should work ^^)
     
    Last edited by a moderator: Jun 24, 2012
    #6
  7. CRBeam

    CRBeam Villager Member

    Messages:
    27
    Likes Received:
    5
    Location:
    Reno, NV
    First Language:
    English
    "take i - 1 and use it as index for saving" I'm not sure how to do this.
     
    #7
  8. mobychan

    mobychan CodeMaster Veteran

    Messages:
    297
    Likes Received:
    44
    Location:
    Baden-Würrtemberg - Germany
    First Language:
    German
    The saves are titled beginning with 1, but the index you need for the save method starts with 0 that's why you have to substract 1.

    just save the game automatically directly after starting with this:



    Code:
    i = get_first_empty_file
    DataManager.save_game_without_rescue(i-1)
    
     
    #8
  9. CRBeam

    CRBeam Villager Member

    Messages:
    27
    Likes Received:
    5
    Location:
    Reno, NV
    First Language:
    English
    Thank's for the help it's working how I want it now.
     
    #9
  10. mobychan

    mobychan CodeMaster Veteran

    Messages:
    297
    Likes Received:
    44
    Location:
    Baden-Würrtemberg - Germany
    First Language:
    German
    No Problem ^^
     
    #10

Share This Page