Advertisement
TheSixth

Status Menu Backgrounds

Dec 7th, 2016
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 7.19 KB | None | 0 0
  1. #===============================================================================
  2. # * [ACE] Status Menu Backgrounds
  3. #===============================================================================
  4. # * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
  5. # * Version: 1.0
  6. # * Updated: 07/12/2016
  7. # * Requires: --------
  8. #-------------------------------------------------------------------------------
  9. # * < Change Log >
  10. #-------------------------------------------------------------------------------
  11. # * Version 1.0 (07/12/2016)
  12. #   - Initial release.
  13. #-------------------------------------------------------------------------------
  14. # * < Description >
  15. #-------------------------------------------------------------------------------
  16. # * This is a simple script for adding custom backgrounds for your status menu.
  17. # * You can make unlimited amount of backgrounds.
  18. # * Set up static and/or scrolling backgrounds.
  19. # * Can be used to remove the default mapshot background as well.
  20. #-------------------------------------------------------------------------------
  21. # * < Installation >
  22. #-------------------------------------------------------------------------------
  23. # * Place this script between Materials and Main!
  24. #-------------------------------------------------------------------------------
  25. # * < Compatibility Info >
  26. #-------------------------------------------------------------------------------
  27. # * No known incompatibilities, but there is a high chance of this not working
  28. #   with some other scripts dealing with the visuals of the status menu.
  29. #-------------------------------------------------------------------------------
  30. # * < Known Issues >
  31. #-------------------------------------------------------------------------------
  32. # * No known issues.
  33. #-------------------------------------------------------------------------------
  34. # * < Terms of Use >
  35. #-------------------------------------------------------------------------------
  36. # * Free to use for whatever purposes you want.
  37. # * Credit me (Sixth) in your game, pretty please! :P
  38. # * Posting modified versions of this script is allowed as long as you notice me
  39. #   about it with a link to it!
  40. #===============================================================================
  41. $imported = {} if $imported.nil?
  42. $imported["SixthStatusBacks"] = true
  43. #===============================================================================
  44. # Settings:
  45. #===============================================================================
  46. module StatBack
  47.   #-----------------------------------------------------------------------------
  48.   # Image Folder Settings:
  49.   #-----------------------------------------------------------------------------
  50.   # Set up the folder used for the background images in the status menu here.
  51.   #-----------------------------------------------------------------------------
  52.   ImgFolder = "Graphics/Pictures/"
  53.  
  54.   #-----------------------------------------------------------------------------
  55.   # Background Settings:
  56.   #-----------------------------------------------------------------------------
  57.   # This is the place to setup your background images for the status menu.
  58.   #
  59.   # You can either make scrolling images, static images, or combine them both!
  60.   # If you have set a :scroll setting for the background, it will be a scrolling
  61.   # background, if you omit that setting, it will be a static one!
  62.   # You can make as many backgrounds as you want!
  63.   #
  64.   # Format:
  65.   #
  66.   #   key => {
  67.   #     :img => "file name",
  68.   #     :pos => [x,y], # Only for static backgrounds!
  69.   #     :opa => value,
  70.   #     :z => value,
  71.   #     :scroll => [x_scroll,y_scroll], # Only for scrolling backgrounds!
  72.   #   },
  73.   #
  74.   #   key => {
  75.   # This is the key for the background. You can set this to anything you want,
  76.   # strings, numbers, symbols, arrays of data, and so on. The only thing you
  77.   # need to take care is that there can be no duplicate keys in the settings!
  78.   #
  79.   #   :img => "file name",
  80.   # The image used for the background.
  81.   # All images must be in the folder you have set up in the 'ImgFolder'
  82.   # setting above!
  83.   #
  84.   #   :pos => [x,y],
  85.   # The X and Y position of the background.
  86.   # This only needs to be set for static backgrounds!
  87.   #
  88.   #   :opa => value,
  89.   # The opacity value for the background image. Valid values: 0 - 255.
  90.   #
  91.   #   :z => value,
  92.   # The Z value for the background.
  93.   #
  94.   #   :scroll => [x_scroll,y_scroll],
  95.   # The scrolling speed of the background.
  96.   # The higher the values, the quicker it will scroll!
  97.   # The 1st value is the scrolling on the X axis, the 2nd is for the Y axis!
  98.   # Only add this setting if you want the background to be a scrolling one!
  99.   #
  100.   # NOTE:
  101.   # If you use the key :mapback, the current map screenshot will be used
  102.   # as a background, like in the default menus.
  103.   # So, that key is reserved for that!
  104.   #-----------------------------------------------------------------------------
  105.   Backs = {
  106.     :mapback => { # This is the default mapshot background!
  107.       :pos => [0,0], :opa => 100, :z => 0,
  108.     },
  109. #~     :custom1 => {
  110. #~       :img => "WorldMap", :pos => [0,0], :opa => 100, :z => 0, :scroll => [1,1],
  111. #~     },
  112. #~     :custom2 => {
  113. #~       :img => "compass", :pos => [640-140,10], :opa => 150, :z => 330,
  114. #~     },
  115.     # Add more background settings here!
  116.   }
  117.  
  118. end
  119. #===============================================================================
  120. # End of settings! O.o
  121. #===============================================================================
  122.  
  123. module Cache
  124.  
  125.   def self.custom_imgs(img,folder)
  126.     load_bitmap(folder,img)
  127.   end
  128.  
  129. end
  130.  
  131. class Scene_Status < Scene_MenuBase
  132.  
  133.   alias add_back8861 start
  134.   def start
  135.     add_back8861
  136.     init_backs
  137.   end
  138.  
  139.   def init_backs
  140.     @backs = {}
  141.     folder = StatBack::ImgFolder
  142.     StatBack::Backs.each do |sym,data|
  143.       @backs[sym] = data[:scroll].nil? ? Sprite.new : Plane.new
  144.       if sym == :mapback
  145.         @backs[sym].bitmap = SceneManager.background_bitmap.clone
  146.       else
  147.         @backs[sym].bitmap = Cache.custom_imgs(data[:img],folder)
  148.       end
  149.       if @backs[sym].is_a?(Sprite)
  150.         @backs[sym].x = data[:pos][0]
  151.         @backs[sym].y = data[:pos][1]
  152.       end
  153.       @backs[sym].opacity = data[:opa]
  154.       @backs[sym].z = data[:z]
  155.     end
  156.   end
  157.  
  158.   def create_background
  159.     # Removed!
  160.   end
  161.  
  162.   def update
  163.     super
  164.     update_scrolling_backs
  165.   end
  166.  
  167.   def update_scrolling_backs
  168.     @backs.each do |sym,sp|
  169.       next unless sp.is_a?(Plane)
  170.       sp.ox += StatBack::Backs[sym][:scroll][0]
  171.       sp.oy += StatBack::Backs[sym][:scroll][1]
  172.     end
  173.   end
  174.  
  175.   alias bcontr7726 dispose_background
  176.   def dispose_background # Left in for error prevention.
  177.     return if @background_sprite.nil? || @background_sprite.disposed?
  178.     bcontr7726
  179.   end
  180.  
  181.   def dispose_backs
  182.     @backs.each_value {|sp| sp.bitmap.dispose; sp.dispose}
  183.   end
  184.  
  185.   alias disp_backs0191 dispose_all_windows
  186.   def dispose_all_windows
  187.     disp_backs0191
  188.     dispose_backs
  189.   end
  190.  
  191. end
  192. #==============================================================================
  193. # !!END OF SCRIPT - OHH, NOES!!
  194. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement