Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Instant Save/Load, File_Info REMAKE
Redd
post Feb 27 2010, 01:20 AM
Post #1


:<
Group Icon

Group: Revolutionary
Posts: 2,312
Type: Developer
RM Skill: Advanced




I have this awesome code I just scripted. It makes it so that when you click load or save, it automatically saves it into slot 1, the only slot, and it automatically loads from that slot also. So if you are planning on your game only having one save, then use this!!

CODE
#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
#  This is a superclass for the save screen and load screen.
#==============================================================================

class Scene_File
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     help_text : text string shown in the help window
  #--------------------------------------------------------------------------
  def initialize(help_text)
    @help_text = help_text
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Select last file to be operated
    @file_index = $game_temp.last_file_index
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # If C button was pressed
      on_decision(make_filename(@file_index))
      $game_temp.last_file_index = @file_index
      return
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Call method: on_cancel (defined by the subclasses)
      on_cancel
      return
    end
  #--------------------------------------------------------------------------
  # * Make File Name
  #     file_index : save file index (0-3)
  #--------------------------------------------------------------------------
  def make_filename(file_index)
    return "Save Data.rxdata"
  end


Installation:

Just replace it with Scene_File. Oh yeah and one more thing, in Scene_Title go to line 49 and replace this:
CODE
      if FileTest.exist?("Save#{i+1}.rxdata")

With this:
CODE
      if FileTest.exist?("Save Data.rxdata")



Once again, only use this code if you are planning on having one and only one save file in your game.

If you are going to use this please credit me also. Please.


__________________________
Go to the top of the page
 
+Quote Post
   
stripe103
post Feb 27 2010, 02:14 AM
Post #2


PHP ERROR: Couldn't get value from UInteger. Value too large
Group Icon

Group: Revolutionary
Posts: 737
Type: Mapper
RM Skill: Intermediate




Only one save file? That can be very handy for some. Nice!


__________________________

By Axerax

The rest of my sig



Go to the top of the page
 
+Quote Post
   
Redd
post Feb 27 2010, 03:34 AM
Post #3


:<
Group Icon

Group: Revolutionary
Posts: 2,312
Type: Developer
RM Skill: Advanced




Thanks! I kinda saw it as a bit of a downside, but it works with the project I made it for, which is a half-movie. Interactive movie, you could say.


__________________________
Go to the top of the page
 
+Quote Post
   
Redd
post Mar 1 2010, 02:08 AM
Post #4


:<
Group Icon

Group: Revolutionary
Posts: 2,312
Type: Developer
RM Skill: Advanced




bump. anyone wanna comment on this? took a long time to work it!


__________________________
Go to the top of the page
 
+Quote Post
   
Kread-EX
post Mar 1 2010, 03:50 AM
Post #5


(=___=)/
Group Icon

Group: +Gold Member
Posts: 4,136
Type: Scripter
RM Skill: Undisclosed




This is useful for games with one save slot, like you said. You could also complete it with some kind of autoload upon Game Over. Since there's just one slot, this could be easier.


__________________________
FRACTURE - a SMT inspired game (demo) made by Rhyme, Karsuman and me. Weep and ragequit.

My blog.

Click here for my e-peen


Go to the top of the page
 
+Quote Post
   
Dragons
post Mar 5 2010, 02:53 PM
Post #6


Level 2
Group Icon

Group: Member
Posts: 15
Type: None
RM Skill: Intermediate




Yes that is a very good idea Redd.
You should be able to do that if there is only 1 save slot.


__________________________
Go to the top of the page
 
+Quote Post
   
quazergames
post Jun 19 2010, 09:29 PM
Post #7


Level 1
Group Icon

Group: Member
Posts: 9
Type: Artist
RM Skill: Intermediate




I found an error. When you try to go to "save" in the menu or use the "Call Save Screen" event, you get:

Script 'Instant Save Load' line 64: NoMethodError occured.
undefined method `on desision' for nil:NilClass

I tried to slove the problem by doing this:

CODE
#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
#  This is a superclass for the save screen and load screen.
#==============================================================================

class Scene_File
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     help_text : text string shown in the help window
  #--------------------------------------------------------------------------
  def initialize(help_text)
    @help_text = help_text
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make help window
    @help_window = Window_Help.new
    @help_window.set_text(@help_text)
    # Make save file window
    @savefile_windows = []
    for i in 0..3
      @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
    end
    # Select last file to be operated
    @file_index = $game_temp.last_file_index
    @savefile_windows[@file_index].selected = true
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @help_window.dispose
    for i in @savefile_windows
      i.dispose
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @help_window.update
    for i in @savefile_windows #now it says there's a problem here
      i.update
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Call method: on_decision (defined by the subclasses)
      on_decision(make_filename(@file_index)) #you forgot to include this part
      $game_temp.last_file_index = @file_index
      return
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Call method: on_cancel (defined by the subclasses)
      on_cancel
      return
    end
    # If the down directional button was pressed
    if Input.repeat?(Input::DOWN)
      # If the down directional button pressed down is not a repeat,
      # or cursor position is more in front than 3
      if Input.trigger?(Input::DOWN) or @file_index < 3
        # Play cursor SE
        $game_system.se_play($data_system.cursor_se)
        # Move cursor down
        @savefile_windows[@file_index].selected = false
        @file_index = (@file_index + 1) % 4
        @savefile_windows[@file_index].selected = true
        return
      end
    end
    # If the up directional button was pressed
    if Input.repeat?(Input::UP)
      # If the up directional button pressed down is not a repeatã€
      # or cursor position is more in back than 0
      if Input.trigger?(Input::UP) or @file_index > 0
        # Play cursor SE
        $game_system.se_play($data_system.cursor_se)
        # Move cursor up
        @savefile_windows[@file_index].selected = false
        @file_index = (@file_index + 3) % 4
        @savefile_windows[@file_index].selected = true
        return
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Make File Name
  #     file_index : save file index (0-3)
  #--------------------------------------------------------------------------
  def make_filename(file_index)
    return "Save#{file_index + 1}.rxdata"
  end
end


...but now I get:

Script 'Instant Save Load' line 59: NoMethodError occured.
undefined method `each' for nil:NilClass

