The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: BlueEagle7 on May 23, 2009, 01:29:45 AM

Title: [Request] Map background for all menus
Post by: BlueEagle7 on May 23, 2009, 01:29:45 AM
<Map Background for Menus>
<23rd May 2009>




Summary
I'm after a script that will prevent background of menu screens from going blank. That means, when you go the the main menu, you will see the current game map in the background, with the menu windows displayed over the top. In the title screen load menu, you would see the title screen in the background




Did you search?
I've searched mutiple forum sites and google, but all I have come up with are scripts for VX.
Title: Re: Map background for all menus
Post by: Falcon on May 23, 2009, 01:36:59 AM
Ironic that you bothered to read the template but not read the rules. Fix it in 24 hours or I'm deleting this.
Title: Re: [Request] Map background for all menus
Post by: Zylos on May 24, 2009, 05:40:20 AM
I think I know how to do this with a simple script edit. I'll get around to it tomorrow on my regular computer.
Title: Re: [Request] Map background for all menus
Post by: Grafikal on May 24, 2009, 06:24:09 AM
Couldn't you just change the opacity of the menu windows?
Title: Re: [Request] Map background for all menus
Post by: BlueEagle7 on May 24, 2009, 07:04:35 AM
Grafikal: I've tried a few things, transparent windows will still leave you with a black background. I think that when the scene menu is run, it disposes the map. Or something like that.

Zylos: Thanks, I've been searching everywhere.
Title: Re: [Request] Map background for all menus
Post by: Kain Nobel on June 20, 2009, 06:09:10 PM
Ignore the fact that the module is named CMS, it is in fact for my menu system but I mutilated *cough* I mean edited this class into a module for you.

Please note, this is only going to affect scenes which are children of SDK::Scene_Base, which if you have latest SDK and you're using it correctly then all default scenes are children of SDK::Scene_Base

To have the Map show in the background of all menus, go to the bottom of the CMS class *cough* err module I mean, and change Show_Map.default = true

(NOTE: It'll still show black background if the scene isn't associated with SDK::Scene_Base and/or if there was a problem creating Spriteset_Map. If the alternative, no error will pop because I wrapped it in a begin/rescue clause.)

To have all windows transparent enough to show the map, again go to the bottom of the CMS module and set Opacity.default to 160 or whatever looks good.

(NOTE: This will only apply when windows are initialized, so if the opacity 'n stuff are changed later then it won't be what you set in this setting anymore.)

#===============================================================================
# ** CMS
#===============================================================================

module CMS
 #-----------------------------------------------------------------------------
 # * Opacity
 #-----------------------------------------------------------------------------
 Opacity = {}
 #-----------------------------------------------------------------------------
 # * B_Opacity
 #-----------------------------------------------------------------------------
 B_Opacity = {}
 #-----------------------------------------------------------------------------
 # * C_Opacity
 #-----------------------------------------------------------------------------
 C_Opacity = {}
 #-----------------------------------------------------------------------------
 # * Zoom
 #-----------------------------------------------------------------------------
 Zoom = {}
 #-----------------------------------------------------------------------------
 # * Stretch
 #-----------------------------------------------------------------------------
 Stretch = {}
 #-----------------------------------------------------------------------------
 # * Show Map
 #-----------------------------------------------------------------------------
 Show_Map = {'Scene_Battle' => false}
 #-----------------------------------------------------------------------------
 # * Default Settings
 #-----------------------------------------------------------------------------
 Opacity.default         = 255
 B_Opacity.default       = 255
 C_Opacity.default       = 255
 Stretch.default         = true
 Zoom.default            = 100
 Show_Map.default        = true
end

#===============================================================================
# ** Window_Base
#===============================================================================

class Window_Base < Window
 #-----------------------------------------------------------------------------
 # * Alias Listings
 #-----------------------------------------------------------------------------
 alias_method :cms_winbase_initialize, :initialize
 #-----------------------------------------------------------------------------
 # * Object Initialization
 #-----------------------------------------------------------------------------
 def initialize(*args)
   cms_winbase_initialize(*args)
   self.stretch          = apply_CMS_Settings('Stretch')
   self.opacity          = apply_CMS_Settings('Opacity')
   self.back_opacity     = apply_CMS_Settings('B_Opacity')
   self.contents_opacity = apply_CMS_Settings('C_Opacity')
   self.z                = apply_CMS_Settings('Zoom')
 end
 #-----------------------------------------------------------------------------
 # * Apply CMS Settings
 #-----------------------------------------------------------------------------
 def apply_CMS_Settings(const)
   setting = CMS.const_get(const)
   setting[self.class.to_s]
 end
end

#===============================================================================
# ** SDK::Scene_Base
#===============================================================================

class SDK::Scene_Base
 #-----------------------------------------------------------------------------
 # * Alias Listing
 #-----------------------------------------------------------------------------
 alias_method :cms_scnbase_mainspriteset, :main_spriteset
 #-----------------------------------------------------------------------------
 # * Main Spriteset
 #-----------------------------------------------------------------------------
 def main_spriteset
   cms_scnbase_mainspriteset
   begin
     if create_spriteset_map?
       unless spriteset_map_created?
         @spriteset = Spriteset_Map.new
       end
     end
   rescue
   end
 end
 #-----------------------------------------------------------------------------
 # * Create Spriteset Map?
 #-----------------------------------------------------------------------------
 def create_spriteset_map?
   return false if $scene.is_a?(Scene_Battle)
   return false if $scene.is_a?(Scene_Map)
   CMS::Show_Map[$scene.class.to_s]
 end
 #-----------------------------------------------------------------------------
 # * Spriteset_Map Created?
 #-----------------------------------------------------------------------------
 def spriteset_map_created?
   return true if $scene.is_a?(Scene_Map)
   instance_variables.each {|var|
   object = self.instance_variable_get(var)
   return true if object.is_a?(Spriteset_Map)}
   return false
 end
end


Alternatively, if you don't use SDK then somebody will really have to slave their ass off for you to edit all the default scenes for you :P

PS: Since I didn't test the edits of my system, then you can PM me if you have any troubles, but I'm hypothesizing it should work fine. Lastly, if you decide to share this with anybody later, then you need to change the code and unassociate the module as the "CMS" module, name it something else.

Enjoy!
Title: Re: [Request] Map background for all menus
Post by: BlueEagle7 on June 24, 2009, 03:47:06 AM
Thanks nobel,

I might not get time to check it out for a while, but I'll be sure to let you know how it goes.