[RESOLVED] save slots

Started by k9inpoop, March 03, 2008, 06:36:28 pm

Previous topic - Next topic

k9inpoop

March 03, 2008, 06:36:28 pm Last Edit: July 25, 2008, 04:55:02 pm by Blizzard
i need save slots at go up to 12 like that COOL 8) game called "chaos-project" ;D ;D



Aqua


k9inpoop

can you put it up here? because my schools computer will not let me on that site



Aqua

This script allows you to have unlimited save files. Only four files are shown at once, but the list can be scrolled. To use this script, replace the class Scene_File with the one shown, and replace the initialize method in Window_SaveFile with the one shown. To choose the maximum number of save files for your game, change the value of the constant SAVEFILE_MAX.  


Spoiler: ShowHide
class Scene_File
  SAVEFILE_MAX = 99
# -------------------
def initialize(help_text)
  @help_text = help_text
end
# -------------------
def main
  @help_window = Window_Help.new
  @help_window.set_text(@help_text)
  @savefile_windows = []
  @cursor_displace = 0
  for i in 0..3
    @savefile_windows.push(Window_SaveFile.new(i, make_filename(i), i))
  end
  @file_index = 0
  @savefile_windows[@file_index].selected = true
  Graphics.transition
  loop do
    Graphics.update
    Input.update
    update
    if $scene != self
      break
    end
  end
  Graphics.freeze
  @help_window.dispose
  for i in @savefile_windows
    i.dispose
  end
end
# -------------------
def update
  @help_window.update
  for i in @savefile_windows
    i.update
  end
  if Input.trigger?(Input::C)
    on_decision(make_filename(@file_index))
    $game_temp.last_file_index = @file_index
    return
  end
  if Input.trigger?(Input::B)
    on_cancel
    return
  end
  if Input.repeat?(Input::DOWN)
    if Input.trigger?(Input::DOWN) or @file_index < SAVEFILE_MAX - 1
      if @file_index == SAVEFILE_MAX - 1
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      @cursor_displace += 1
      if @cursor_displace == 4
        @cursor_displace = 3
        for i in @savefile_windows
          i.dispose
        end
        @savefile_windows = []
        for i in 0..3
          f = i - 2 + @file_index
          name = make_filename(f)
          @savefile_windows.push(Window_SaveFile.new(f, name, i))
          @savefile_windows[i].selected = false
        end
      end
      $game_system.se_play($data_system.cursor_se)
      @file_index = (@file_index + 1)
      if @file_index == SAVEFILE_MAX
        @file_index = SAVEFILE_MAX - 1
      end
      for i in 0..3
        @savefile_windows[i].selected = false
      end
      @savefile_windows[@cursor_displace].selected = true
      return
    end
  end
  if Input.repeat?(Input::UP)
    if Input.trigger?(Input::UP) or @file_index > 0
      if @file_index == 0
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      @cursor_displace -= 1
      if @cursor_displace == -1
        @cursor_displace = 0
        for i in @savefile_windows
          i.dispose
        end
        @savefile_windows = []
        for i in 0..3
          f = i - 1 + @file_index
          name = make_filename(f)
          @savefile_windows.push(Window_SaveFile.new(f, name, i))
          @savefile_windows[i].selected = false
        end
      end
      $game_system.se_play($data_system.cursor_se)
      @file_index = (@file_index - 1)
      if @file_index == -1
        @file_index = 0
      end
      for i in 0..3
        @savefile_windows[i].selected = false
      end
      @savefile_windows[@cursor_displace].selected = true
      return
    end
  end
end
# -------------------
def make_filename(file_index)
  return "Save#{file_index + 1}.rxdata"
end
# -------------------
end



Spoiler: ShowHide
class Window_SaveFile < Window_Base
# -------------------
def initialize(file_index, filename, position)
  y = 64 + position * 104
  super(0, y, 640, 104)
  self.contents = Bitmap.new(width - 32, height - 32)
  @file_index = file_index
  @filename = "Save#{@file_index + 1}.rxdata"
  @time_stamp = Time.at(0)
  @file_exist = FileTest.exist?(@filename)
  if @file_exist
    file = File.open(@filename, "r")
    @time_stamp = file.mtime
    @characters = Marshal.load(file)
    @frame_count = Marshal.load(file)
    @game_system = Marshal.load(file)
    @game_switches = Marshal.load(file)
    @game_variables = Marshal.load(file)
    @total_sec = @frame_count / Graphics.frame_rate
    file.close
  end
  refresh
  @selected = false
end


k9inpoop

the code thing is messed up so i can't see it



Fantasist

1) Credit to RPG Advocate
2) That script has a minor visual bug: You'll get confused while navigating sometimes.

If you want it to look exactly like RMXP default save scene, I can't help atm.
Spoiler: ShowHide
Um, I DID make a save scene for my game, which is a visual imitation of the Chaos Project save scene *smirks*
(does Bliz permit me to release it, however? I'll PM Bliz about it)
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




k9inpoop




Fantasist

March 19, 2008, 02:29:57 pm #7 Last Edit: March 19, 2008, 02:31:19 pm by Fantasist
Chaos Project Save Layout script released:
http://forum.chaos-project.com/index.php?topic=796.0;topicseen

You can have ANY number of save slots, but I recommend you wait for v1.3 if you're planing on using more save slots. I'll update it very soon, so try out the above link in the mean time :)

EDIT:
off-topic: ShowHide
Um, would you mind considering a smaller size for your avtar? :)
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews