Help - Search - Members - Calendar
Full Version: Need Help With XeroVoume's Splash Screen Script
RPG RPG Revolution Forums > Scripting > Script Development and Support
SleepingSirenx
I'm having problems with XeroVolume's script ....
I tried to edit it o that it can support up to 8 splash screens but I cant seem to get it work. The first splash screen image shows then the rest don't. Can someone help me with this? Thank you. I'll include the EDITED script of his. smile.gif

CODE
#==============================================================================
# ** Scene_Splash (Ultimate Splash Scene 3.1.2 Plug-n-Play Edition)
#    By: XeroVolume
#    Date: Friday, June 11, 2010
#------------------------------------------------------------------------------
#  Special Thanks: Brewmeister for help with the original counter!
#------------------------------------------------------------------------------
#  This class performs Splash screen processing
#==============================================================================

class Scene_Splash
  #----------------------------------------------------------------------------
  # * Object Initialization
  #----------------------------------------------------------------------------
  def initialize
    #--------------------------------------------------------------------------
    #  The following variables can be customized to fit your preferences
    #--------------------------------------------------------------------------
    # Allow splash screen during playtest? (true = allow / false = do not allow)
    @playtest = true
    # Allow skip to title with SPACE or C? (true = allow / false = do not allow)
    @skip = false
    # Set the total amount of splash screens to be displayed (Default = 2)
    @amount = 8
    # Set amount of time between each splash screen (Default = 51)
    @space = 51
    # Set amount of time between final splash and title (Default = 0)
    @title_space = 0
    #--------------------------------------------------------------------------
    #  Audio Options
    #--------------------------------------------------------------------------
    # Allow SE when skipping to title? (true = allow / false = do not allow)
    @skip_se_allow = true
    # Allow BGM for splash screen 1? (true = allow / false = do not allow)
    @bgm1_allow = true
    # Allow BGM for splash screen 2? (true = allow / false = do not allow)
    @bgm2_allow =  true
    #BGM for 3
    @bgm3_allow =  true
    #BGM for 4
    @bgm4_allow =  true
    #BGM for 5
    @bgm5_allow =  true
    #BGM for 6
    @bgm6_allow =  true
    #BGM for 7
    @bgm7_allow =  true
    #BGM for 8
    @bgm8_allow =  true
    # Set BGM for splash screen 1 (Default = 061-Slow04)
    @bgm1 = '061-Slow04'
    # Set BGM for splash screen 2 (Default = 062-Slow05)
    @bgm2 = '062-Slow05'
    # Set SE for skip to title function (Default = 003-System03)
    @skip_se = '003-System03'
    # Set fade out time (in seconds) for splash screen 1 audio (Default = 2.5)
    @bgm1_out = 2.5
    # Set fade out time (in seconds) for splash screen 2 audio (Default = 2.5)
    @bgm2_out = 2.5
    #--------------------------------------------------------------------------
    #  Splash Screen 1 Options
    #--------------------------------------------------------------------------
    # Set file to be used for splash screen 1
    @splash1 = '1'
    # Set amount of frames it takes for splash 1 to fade in (Default = 51)
    @in_time1 = 51
    # Set amount of frames that splash screen 1 stays opaque (Default = 102)
    @pause_time1 = 102
    # Set amount of frames it takes for splash 1 to fade out (Default = 51)
    @out_time1 = 51
    #--------------------------------------------------------------------------
    #  Splash Screen 2 Options
    #--------------------------------------------------------------------------
    # Set file to be used for splash screen 2
    @splash2 = '2'
    # Set amount of frames it takes for splash 2 to fade in (Default = 51)
    @in_time2 = 51
    # Set amount of frames that splash screen 2 stays opaque (Default = 102)
    @pause_time2 = 102
    # Set amount of frames it takes for splash 2 to fade out (Default = 51)
    @out_time2 = 51
    #--------------------------------------------------------------------------
    #  Splash Screen 3 Options
    #--------------------------------------------------------------------------
    # Set file to be used for splash screen 2
    @splash3 = '3'
    # Set amount of frames it takes for splash 2 to fade in (Default = 51)
    @in_time3 = 51
    # Set amount of frames that splash screen 2 stays opaque (Default = 102)
    @pause_time3 = 102
    # Set amount of frames it takes for splash 2 to fade out (Default = 51)
    @out_time3 = 51
    #--------------------------------------------------------------------------
    #  Splash Screen 4 Options
    #--------------------------------------------------------------------------
    # Set file to be used for splash screen 2
    @splash4 = '4'
    # Set amount of frames it takes for splash 2 to fade in (Default = 51)
    @in_time4 = 51
    # Set amount of frames that splash screen 2 stays opaque (Default = 102)
    @pause_time4 = 102
    # Set amount of frames it takes for splash 2 to fade out (Default = 51)
    @out_time4 = 51
    #--------------------------------------------------------------------------
    #  Splash Screen 5 Options
    #--------------------------------------------------------------------------
    # Set file to be used for splash screen 2
    @splash5 = '5'
    # Set amount of frames it takes for splash 2 to fade in (Default = 51)
    @in_time5 = 51
    # Set amount of frames that splash screen 2 stays opaque (Default = 102)
    @pause_time5 = 102
    # Set amount of frames it takes for splash 2 to fade out (Default = 51)
    @out_time5 = 51
    #--------------------------------------------------------------------------
    #  Splash Screen 6 Options
    #--------------------------------------------------------------------------
    # Set file to be used for splash screen 2
    @splash6 = '6'
    # Set amount of frames it takes for splash 2 to fade in (Default = 51)
    @in_time6 = 51
    # Set amount of frames that splash screen 2 stays opaque (Default = 102)
    @pause_time6 = 102
    # Set amount of frames it takes for splash 2 to fade out (Default = 51)
    @out_time6 = 51
    #--------------------------------------------------------------------------
    #  Splash Screen 7 Options
    #--------------------------------------------------------------------------
    # Set file to be used for splash screen 2
    @splash7 = '7'
    # Set amount of frames it takes for splash 2 to fade in (Default = 51)
    @in_time7 = 51
    # Set amount of frames that splash screen 2 stays opaque (Default = 102)
    @pause_time7 = 102
    # Set amount of frames it takes for splash 2 to fade out (Default = 51)
    @out_time7 = 51
    #--------------------------------------------------------------------------
    #  Splash Screen 8 Options
    #--------------------------------------------------------------------------
    # Set file to be used for splash screen 2
    @splash8 = '8'
    # Set amount of frames it takes for splash 2 to fade in (Default = 51)
    @in_time8 = 51
    # Set amount of frames that splash screen 2 stays opaque (Default = 102)
    @pause_time8 = 102
    # Set amount of frames it takes for splash 2 to fade out (Default = 51)
    @out_time8 = 51
    #------------------------------------------------------------------------
    #  The following variables should not be adjusted
    #------------------------------------------------------------------------
    # Create loop counter (Must start at zero)
    @counter = 0
    # Set initial splash screen opacity (Must start at 0.0)
    @fade = 0.0
    # Calculate splash 1 fade in speed
    @in_speed1 = (255.0 / @in_time1)
    # Calculate splash 1 fade out speed
    @out_speed1 = (255.0 / @out_time1)
    # Calculate splash 2 fade in speed
    @in_speed2 = (255.0 / @in_time2)
    # Calculate splash 2 fade out speed
    @out_speed2 = (255.0 / @out_time2)
    # Calculate splash 3 fade in speed
    @in_speed3 = (255.0 / @in_time2)
    # Calculate splash 3 fade out speed
    @out_speed3 = (255.0 / @out_time2)
    # Calculate splash 4 fade in speed
    @in_speed4 = (255.0 / @in_time2)
    # Calculate splash 4 fade out speed
    @out_speed4 = (255.0 / @out_time2)
    # Calculate splash 5 fade in speed
    @in_speed5 = (255.0 / @in_time2)
    # Calculate splash 5 fade out speed
    @out_speed5 = (255.0 / @out_time2)
    # Calculate splash 6 fade in speed
    @in_speed6 = (255.0 / @in_time2)
    # Calculate splash 6 fade out speed
    @out_speed6 = (255.0 / @out_time2)
    # Calculate splash 7 fade in speed
    @in_speed7 = (255.0 / @in_time2)
    # Calculate splash 7 fade out speed
    @out_speed7 = (255.0 / @out_time2)
    # Calculate splash 8 fade in speed
    @in_speed8 = (255.0 / @in_time2)
    # Calculate splash 8 fade out speed
    @out_speed8 = (255.0 / @out_time2)
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Check for Battle Test
    if $BTEST
      # Switch to Title Screen
      $scene = Scene_Title.new
    end
    # Check for Play Test
    if $DEBUG && @playtest == false
      # Switch to Title Screen
      $scene = Scene_Title.new
    end
    # Load the System database & create a new game
    $data_system = load_data("Data/System.rxdata")
    $game_system = Game_System.new
    # Create splash screen 1 graphic
    @sprite1 = Sprite.new
    @sprite1.bitmap = RPG::Cache.title(@splash1)
    # Adjust sprite properties
    @sprite1.ox = @sprite1.bitmap.width / 2
    @sprite1.oy = @sprite1.bitmap.height / 2
    # Center sprite on screen
    @sprite1.x = 320
    @sprite1.y = 240
    # Set initial opacity
    @sprite1.opacity = 0
    # Create splash screen 2 graphic
    @sprite2 = Sprite.new
    @sprite2.bitmap = RPG::Cache.title(@splash2)
    # Adjust sprite properties
    @sprite2.ox = @sprite2.bitmap.width / 2
    @sprite2.oy = @sprite2.bitmap.height / 2
    # Center sprite on screen
    @sprite2.x = 320
    @sprite2.y = 240
    # Set initial opacity
    @sprite2.opacity = 0
    # Create splash screen 3 graphic
    @sprite3 = Sprite.new
    @sprite3.bitmap = RPG::Cache.title(@splash3)
    # Adjust sprite properties
    @sprite3.ox = @sprite2.bitmap.width / 2
    @sprite3.oy = @sprite2.bitmap.height / 2
    # Center sprite on screen
    @sprite3.x = 320
    @sprite3.y = 240
    # Set initial opacity
    @sprite3.opacity = 0
    # Create splash screen 4 graphic
    @sprite4 = Sprite.new
    @sprite4.bitmap = RPG::Cache.title(@splash4)
    # Adjust sprite properties
    @sprite4.ox = @sprite2.bitmap.width / 2
    @sprite4.oy = @sprite2.bitmap.height / 2
    # Center sprite on screen
    @sprite4.x = 320
    @sprite4.y = 240
    # Set initial opacity
    @sprite4.opacity = 0
    # Create splash screen 5 graphic
    @sprite5 = Sprite.new
    @sprite5.bitmap = RPG::Cache.title(@splash5)
    # Adjust sprite properties
    @sprite5.ox = @sprite2.bitmap.width / 2
    @sprite5.oy = @sprite2.bitmap.height / 2
    # Center sprite on screen
    @sprite5.x = 320
    @sprite5.y = 240
    # Set initial opacity
    @sprite5.opacity = 0
    # Create splash screen 6 graphic
    @sprite6 = Sprite.new
    @sprite6.bitmap = RPG::Cache.title(@splash6)
    # Adjust sprite properties
    @sprite6.ox = @sprite2.bitmap.width / 2
    @sprite6.oy = @sprite2.bitmap.height / 2
    # Center sprite on screen
    @sprite6.x = 320
    @sprite6.y = 240
    # Set initial opacity
    @sprite6.opacity = 0
    # Create splash screen 7 graphic
    @sprite7 = Sprite.new
    @sprite7.bitmap = RPG::Cache.title(@splash7)
    # Adjust sprite properties
    @sprite7.ox = @sprite2.bitmap.width / 2
    @sprite7.oy = @sprite2.bitmap.height / 2
    # Center sprite on screen
    @sprite7.x = 320
    @sprite7.y = 240
    # Set initial opacity
    @sprite7.opacity = 0
    # Create splash screen 8 graphic
    @sprite8 = Sprite.new
    @sprite8.bitmap = RPG::Cache.title(@splash8)
    # Adjust sprite properties
    @sprite8.ox = @sprite2.bitmap.width / 2
    @sprite8.oy = @sprite2.bitmap.height / 2
    # Center sprite on screen
    @sprite8.x = 320
    @sprite8.y = 240
    # Set initial opacity
    @sprite8.opacity = 0
    # Stop playing ME and BGS
    Audio.me_stop
    Audio.bgs_stop
    # 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
      # Update loop counter
      @counter += 1
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of Splash Screen graphics
    @sprite1.dispose
    @sprite1.bitmap.dispose
    @sprite2.dispose
    @sprite2.bitmap.dispose
    @sprite3.dispose
    @sprite3.bitmap.dispose
    @sprite4.dispose
    @sprite4.bitmap.dispose
    @sprite5.dispose
    @sprite5.bitmap.dispose
    @sprite6.dispose
    @sprite6.bitmap.dispose
    @sprite7.dispose
    @sprite7.bitmap.dispose
    @sprite8.dispose
    @sprite8.bitmap.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame update
  #--------------------------------------------------------------------------
  def update
    # If C button was pressed
    if Input.trigger?(Input::C) && @skip == true
      if @skip_se_allow == true
        # Play decision SE
        $game_system.se_play(RPG::AudioFile.new(@skip_se))
      end
      # Switch to title screen
      $scene = Scene_Title.new
    end
    # Fade Cycle
    fade_cycle
    # Update Graphics
    @sprite1.update
    @sprite2.update
    @sprite3.update
    @sprite4.update
    @sprite5.update
    @sprite6.update
    @sprite7.update
    @sprite8.update
  end
  #--------------------------------------------------------------------------
  # * Fade Cycle
  #--------------------------------------------------------------------------
  def fade_cycle
    # Determinent (Based on amount of splash screens remaining)
    case @amount
    # When 2 splash screens remain
    when 8
      # Check for audio
      if @counter == 1 && @bgm1_allow == true
        $game_system.bgm_play(RPG::AudioFile.new(@bgm1))
      end
      # Set splash screen 1's opacity level equal to @fade variable's value
      @sprite1.opacity = @fade
      # Fade in
      if @counter <= @in_time1
        @fade += @in_speed1
      end
      # Pause splash screen 1
      if @counter >= @in_time1 + @pause_time1
        # Fade out graphics
        @fade -= @out_speed1
      end
      # Fade out BGM
      if @counter == @in_time1 + @pause_time1
        Audio.bgm_fade(@bgm1_out * 1000)
      end
      # Space between splash screens
      if @counter >= @in_time1 + @out_time1 + @pause_time1 + @space
        # Update splash screen amount
        @amount -= 1
        # Reset loop counter
        @counter = 0
        # Reset opacity variable
        @fade = 0
      end
    # When 1 splash screen remains
    when 1
      # Check for audio
      if @counter == 1 && @bgm2_allow == true
        $game_system.bgm_play(RPG::AudioFile.new(@bgm2))
      end
      # Set splash screen 2's opacity level equal to @fade variable's value
      @sprite2.opacity = @fade
      # Fade in
      if @counter <= @in_time2
        @fade += @in_speed2
      end
      # Pause splash screen 2
      if @counter >= @in_time2 + @pause_time2
        # Fade out graphics
        @fade -= @out_speed2
      end
      # Fade out BGM
      if @counter == @in_time2 + @pause_time2
        Audio.bgm_fade(@bgm2_out * 1000)
      end
      # Space between splash screen and title screen
      if @counter >= @in_time2 + @out_time2 + @pause_time2 + @title_space
        # Update splash screen amount
        @amount -= 1
      end
      # When 0 splash screens remain
    when 0
      # Switch to Title Screen
      $scene = Scene_Title.new
    end
  end
  #--------------------------------------------------------------------------
  # * Plug-n-Play Functionality
  #--------------------------------------------------------------------------
  $scene = Scene_Splash.new
  $scene.main while $scene.is_a?(self)
end
Tsukihime
I couldn't get it to work with even one splash screen without freezing.

Then I decided to look at this http://www.rpgrevolution.com/forums/index....showtopic=24981

Easier to use, but not sure if there's some special functionality in the one you chose.
It just looks like you want to load splash screens before the game loads though.
Night_Runner
Both have the problem that they don't really support a varying number of splash screens...

I've edited the one SleepingSirenX posted, it supports as many as you want now:

CODE
#==============================================================================
# ** Scene_Splash (Ultimate Splash Scene 3.1.2 Plug-n-Play Edition)
#    By: XeroVolume
#    Date: Friday, June 11, 2010
#------------------------------------------------------------------------------
#    Edited by: Night_Runner
#    Date: Monday, November 14, 2011
#     @> http://www.rpgrevolution.com/forums/index.php?showtopic=53967
#------------------------------------------------------------------------------
#  Special Thanks: Brewmeister for help with the original counter! (removed)
#------------------------------------------------------------------------------
#  This class performs Splash screen processing
#==============================================================================

class Scene_Splash
  #----------------------------------------------------------------------------
  # * Object Initialization
  #----------------------------------------------------------------------------
  def initialize
    #--------------------------------------------------------------------------
    #  The following variables can be customized to fit your preferences
    #--------------------------------------------------------------------------
    # Allow splash screen during playtest? (true = allow / false = do not allow)
    @playtest = true
    # Allow skip to title with SPACE or C? (true = allow / false = do not allow)
    @skip = false
    # Set the total amount of splash screens to be displayed (Default = 2)
    @amount = 8
    # Set amount of time between final splash and title (Default = 0)
    @title_space = 0
    #--------------------------------------------------------------------------
    #  Audio Options
    #--------------------------------------------------------------------------
    # Allow SE when skipping to title? (true = allow / false = do not allow)
    @skip_se_allow = true
    # Allow BGM for splash screen 1? (true = allow / false = do not allow)
    @bgm1_allow = true
    # Allow BGM for splash screen 2? (true = allow / false = do not allow)
    @bgm2_allow =  true
    #BGM for 3
    @bgm3_allow =  true
    #BGM for 4
    @bgm4_allow =  true
    #BGM for 5
    @bgm5_allow =  true
    #BGM for 6
    @bgm6_allow =  true
    #BGM for 7
    @bgm7_allow =  true
    #BGM for 8
    @bgm8_allow =  true
    # Set BGM for splash screen 1 (Default = 061-Slow04)
    @bgm1 = '061-Slow04'
    # Set BGM for splash screen 2 (Default = 062-Slow05)
    @bgm2 = '062-Slow05'
    # Set SE for skip to title function (Default = 003-System03)
    @skip_se = '003-System03'
    #--------------------------------------------------------------------------
    #  Splash Screen 1 Options
    #--------------------------------------------------------------------------
    # Set file to be used for splash screen 1
    @splash1 = '1'
    # Set amount of frames it takes for splash 1 to fade in (Default = 51)
    @in_time1 = 51
    # Set amount of frames that splash screen 1 stays opaque (Default = 102)
    @pause_time1 = 102
    # Set amount of frames it takes for splash 1 to fade out (Default = 51)
    @out_time1 = 51
    #--------------------------------------------------------------------------
    #  Splash Screen 2 Options
    #--------------------------------------------------------------------------
    # Set file to be used for splash screen 2
    @splash2 = '2'
    # Set amount of frames it takes for splash 2 to fade in (Default = 51)
    @in_time2 = 51
    # Set amount of frames that splash screen 2 stays opaque (Default = 102)
    @pause_time2 = 102
    # Set amount of frames it takes for splash 2 to fade out (Default = 51)
    @out_time2 = 51
    #--------------------------------------------------------------------------
    #  Splash Screen 3 Options
    #--------------------------------------------------------------------------
    # Set file to be used for splash screen 2
    @splash3 = '3'
    # Set amount of frames it takes for splash 2 to fade in (Default = 51)
    @in_time3 = 51
    # Set amount of frames that splash screen 2 stays opaque (Default = 102)
    @pause_time3 = 102
    # Set amount of frames it takes for splash 2 to fade out (Default = 51)
    @out_time3 = 51
    #--------------------------------------------------------------------------
    #  Splash Screen 4 Options
    #--------------------------------------------------------------------------
    # Set file to be used for splash screen 2
    @splash4 = '4'
    # Set amount of frames it takes for splash 2 to fade in (Default = 51)
    @in_time4 = 51
    # Set amount of frames that splash screen 2 stays opaque (Default = 102)
    @pause_time4 = 102
    # Set amount of frames it takes for splash 2 to fade out (Default = 51)
    @out_time4 = 51
    #--------------------------------------------------------------------------
    #  Splash Screen 5 Options
    #--------------------------------------------------------------------------
    # Set file to be used for splash screen 2
    @splash5 = '5'
    # Set amount of frames it takes for splash 2 to fade in (Default = 51)
    @in_time5 = 51
    # Set amount of frames that splash screen 2 stays opaque (Default = 102)
    @pause_time5 = 102
    # Set amount of frames it takes for splash 2 to fade out (Default = 51)
    @out_time5 = 51
    #--------------------------------------------------------------------------
    #  Splash Screen 6 Options
    #--------------------------------------------------------------------------
    # Set file to be used for splash screen 2
    @splash6 = '6'
    # Set amount of frames it takes for splash 2 to fade in (Default = 51)
    @in_time6 = 51
    # Set amount of frames that splash screen 2 stays opaque (Default = 102)
    @pause_time6 = 102
    # Set amount of frames it takes for splash 2 to fade out (Default = 51)
    @out_time6 = 51
    #--------------------------------------------------------------------------
    #  Splash Screen 7 Options
    #--------------------------------------------------------------------------
    # Set file to be used for splash screen 2
    @splash7 = '7'
    # Set amount of frames it takes for splash 2 to fade in (Default = 51)
    @in_time7 = 51
    # Set amount of frames that splash screen 2 stays opaque (Default = 102)
    @pause_time7 = 102
    # Set amount of frames it takes for splash 2 to fade out (Default = 51)
    @out_time7 = 51
    #--------------------------------------------------------------------------
    #  Splash Screen 8 Options
    #--------------------------------------------------------------------------
    # Set file to be used for splash screen 2
    @splash8 = '8'
    # Set amount of frames it takes for splash 2 to fade in (Default = 51)
    @in_time8 = 51
    # Set amount of frames that splash screen 2 stays opaque (Default = 102)
    @pause_time8 = 102
    # Set amount of frames it takes for splash 2 to fade out (Default = 51)
    @out_time8 = 51
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Check for Battle Test
    if $BTEST
      # Switch to Title Screen
      $scene = Scene_Title.new
    end
    # Check for Play Test
    if $DEBUG && @playtest == false
      # Switch to Title Screen
      $scene = Scene_Title.new
    end
    # Load the System database & create a new game
    $data_system = load_data("Data/System.rxdata")
    $game_system = Game_System.new
    @sprites = []
    for i in 1..@amount
      # Load the sprite
      sprite = Sprite.new
      sprite.bitmap = RPG::Cache.title( eval( '@splash' + i.to_s ).to_s )
      # Center relative to the screen
      sprite.x = 320 - sprite.bitmap.width / 2
      sprite.y = 240 - sprite.bitmap.height / 2
      # Set the default opacity
      sprite.opacity = 0
      # Keep the sprite in memory
      @sprites << sprite
    end
    # Create a loop counter
    @counter = 0
    # Keep track of the current picture
    @index = 1
    # Stop playing ME and BGS
    Audio.me_stop
    Audio.bgs_stop
    # 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 Splash Screen graphics
    @sprites.each { |sprite| sprite.bitmap.dispose; sprite.dispose }
  end
  #--------------------------------------------------------------------------
  # * Frame update
  #--------------------------------------------------------------------------
  def update
    # If C button was pressed
    if Input.trigger?(Input::C) and @skip == true
      if @skip_se_allow == true
        # Play decision SE
        $game_system.se_play(RPG::AudioFile.new(@skip_se))
      end
      # Switch to title screen
      $scene = Scene_Title.new
    end
    # Fade Cycle
    fade_cycle
    # Update Graphics
    @sprites.each { |sprite| sprite.update }
  end
  #--------------------------------------------------------------------------
  # * Fade Cycle
  #--------------------------------------------------------------------------
  def fade_cycle
    # Get the sprite being shown
    sprite = @sprites[@index - 1]
    # If we're fading in
    if @counter == 0 and sprite.opacity != 255
      # First time here
      if sprite.opacity == 0
        load_variables
        # Play the audio
        if @bgm_allow == true
          $game_system.bgm_play( RPG::AudioFile.new( @bgm_name ) )
        end
      end
      # Then fade in the graphic
      sprite.opacity += 255.0 / @in_time
      # Don't update the counter
      return
    # If we're fading out
    elsif @counter >= @pause_time
      # First time here; fade the audio
      if sprite.opacity == 255
        Audio.bgm_fade(@bgm_out)
      end
      # Fade out the graphic
      sprite.opacity -= 255.0 / @out_time
      # If the graphic is faded out
      if sprite.opacity == 0
        # Reset the counter
        @counter = 0
        # Increment the index
        @index += 1
        # If we've shown every picture
        if @index > @amount
          # Wait the specified amount of frames
          @title_space.times { Graphics.update }
          # Stope processing
          $scene = nil
        end
        return
      end
    # If we're just showing the picture
    end
    # Increment the loop counter
    @counter += 1
  end
  #--------------------------------------------------------------------------
  # * Load Variables
  #--------------------------------------------------------------------------
  def load_variables
    # Get the name of the audiofile, and whether it is allowed
    @bgm_name = eval('@bgm' + @index.to_s).to_s
    @bgm_allow =  eval('@bgm' + @index.to_s + '_allow') == true ? true : false
    # Get the fade in time
    @in_time = eval('@in_time' + @index.to_s).to_i
    @in_time = @in_time == 0 ? 51 : @in_time
    # Get the number of frames to display for
    @pause_time = eval('@pause_time' + @index.to_s).to_i
    @pause_time = @pause_time == 0 ? 102 : @pause_time
    # Calculate the fade out audio time
    @out_time = eval('@out_time' + @index.to_s).to_i
    @out_time = @out_time == 0 ? 51 : @out_time
    @bgm_out = (@out_time * 1000 / Graphics.frame_rate).to_i
  end
  #--------------------------------------------------------------------------
  # * Plug-n-Play Functionality
  #--------------------------------------------------------------------------
  $scene = Scene_Splash.new
  $scene.main while $scene.is_a?(self)
end


It works off the assumption that you continue to use the naming convention just as you have (@bgm1_allow, @bgm2_allo, etc., @bgm1, @bgm2, etc, etc).

I've also got some check codes in there, so if you don't specify a bgm name it doesn't play any, if you don't specify a bgm it doesn't play any (as opposed to crashing), if you don't specify a fade in time it defaults to 51 frames, if you don't specify a pause time it defaults to 102 frames, and if you don't specify a fade out time it defaults to 51 frames.
This is just because you seem content with the default number, and it saves you having to re-type it out for every single title screen.

I've also removed the bgm fade out time, it seems redundant, it's always going to be the same time as the fade out time for the graphics.

And with how I've optimised the code it now no longer lets you skip the splash screens when you have that delay between the end of the last graphic and the start of the title menu. It's a minor tweak, and considering you set it that delay to 0 frames you probably won't notice it, I just thought it was worth mentioning.
SleepingSirenx
Gee, thanks for this sir Night_Runner. This really helped. smile.gif Well back to command window tutorials.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.