Advertisement
diamondandplatinum3

Story-Entwined Title Screen

Dec 25th, 2013
631
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 9.32 KB | None | 0 0
  1. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2. #             Story-Entwined Title Screen
  3. #             Version: 1.0
  4. #             Author: DiamondandPlatinum3
  5. #             Date: December 20, 2013
  6. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. #  Description:
  8. #
  9. #    This script allows your title screen to change depending on your player's
  10. #    progress in the game. By using this script you can change what background
  11. #    image will be displayed after a user has saved the game and at another
  12. #    time turned it on once more to continue playing.
  13. #
  14. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. #------------------------------------------------------------------------------
  16. #  Instructions:
  17. #
  18. #  ~  Modify Editable Region to your liking.
  19. #
  20. #  ~  A Video Tutorial for this script can be seen here:
  21. #         http://www.youtube.com/watch?v=P071QDDuqGY
  22. #
  23. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  24. ($diamondandplatinum3_scripts ||= {})[:StoryEntwinedTitleScreen] = true
  25. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  26. module DiamondandPlatinum3
  27.   module StoryEntwinedTitleScreen
  28.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  29.     #                                                        -=
  30.     #                 Editable Region        ////            ==
  31.     #                                                        =-
  32.     #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  33.    
  34.     # The Variable which will contain the data for the Title Screen.
  35.     # By default this variable 100, which means that as variable 100 changes
  36.     # numbers, so too could the title screen, if you allow it.
  37.     VariableID = 100
  38.    
  39.    
  40.     # Reset Title Screen Back to Default Title Screen if starting a new game?
  41.     ResetTitleScreenOnNewGame = true
  42.    
  43.    
  44.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  45.     Title_Screen = {                    # <= Do not touch this line
  46.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  47.    
  48.     # Variable Value => ["Background Image Filename" , "Foreground Image Filename"],
  49.    
  50.    
  51.       0 =>  ["Background1", "(NONE)"] ,  # This is your default title screen background image
  52.       1 =>  ["Background2", "(NONE)"] ,
  53.       2 =>  ["Background3", "(NONE)"] ,
  54.       4 =>  ["Background4", "(NONE)"] ,
  55.       5 =>  ["Background5", "(NONE)"] ,
  56.  
  57.      
  58.      
  59.      
  60.       # Add as many as you want.
  61.    
  62.      
  63.     #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  64.     #                                           \/
  65.     #               End of Editable Region      /\
  66.     #                                           \/
  67.     #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  68.     }
  69.   end
  70. end
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79. #==============================================================================
  80. # ** DataManager
  81. #------------------------------------------------------------------------------
  82. #  This module manages the database and game objects. Almost all of the
  83. # global variables used by the game are initialized by this module.
  84. #==============================================================================
  85.  
  86. module DataManager
  87.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  88.   # *= Alias Listings
  89.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  90.   class << self
  91.     alias_method(:dp3_storyentts_dataman_setupnewgame,       :setup_new_game)
  92.   end
  93.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  94.   # * Aliased Method: Set Up New Game
  95.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  96.   def self.setup_new_game(*args)
  97.     dp3_storyentts_dataman_setupnewgame(*args)
  98.     save_storyentwinedtitlescreen_data() if DiamondandPlatinum3::StoryEntwinedTitleScreen::ResetTitleScreenOnNewGame
  99.   end
  100.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  101.   # * New Method: Save Story Entwined Title Screen Data
  102.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  103.   def self.save_storyentwinedtitlescreen_data()
  104.     variable = $game_variables[DiamondandPlatinum3::StoryEntwinedTitleScreen::VariableID]
  105.     save_data(variable, "Data/Story-Entwined-Title-Screen.rvdata2")
  106.   end
  107.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  108.   # * New Method: Save Story Entwined Title Screen Data
  109.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  110.   def self.load_storyentwinedtitlescreen_data()
  111.     return load_data("Data/Story-Entwined-Title-Screen.rvdata2") rescue 0
  112.   end
  113. end
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122. #==============================================================================
  123. # ** Scene_Title
  124. #------------------------------------------------------------------------------
  125. #  This class performs the title screen processing.
  126. #==============================================================================
  127.  
  128. class Scene_Title < Scene_Base
  129.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  130.   # *= Alias Listings
  131.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  132.   alias_method(:dp3_storyentts_scntitle_createbackground,   :create_background)
  133.   alias_method(:dp3_storyentts_scntitle_disposebackground, :dispose_background)
  134.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  135.   # * Aliased Method: Create Background
  136.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  137.   def create_background(*args)
  138.     dp3_storyentts_scntitle_createbackground(*args)
  139.     @sprite1.z = 1 unless @sprite1.nil?
  140.     @sprite2.z = 1 unless @sprite2.nil?
  141.    
  142.     @dp3_background_sprite = Sprite.new
  143.     @dp3_background_sprite.bitmap = dp3_storyenttitlescreen_get_background_image()
  144.     unless @dp3_background_sprite.bitmap.nil?
  145.       @dp3_background_sprite.x = 0
  146.       @dp3_background_sprite.y = 0
  147.       @dp3_background_sprite.z = 2
  148.       @dp3_background_sprite.zoom_x  = (Graphics.width.to_f / @dp3_background_sprite.bitmap.width)
  149.       @dp3_background_sprite.zoom_y  = (Graphics.height.to_f / @dp3_background_sprite.bitmap.height)
  150.     end
  151.    
  152.     @dp3_foreground_sprite = Sprite.new
  153.     @dp3_foreground_sprite.bitmap = dp3_storyenttitlescreen_get_foreground_image()
  154.     unless @dp3_foreground_sprite.bitmap.nil?
  155.       @dp3_foreground_sprite.z = @dp3_background_sprite.z + 1
  156.       center_sprite(@dp3_foreground_sprite)
  157.     end
  158.   end
  159.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  160.   # * Alias Method: Free Background
  161.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  162.   def dispose_background(*args)
  163.     dp3_storyentts_scntitle_disposebackground(*args)
  164.     @dp3_background_sprite.bitmap.dispose unless @dp3_background_sprite.bitmap.nil?
  165.     @dp3_background_sprite.dispose
  166.     @dp3_foreground_sprite.bitmap.dispose unless @dp3_foreground_sprite.bitmap.nil?
  167.     @dp3_foreground_sprite.dispose
  168.   end
  169.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  170.   # * New Method: Get Background Image
  171.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  172.   def dp3_storyenttitlescreen_get_background_image
  173.     images = DiamondandPlatinum3::StoryEntwinedTitleScreen::Title_Screen.sort.reverse
  174.     variable = DataManager.load_storyentwinedtitlescreen_data()
  175.     images.each{ |info|
  176.       if variable >= info[0] && info[1][0].upcase != "(NONE)"
  177.         begin
  178.           return Cache.picture(info[1][0])
  179.         rescue
  180.           return Cache.title1(info[1][0])
  181.         end
  182.       end
  183.     }
  184.     return nil
  185.   end
  186.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  187.   # * New Method: Get Foreground Image
  188.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  189.   def dp3_storyenttitlescreen_get_foreground_image
  190.     images = DiamondandPlatinum3::StoryEntwinedTitleScreen::Title_Screen.sort.reverse
  191.     variable = DataManager.load_storyentwinedtitlescreen_data()
  192.     images.each{ |info|
  193.       if variable >= info[0] && info[1][1].upcase != "(NONE)"
  194.         begin
  195.           return Cache.picture(info[1][1])
  196.         rescue
  197.           return Cache.title2(info[1][1])
  198.         end
  199.       end
  200.     }
  201.     return nil
  202.   end
  203. end
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212. #==============================================================================
  213. # ** Scene_Save
  214. #------------------------------------------------------------------------------
  215. #  This class performs save screen processing.
  216. #==============================================================================
  217.  
  218. class Scene_Save < Scene_File
  219.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  220.   # *= Alias Listings
  221.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  222.   alias_method(:dp3_storyentts_scnsave_onsavesuccess,       :on_save_success)
  223.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224.   # * Alias Method: On Save Success
  225.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226.   def on_save_success(*args)
  227.     DataManager.save_storyentwinedtitlescreen_data()
  228.     dp3_storyentts_scnsave_onsavesuccess(*args)
  229.   end
  230. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement