Jump to content
Uriel Everos

Auto-load, Skip Title, Single Save System V1

Recommended Posts

ALSTSS V1.0

Auto-load, Skip Title, Single Save System V1

Exclusively For http://www.rpgmakervxace.net

Info

  • Auto-Load
  • Skips Title (Toggled)
  • Single Save File
  • Checks for save file existence using conditional branch: script. ALSTSS_checksave.checkfile == true
  • Deletes save file using  event script. ALSTSS_deletesave.delete_save

DEMO: DOWNLOAD HERE

Version History

Plans for Next Version

 

  • ?????.

 


V1.0

 

  • Released ALSTSS

 



Script

 

#==============================================================================
# ALSTSS System
# A.K.A. Autoload, Skip Title, Single Save System
#     Created by: Uriel Everos / mikkoman123
#==============================================================================
=begin
This Script Features the Following:
* Autoload system
* Single Save File system
* Skip Title which can be toggled
* Delete save file using events
* Check if save file exists using events
* Appropriate Title Screen if activated
* 5 Customizable settings
=end
#==============================================================================
# * CUSTOMIZATION
#==============================================================================
module ALSTSS
  
####--------------------------------------####
####   IMPORTANT NOTE!!!!                 ####
####  It's always better to use a Script  ####
####     call to save using events.       ####
#### USE THIS: 	DataManager.save_game(0)  ####
####--------------------------------------####

  SAVE = "ALSTSS.rvdata2" 
  # Change to whatever save file name you want
  # defaut = ALSTSS.rvdata2
  
  FADE_IN_LOAD = true 
  # Change to false if you dont want a fade in effect on load
  # defaut = true
  
  SAVEMENUACCESS = false 
  # Set to true if you want to be able to access save menu
  # default = false
  
  TITLESKIP = true
  # Set to true if you want to be able to skip the title screen
  # default = true
  
  PLAYGAME = "Play Game"
  # Change title screen button
  # default = Play Game
  
end

include ALSTSS

#==============================================================================
# * Allows deletion of save data using call event
#     * ALSTSS_deletesave.delete_save
#==============================================================================
module ALSTSS_deletesave
  def self.delete_save
    if !Dir.glob(SAVE).empty?
      File.delete(SAVE)
    end
  end
end

#==============================================================================
# * Allows checking of the existance of save data
#     for use in conditional branches
#     * ALSTSS_checksave.checkfile == true
#==============================================================================
module ALSTSS_checksave
  def self.checkfile
    if !Dir.glob(SAVE).empty?
      return true
    else
      return false
    end
  end
end

#==============================================================================
# * DataManager
#==============================================================================

module DataManager
 #------------------------------------------------------------------------------
 # * Determine Existence of Save File
 #------------------------------------------------------------------------------
  def self.save_file_exists?
    !Dir.glob(SAVE).empty? # Change 'Save' to whatever you want
  end
 #------------------------------------------------------------------------------
 # * Create Filename
 #     index : File Index
 #------------------------------------------------------------------------------
  def self.make_filename(index)
    sprintf(SAVE)		  # Change "Save" to whatever you want
  end
end

#==============================================================================
# * Scene Title
#==============================================================================

class Scene_Title < Scene_Base
  #------------------------------------------------------------------------------
  # * When The game starts
  #------------------------------------------------------------------------------
  def start
    super
    SceneManager.clear
    Graphics.freeze
    if TITLESKIP
  #------------------------------------------------------------------------------
  # * Checks if save file exists
  #     if it does, loads it.
  #     if not, starts a new game.
  #------------------------------------------------------------------------------
      if File.file?(SAVE) 
        DataManager.load_game(0)
        fadeout_all
        $game_system.on_after_load
        SceneManager.goto(Scene_Map)
      else
        DataManager.setup_new_game
        $game_map.autoplay
        SceneManager.goto(Scene_Map)
      end
      else
        create_background
        create_foreground
        create_command_window
        play_title_music
      end
    end
  def terminate
    super
    SceneManager.snapshot_for_background
    if FADE_IN_LOAD
      Graphics.fadeout(Graphics.frame_rate)
    end
    if TITLESKIP
    else
      Graphics.fadeout(Graphics.frame_rate)
      dispose_background
      dispose_foreground
      
    end
  end
  
  if TITLESKIP
    else
  def create_background
      @sprite1 = Sprite.new
      @sprite1.bitmap = Cache.title1($data_system.title1_name)
      @sprite2 = Sprite.new
      @sprite2.bitmap = Cache.title2($data_system.title2_name)
      center_sprite(@sprite1)
      center_sprite(@sprite2)
  end
  
  def create_foreground
      @foreground_sprite = Sprite.new
      @foreground_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
      @foreground_sprite.z = 100
      draw_game_title if $data_system.opt_draw_title
  end
  
  def draw_game_title
      @foreground_sprite.bitmap.font.size = 48
      rect = Rect.new(0, 0, Graphics.width, Graphics.height / 2)
      @foreground_sprite.bitmap.draw_text(rect, $data_system.game_title, 1)
  end
  
  def center_sprite(sprite)
      sprite.ox = sprite.bitmap.width / 2
      sprite.oy = sprite.bitmap.height / 2
      sprite.x = Graphics.width / 2
      sprite.y = Graphics.height / 2
  end
  
  def create_command_window
    @command_window = Window_TitleCommand.new
    @command_window.set_handler(:play, method(:command_play))
    @command_window.set_handler(:shutdown, method(:command_shutdown))
  end
  
  def command_play
    if File.file?(SAVE) 
      fadeout_all
      DataManager.load_game(0)
      $game_system.on_after_load
      SceneManager.goto(Scene_Map)
    else
      fadeout_all
      DataManager.setup_new_game
      $game_map.autoplay
      SceneManager.goto(Scene_Map)
    end
  end

  def command_shutdown
    close_command_window
    fadeout_all
    SceneManager.exit
  end
  
  def play_title_music
    $data_system.title_bgm.play
    RPG::BGS.stop
    RPG::ME.stop
  end
  
  def transition_speed
    return 20
  end
  
  def close_command_window
    @command_window.close
    update until @command_window.close?
  end
  
  def dispose_background
      @sprite1.bitmap.dispose
      @sprite1.dispose
      @sprite2.bitmap.dispose
      @sprite2.dispose
    end
  end
end

class Window_TitleCommand < Window_Command
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0)
    update_placement
    self.openness = 0
    open
  end

  #--------------------------------------------------------------------------
  # * Create Command List
  #--------------------------------------------------------------------------
  def make_command_list
    add_command(PLAYGAME, :play)
    add_command(Vocab::shutdown, :shutdown)
  end
end

#==============================================================================
# * Scene Menu
#==============================================================================
if SAVEMENUACCESS == false
  class Scene_Menu < Scene_MenuBase
    
    def command_save
      DataManager.save_game(0)
      Sound.play_save
      return_scene
    end
  end

#==============================================================================
# * SAVE MENU
#==============================================================================

  class  Scene_File < Scene_MenuBase
    #------------------------------------------------------------------------------
    # * When Save screen opens it automatically Saved game.
    #------------------------------------------------------------------------------
    def start
      super
      alstss_eventsave
      Sound.play_save
    end

    #------------------------------------------------------------------------------
    # * DO NOT EDIT THESE PART OR ELSE ERRORS.
    #------------------------------------------------------------------------------
    def terminate
    end
    def alstss_eventsave
    end
  end

  class Scene_Save < Scene_File
    #--------------------------------------------------------------------------
    # * Saves
    #--------------------------------------------------------------------------
    def alstss_eventsave
      DataManager.save_game(0)
      Sound.play_save
      SceneManager.return
    end
  end
end

 

 

 

Footnote:

Any Violent reactions, Requested Features, Polishing of Code ( i'm sure it looks very messy), and BUG REPORTS. Please do post a reply.

It would be best to download the demo and experience the script from there first.

 

Place under all other scripts. And above main.

Edited by Uriel Everos

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted