INTRODUCTION
There have been many splash scripts out there, but many force the game developer to use a fixed number of screens. And those that don't, those few rarely allow the setting for how long a splash screen may last of if any music or audio plays when it is shown. This splash screen script covers all of those features.
Code:
#============================================================================== # ** VVulfSplash #------------------------------------------------------------------------------ # by DerVVulfman # version 1.0 # 09-10-2019 # RGSS / RMXP #============================================================================== # # INTRODUCTION: # # There have been many splash scripts out ther, but many force the game de- # veloper to use a fixed number of screens. And those that don't, those few # rarely allow the setting for how long a splash screen may last of if any # music or audio plays when it is shown. This splash screen script covers # all of those features. # # #------------------------------------------------------------------------------ # # INSTALLATION: # # Place this script right below Scene_Debug and above Main for it to work. # # If you find the need to 'FORCE' it to show immediately, you can erase the # last two lines under the heading of 'Link System', and replace the entry # of $scene = Scene_Title.new with Scene_VVulfSplash.new. # # Configure as needed. # # #------------------------------------------------------------------------------ # # RESOURCES: # # It's a freakin splash screen script! OF COURSE IT NEEDS RESOURCES! DUH! # # Splash screens are kept within the new 'Graphics\Splash' folder of your # project. And they are the classic 640x480 format. # # If any audio files are to be played, they are in the Audio\BGM folder. # #------------------------------------------------------------------------------ # # COMPATABILITY: # # Fairly compatible for RPGMaker XP systems. It doesn't rewrite any methods # in the system. But it does create a caching system for a Graphics\Splash # folder which does compress with the rest of your game. # #------------------------------------------------------------------------------ # # TERMS OF USE: # # Free for use, even in commercial games. Only due credit is required. # # #============================================================================== module VVulfSplash #-------------------------------------------------------------------------- SPLASH = {} # Do Not Touch #-------------------------------------------------------------------------- # SKIP SYSTEM # =========== # These editable values control how your splash screen will be controlled # hy the player, or if the screen shows when you are playing in debug mode. #-------------------------------------------------------------------------- # SKIP = true # Is skip permitted? SKIP_SE = '002-System02' # SE performed when skipped (or nil or "") PLAYTEST = true # Perform Splashscreens in Playtest Mode # INTRO SCREENS # ============= # This is a collection of one (or more) hash arrays, each array holding # various entries for each individual splash screen. They must be in order. #-------------------------------------------------------------------------- # MUSIC: It can play a background music file if set (Audio\BGM) # By default, it will fade out the music to match the screen fade. # If a 'music-fade' entry is added, it will fade out based on that # value or until the screen fades, whichever is first. #-------------------------------------------------------------------------- # Image ... Valid image for splash screen # In ...... Fade-in delay for splash screen # Show .... The time which the splash screen is shown # Out ..... Fade-out time for splash screen # Music ... (optional) The background music played for the splash screen # MFade ... (optional) The amount of time it takes for the music to fade # # Image In Show Out Music MFade # ======= ===== ===== ===== ================= ===== SPLASH[0] = ['Intro 1', 51, 25, 51] SPLASH[1] = ['Intro 2', 51, 75, 51, 'howl', 1.1] end #============================================================================== # ** RPG::Cache #------------------------------------------------------------------------------ # This is a module that loads each of RPGXP's graphic formats, creates a # Bitmap object, and retains it. #============================================================================== module RPG::Cache #-------------------------------------------------------------------------- # * Splash Screen Cache # filename : splash screen filename #-------------------------------------------------------------------------- def self.splash(filename) self.load_bitmap("Graphics/Splash/", filename) end end #============================================================================== # ** Scene_VVulfSplash #------------------------------------------------------------------------------ # This class performs splash screen processing. #============================================================================== class Scene_VVulfSplash #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main if $DEBUG && VVulfSplash::PLAYTEST == false # If Debug and Playtest off $scene = Scene_Title.new # Go to Title Screen end Audio.me_stop # Stop playing ME Audio.bgs_stop # Stop playing BGS main_variables # Instance Variables Graphics.transition # Execute transition loop do # Main loop Graphics.update # Update game screen Input.update # Update input information update # Frame update break if $scene != self # Abort loop if changed end Graphics.freeze # Prepare for transition @splash.dispose # Dispose of Sprites end #-------------------------------------------------------------------------- # * Main Processing : Handling startup variables #-------------------------------------------------------------------------- def main_variables filename = "Data/System.rxdata" # Define system data file $data_system = load_data(filename) # Load system data file $game_system = Game_System.new # Create Game_System object @splash = Sprite.new # Create Sprite @screens = VVulfSplash::SPLASH.size # Determine no. of splashes @loaded = false # Set splashes not loaded @index = 0 # Set index to start @wait = 0 # Set no wait time set @audio_flag = 0 # Set no active audio flag end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update update_exit if update_decision? == true # Exit on player input intro_update # Process Splashscreens end #-------------------------------------------------------------------------- # * Frame Update : Acquire player decision #-------------------------------------------------------------------------- def update_decision? return false unless VVulfSplash::SKIP == true # Set False if no skip return false unless Input.trigger?(Input::C) # Set false if no decision unless VVulfSplash::SKIP_SE.nil? or # Only work if file not nil VVulfSplash::SKIP_SE == "" # or file not empty audiofile = # Define the audiofile as RPG::AudioFile.new(VVulfSplash::SKIP_SE) # ...the one in the config $game_system.se_play(audiofile) # And play the file end return true # Return as true end #-------------------------------------------------------------------------- # * Frame Update : Process through splashscreens #-------------------------------------------------------------------------- def intro_update return if update_delay == true # Pause after showing screen update_load # Load / reset each screen update_audio # Set (or fade out) music update_reverse # Determine if reversing @splash.opacity += @speed # Apply opacity update_advance # Advance to next screen update_exit if @index == @screens # Exit if screens played end #-------------------------------------------------------------------------- # * Frame Update : Pause Image before fade out #-------------------------------------------------------------------------- def update_delay return false unless @wait > 0 # Exit unless delay valid return false unless @reversed == true # Exit unless refersing set @wait -= 1 # Decrease delay time @audio_flag = 2 if @wait < 2 # Set Audio Flag before end Graphics.update # Advance Graphics frame +1 return true # Exit w/ active delay true end #-------------------------------------------------------------------------- # * Frame Update : Load image and data #-------------------------------------------------------------------------- def update_load return if @loaded == true # Exit if already loaded filename = VVulfSplash::SPLASH[@index][0] # Obtain splash filename @splash.bitmap = RPG::Cache.splash(filename) # Set splash graphic speed_val = VVulfSplash::SPLASH[@index][1] # Obtain config speed @speed = (255.0 / speed_val).to_i # Set actual speed @wait = VVulfSplash::SPLASH[@index][2] # Obtain wait time @splash.opacity = 0 # Set initial opacity @audio_flag = 1 # Set audio to start @loaded = true # Set loaded flag @reversed = false # Disable reverse flag end #-------------------------------------------------------------------------- # * Frame Update : Handling Audio Playback #-------------------------------------------------------------------------- def update_audio case @audio_flag # Branch on system action when 1 ; update_audio_play # Screen load - start audio when 2 ; update_audio_fade # Delay ended - fade audio end @audio_flag = 0 # Disable audio flag end #-------------------------------------------------------------------------- # * Frame Update : Handling Audio Start #-------------------------------------------------------------------------- def update_audio_play filename = VVulfSplash::SPLASH[@index][4] # Acquire filename return if filename.nil? # Exit if nil return if filename == "" # Exit if empty playback = RPG::AudioFile.new(filename) # Set up the audio $game_system.bgm_play(playback) # Play the audio end #-------------------------------------------------------------------------- # * Frame Update : Handling Audio Fade #-------------------------------------------------------------------------- def update_audio_fade return if VVulfSplash::SPLASH[@index][4].nil? # Exit if no audio played flag = (VVulfSplash::SPLASH[@index][5] == nil) # is no-custom nil? idx = (flag) ? 3 : 5 # Obtain index in array mult = (flag) ? 25 : 1000 # Obtain time multiplier delay = VVulfSplash::SPLASH[@index][idx] * mult # Calculate delay Audio.bgm_fade(delay) # Fade out audio end #-------------------------------------------------------------------------- # * Frame Update : Reverse opacity direction #-------------------------------------------------------------------------- def update_reverse return if @splash.opacity < 255 # Begin only after fade in return if @reversed == true # Begin if not reversing @reversed = true # Set as reversing speed_val = VVulfSplash::SPLASH[@index][3] # Obtain config speed @speed = -1 * (255.0 / speed_val).to_i # Set actual speed end #-------------------------------------------------------------------------- # * Frame Update : Advance index to next image #-------------------------------------------------------------------------- def update_advance return unless @splash.opacity <= 0 # Exit if still opaque @loaded = false # Set image as not loaded @index += 1 # Advance to next index end #-------------------------------------------------------------------------- # * Frame Update : Exit to Title #-------------------------------------------------------------------------- def update_exit Graphics.freeze # Prepare for transition $scene = Scene_Title.new # Proceed to Title Screen end #-------------------------------------------------------------------------- # * Link system to start playback #-------------------------------------------------------------------------- $scene = Scene_VVulfSplash.new # Set scene to Splash $scene.main while $scene.is_a?(self) # Set current scene end
RESOURCES
It's a freakin splash screen script! OF COURSE IT NEEDS RESOURCES! DUH!
Splash screens are kept within the new 'Graphics\Splash' folder of your project. And they are the classic 640x480 format.
If any audio files are to be played, they are in the Audio\BGM folder.
COMPATIBILITY
Fairly compatible for RPGMaker XP systems. It doesn't rewrite any methods in the system. But it does create a caching system for a Graphics\Splash folder which does compress with the rest of your game.
TERMS OF USE
Free for use, even in commercial games. Only due credit is required.