Introduction This is an edited version of a script made for me a couple years ago (before I knew how to script) by the man... the myth... the legend... OriginalWij.
Features Displays the name of the map you're currently on. The name will become a scrolling marquee if it is longer than the window. While it is intended for use with a minimap script, you could probably make it into a map name pop-up like in Lufia & the Fortress of Doom
Script
Munkis' Location Window Display
CODE
#------------------------------------------------------------------------------ # * Scrolling Location Window Display V 1.1 # * Made by OriginalWij & munkis # ╔══════════╗ # ║ FEATURES ║ # ╚══════════╝ # * This is a modified version of a script OriginalWij kindly made for me back # before I could script worth a snake fart. This little gem is intended for # use with a minimap script, and displays the name of the map you're # currently on, which will become a scrolling marquee if it doesn't fit in # the window. But with a little tweaking, you could probably use it as a map # name pop-up ala Lufia & the Fortress of Doom. # * Tested 100% compatible with all known minimap scripts. # * V 1.0: Initial release # * V 1.1: Text is no longer squashed when the string is longer than the # window, and the scrolling can now be delayed (thanks to Night Runner). #------------------------------------------------------------------------------
module OW_MNK_LOC_DIS WINDOW_PROPERTIES = [414, # X 290, # Y 1000, # Z 146, # Width 56, # Height 0, # Window Opacity Color.new(255,255,255,255), # Font Color 12, # Font Size 16, # Enable Switch 30, # Scroll Speed Delay 99, # Delay Before Scrolling ] end
class Game_Map #-------------------------------------------------------------------------- # Class Variables #-------------------------------------------------------------------------- @@map_name_list = [] #-------------------------------------------------------------------------- # Get Map Name (New) #-------------------------------------------------------------------------- def name if @@map_name_list[@map_id].nil? name = load_data("Data/MapInfos.rvdata")[@map_id].name name.gsub!(/\\N\[([0-9]+)\]/i) {$game_actors[$1.to_i].name} name.gsub!(/\[.*\]/) {""} @@map_name_list[@map_id] = name end return @@map_name_list[@map_id] end end
class Location_Window < Window_Base #-------------------------------------------------------------------------- # Include Modules #-------------------------------------------------------------------------- include OW_MNK_LOC_DIS #-------------------------------------------------------------------------- # Initialize #-------------------------------------------------------------------------- def initialize x, y = WINDOW_PROPERTIES[0..1] width, height = WINDOW_PROPERTIES[3..4] super(x, y, width, height) @text_size = 0 @scroll_amount = 0 @scroll_delay = 0 @current_x = 0 @frames_since_refresh = 0 @reset_scroll = false self.z = WINDOW_PROPERTIES[2] self.opacity = WINDOW_PROPERTIES[5] refresh end #-------------------------------------------------------------------------- # Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear create_contents self.contents.font.color = WINDOW_PROPERTIES[6] self.contents.font.size = WINDOW_PROPERTIES[7] @text_size = self.contents.text_size($game_map.name).width if @text_size > self.contents.width @scroll_amount = @text_size end width = @text_size + 64 self.contents.draw_text(@current_x, 0, width, 24, $game_map.name) end #-------------------------------------------------------------------------- # Update #-------------------------------------------------------------------------- def update super @frames_since_refresh += 1 if @frames_since_refresh > WINDOW_PROPERTIES[10] if @scroll_amount > 0 @scroll_delay -= 1 unless @scroll_delay == 0 if @scroll_delay == 0 @current_x -= @scroll_amount / WINDOW_PROPERTIES[9] self.contents.clear self.contents.font.color = WINDOW_PROPERTIES[6] self.contents.font.size = WINDOW_PROPERTIES[7] text = $game_map.name self.contents.draw_text(@current_x, 0, @text_size + 64, 24, text) @scroll_delay = WINDOW_PROPERTIES[9] / 2 if -@current_x >= @scroll_amount @reset_scroll = true end end if @reset_scroll @current_x = self.contents.width @reset_scroll = false end end end end end
Scrolling area name window(useful if you put all of your interior maps on one giant map)
CODE
#------------------------------------------------------------------------------ # * Scrolling Area Location Window Display V 1.0 # * Made by OriginalWij & munkis # ╔══════════╗ # ║ FEATURES ║ # ╚══════════╝ # * This is a modified version of a script OriginalWij kindly made for me back # before I could script worth a snake fart. This little gem is intended for # use with a minimap script, and displays the name of the map you're # currently on, which will become a scrolling marquee if it doesn't fit in # the window. But with a little tweaking, you could probably use it as a map # name pop-up ala Lufia & the Fortress of Doom. # * Tested 100% compatible with all known minimap scripts. # * V 1.0: Initial release #------------------------------------------------------------------------------
module OW_MNK_ARE_DIS WINDOW_PROPERTIES = [488, # X 345, # Y 1, # Z 146, # Width 56, # Height 0, # Window Opacity Color.new(255,255,255,255), # Font Color 16, # Font Size 7, # Enable Switch 30, # Scroll Speed Delay 60, # Delay Before Scrolling ] end
class Game_Map #-------------------------------------------------------------------------- # Class Variables #-------------------------------------------------------------------------- @@map_name_list = [] @@areas_list = [] #-------------------------------------------------------------------------- # Get Map Name (New) #-------------------------------------------------------------------------- def map_name if @@map_name_list[@map_id].nil? name = load_data("Data/MapInfos.rvdata")[@map_id].name name.gsub!(/\\N\[([0-9]+)\]/i) {$game_actors[$1.to_i].name} name.gsub!(/\[.*\]/) {""} @@map_name_list[@map_id] = name end return @@map_name_list[@map_id] end #-------------------------------------------------------------------------- # * Determine if in Area # area : Area data (RPG::Area) #-------------------------------------------------------------------------- def in_area?(area) return false if not area.is_a?(RPG::Area) return false if $game_map.map_id != area.map_id px, py = $game_player.x, $game_player.y return false if px < area.rect.x return false if py < area.rect.y return false if px >= area.rect.x + area.rect.width return false if py >= area.rect.y + area.rect.height return true end #-------------------------------------------------------------------------- # Get Area Name #-------------------------------------------------------------------------- def area_name # Do nothing if there's no areas return "" if $data_areas.empty? # Initialize the areas list if appropriate @@areas_list = $data_areas.values.clone if @@areas_list.empty? # Initialize a variable for area that is inhabited inhabited_area = nil # Loop through the areas for area in @@areas_list # If the player is in the area, save it and break the loop if in_area?(area) inhabited_area = area break end end # Do nothing if the area doesn't exist return "" if inhabited_area.nil? # Move this area to the start of the @@areas_list (speed performance) @@areas_list.delete(inhabited_area) @@areas_list.insert(0, inhabited_area) # Return this area name return area.name end end
class Window_AreaLocation < Window_Base #-------------------------------------------------------------------------- # Include Modules #-------------------------------------------------------------------------- include OW_MNK_ARE_DIS #-------------------------------------------------------------------------- # Initialize #-------------------------------------------------------------------------- def initialize x, y = WINDOW_PROPERTIES[0..1] width, height = WINDOW_PROPERTIES[3..4] super(x, y, width, height) @text_size = 0 @reset_scroll = false @area_name = "" self.z = WINDOW_PROPERTIES[2] self.opacity = WINDOW_PROPERTIES[5] refresh end #-------------------------------------------------------------------------- # Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear create_contents @current_x = 0 @scroll_amount = 0 @scroll_delay = 0 @frames_since_refresh = 0 @area_name = $game_map.area_name.clone self.contents.font.color = WINDOW_PROPERTIES[6] self.contents.font.size = WINDOW_PROPERTIES[7] @text_size = self.contents.text_size(@area_name).width if @text_size > self.contents.width @scroll_amount = @text_size end text_width = @text_size + 64 self.contents.draw_text(@current_x, 0, text_width, 24, @area_name) end #-------------------------------------------------------------------------- # Update #-------------------------------------------------------------------------- def update super refresh if @area_name != $game_map.area_name @frames_since_refresh += 1 if @frames_since_refresh > WINDOW_PROPERTIES[10] if @scroll_amount > 0 @scroll_delay -= 1 unless @scroll_delay == 0 if @scroll_delay == 0 @current_x -= @scroll_amount / WINDOW_PROPERTIES[9] self.contents.clear self.contents.font.color = WINDOW_PROPERTIES[6] self.contents.font.size = WINDOW_PROPERTIES[7] text = $game_map.area_name self.contents.draw_text(@current_x, 0, @text_size + 64, 24, text) @scroll_delay = WINDOW_PROPERTIES[9] / 2 if -@current_x >= @scroll_amount @reset_scroll = true end end if @reset_scroll @current_x = self.contents.width @reset_scroll = false end end end end end
Customization The array in the config module should be pretty simple to understand.
Compatibility Tested 100% compatible with all known minimap scripts.
Screenshot
This screenshot is from a game I'm working on, so consider this your spoiler warning.
Location window pic
The text here is kinda small, but that can be changed in the script.
DEMO The script is pretty simple to use, so a demo shouldn't be necessary.
Installation Place in MATERIALS, above MAIN.
FAQ Q: ZOMG teh scriptz doesn't werk!!! A: First of all, be more specific. Second, all reports typed in chat-speak or 1337-speak will be ignored.
Terms and Conditions I don't mind this script being posted or linked on other sites AS LONG AS YOU GIVE CREDIT!!! Same goes for using this in your project. Contact me if you want to use this in a commercial project.
Credits Credit me (munkis) and OriginalWij. I don't know if OW cares, but it couldn't hurt.
This post has been edited by munkis: Nov 10 2011, 02:39 PM
Can you be more specific? Because I can't reproduce the error you say you have.
off-topic: And why can't I correct the typo in the script? Every time I go in to edit, I click on 'Submit Modified Post' only to find that it's still lowercase.
No problem; I also just added the Scrolling area name window patch (which could probably be a standalone script if the user were so inclined). I slightly modified it to look for the same switch that the original script uses, and if that switch is off, this script shows the area name. Otherwise they would display text simultaneously.