I have no idea what's going on.

This post has been edited by quazergames: Jun 19 2010, 09:31 PM


__________________________
QuazerGames
Fantasy Artist
Sci-Fi/Fantasy Author
Has a screw loose
Enough said
Go to the top of the page
 
+Quote Post
   
XeroVolume
post Jun 20 2010, 07:29 AM
Post #8


Level 2
Group Icon

Group: Member
Posts: 18
Type: Scripter
RM Skill: Skilled




I just tested this in a new project and I don't get any errors whatsoever. It works perfectly both from the menu and from the 'Call Save Screen' Event Command. Perhaps this script is incompatible with another you are using?

First, double check that you have copied the script correctly and changed the necessary line in Scene_Title, (although that line wouldn't cause the error your getting anyway.)

If your still having problems, post the scripts you are trying to use with this one so we can have a look...


__________________________
[Show/Hide] XeroVolume's Signature




"What is XeroVolume?"
"Well, at the center of a black hole the singularity point has zero volume and infinite density."
"Ok, but what the hell is XeroVolume?"
...
"Me baby, ME!"


Go to the top of the page
 
+Quote Post
   
Locke
post Jun 21 2010, 04:54 AM
Post #9


Level 10
Group Icon

Group: Revolutionary
Posts: 151
Type: Mapper
RM Skill: Intermediate




Its nice having a quick save thingy or something laugh.gif


__________________________
We are one (Really i,m not joking)



I've seen many things when mankind rule the land


Which Final Fantasy Character Are You?
Go to the top of the page
 
+Quote Post
   
Redd
post Jun 24 2010, 01:34 PM
Post #10


:<
Group Icon

Group: Revolutionary
Posts: 2,312
Type: Developer
RM Skill: Advanced




Yeah you must change in the title and also in the menu to what was above.
Are you using any custom menu/load/save scripts quazer?


__________________________
Go to the top of the page
 
+Quote Post
   
Bio Wolfz
post Jun 25 2010, 11:23 PM
Post #11


Blinded Assassin
Group Icon

Group: Revolutionary
Posts: 164
Type: Mapper
RM Skill: Intermediate




This script looks cool, does it crash with custom save scripts?
Go to the top of the page
 
+Quote Post
   
stripe103
post Jun 26 2010, 01:53 AM
Post #12


PHP ERROR: Couldn't get value from UInteger. Value too large
Group Icon

Group: Revolutionary
Posts: 737
Type: Mapper
RM Skill: Intermediate




I think it does. I mean this script makes the game load and save directly into one file instead of the user having to choose. Most other custom save scripts does the opposite, adding more save files to save to.


__________________________

By Axerax

The rest of my sig



Go to the top of the page
 
+Quote Post
   
Bio Wolfz
post Jun 26 2010, 02:15 AM
Post #13


Blinded Assassin
Group Icon

Group: Revolutionary
Posts: 164
Type: Mapper
RM Skill: Intermediate




I'll test it out later, maybe you can edit any custom save so that there will be a auto save file only for the autosave.
Go to the top of the page
 
+Quote Post
   
roxie364
post Jul 1 2010, 01:04 PM
Post #14



Group Icon

Group: Member
Posts: 1
Type: Developer
RM Skill: Intermediate




Can you modify this please? I really need something like this smile.gif i want to make own menu without scene_title, i want make it on scene_map. And make something like in Shining Force menu. ex: i create 4 choices, if player choose 1st - game will be save into 1st slot.. and etc... But there can be some problems with detection of loading files.. if they do not exist. (i mean - display it in game) I noob in scripts and so i can't do it ( i may just hope, what somebody can help me... And... Sorry, if my English is bad sad.gif

This post has been edited by roxie364: Jul 1 2010, 01:07 PM
Go to the top of the page
 
+Quote Post
   
Redd
post Jul 21 2010, 01:11 AM
Post #15


:<
Group Icon

Group: Revolutionary
Posts: 2,312
Type: Developer
RM Skill: Advanced




QUOTE (roxie364 @ Jul 1 2010, 03:04 PM) *
Can you modify this please? I really need something like this smile.gif i want to make own menu without scene_title, i want make it on scene_map. And make something like in Shining Force menu. ex: i create 4 choices, if player choose 1st - game will be save into 1st slot.. and etc... But there can be some problems with detection of loading files.. if they do not exist. (i mean - display it in game) I noob in scripts and so i can't do it ( i may just hope, what somebody can help me... And... Sorry, if my English is bad sad.gif

WRONG PLACE!!! Please post that in RGSS Suport, not in my topic!


__________________________
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 22nd May 2013 - 07:14 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker