Map : Map Name HUD

Map : MapNameHUD
Version: 3.5
By: Kain Nobel

Introduction

As simple and basic as it sounds, this little script is dynamically designed to allow you various options you can set per map ID, or as default! With it, you display the map and/or parent's name, specify which corner it pops up on each map, specify how long it displays for each map, the opacity, font, windowskin, all that jazz per map!

Features

  • Displays map's name (optional by Map ID)
  • Displays parent map's name (optional by Map ID)
  • Displays in any corner (determined by numpad key, optional by Map ID)
  • Displays briefly, permanently or not at all (optional by Map ID)
  • Displays in different opacities (again... optional by Map ID)
  • Displays in different windowskins (again... do I have to say it?)
  • Displays different font names/sizes (...not saying it agian...)
  • Cuts out any 'tags' that you might add to your map's name for whatever reason

Screenshots

Hmm... just a basic window with a map's name on it, ain't much to that, you'd be better off just pasting it in real quick and seeing what it does yourself :P

Script

RGSS.Map (updated) Spoiler
  1. #===============================================================================
  2. # ** Game_Map
  3. #-------------------------------------------------------------------------------
  4. # Methods List
  5. # ------------
  6. #
  7. # this_event
  8. # event_count
  9. # exists?
  10. # map_infos
  11. # map_count
  12. # map_name
  13. # parent_id
  14. # parent_name
  15. # print_list
  16. #===============================================================================
  17. #-------------------------------------------------------------------------------
  18. # * MACL Loading
  19. #-------------------------------------------------------------------------------
  20. if Object.const_defined?(:MACL)
  21.   MACL::Loaded << 'RGSS.Map'
  22. end
  23. #===============================================================================
  24. # ** Game_Map
  25. #-------------------------------------------------------------------------------
  26. #   Added a library of query methods for retrieving information such as event
  27. # count and obtaining information from MapInfos.rxdata
  28. #===============================================================================
  29. class Game_Map
  30.   #-----------------------------------------------------------------------------
  31.   # * Name      : Events At
  32.   #   Info      : Returns an array of events at location
  33.   #   Author    : Kain Nobel
  34.   #   Call Info : Two Arguments Integer X, Y - Position to Check
  35.   #               D (Optional) Integer - Directional modifier to check
  36.   #-----------------------------------------------------------------------------
  37.   def events_at(x, y, d = 0)
  38.     events = Array.new
  39.     x += (d == 6 ? 1 : d == 4 ? -1 : 0)
  40.     y += (d == 2 ? 1 : d == 8 ? -1 : 0)
  41.     @events.each_value {|e| events << e if (e.x == x && e.y == y)}
  42.     events
  43.   end
  44.   #-----------------------------------------------------------------------------
  45.   # * Name      : Event At
  46.   #   Info      : Returns very first event from events_at method.
  47.   #   Author    : SephirothSpawn / Kain Nobel
  48.   #   Call Info : Two Arguments Integer X, Y - Position to Check
  49.   #               D (Optional) Integer - Directional modifier to check
  50.   #-----------------------------------------------------------------------------
  51.   def event_at(x, y, d = 0)
  52.     events_at(x, y, d)[0]
  53.   end
  54.   #-----------------------------------------------------------------------------
  55.   # * Name      : Characters At
  56.   #   Info      : Returns an array of characters at location
  57.   #   Author    : Kain Nobel
  58.   #   Call Info : Two Arguments Integer X, Y - Position to Check
  59.   #               D (Optional) Integer - Directional modifier to check
  60.   #-----------------------------------------------------------------------------
  61.   def characters_at(x, y, d = 0, attr = nil)
  62.     characters = Array.new
  63.     x += (d == 6 ? 1 : d == 4 ? -1 : 0)
  64.     y += (d == 2 ? 1 : d == 8 ? -1 : 0)
  65.     @characters.each_value {|character|
  66.     if character.x == x && character.y == y
  67.       eval "characters << (attr.nil? ? character : character.#{attr})"
  68.     end}
  69.     characters
  70.   end
  71.   #-----------------------------------------------------------------------------
  72.   # * Name      : Character At
  73.   #   Info      : Returns very first character from characters_at method.
  74.   #   Author    : SephirothSpawn / Kain Nobel
  75.   #   Call Info : Two Arguments Integer X, Y - Position to Check
  76.   #               D (Optional) Integer - Directional modifier to check
  77.   #-----------------------------------------------------------------------------
  78.   def character_at(x, y, d = 0, attr = nil)
  79.     characters_at(x, y, d, attr)[0]
  80.   end
  81.   #-----------------------------------------------------------------------------
  82.   # * Name      : This Event
  83.   #   Info      : Finds the first event directly in front of $game_player
  84.   #   Author    : Kain Nobel
  85.   #   Call Info : None, returns event here or event in front or nil if no event
  86.   #-----------------------------------------------------------------------------
  87.   def this_event
  88.     $game_player.this_event
  89.   end
  90.   #-----------------------------------------------------------------------------
  91.   # * Name      : Event Count
  92.   #   Info      : Simply counts how many events are on the $game_map
  93.   #   Author    : Kain Nobel
  94.   #   Call Info : None, returns number of events on map
  95.   #-----------------------------------------------------------------------------
  96.   def event_count
  97.     (@events.nil? || @events.empty? ? 0 : @events.size)
  98.   end
  99.   #-----------------------------------------------------------------------------
  100.   # * Name      : Exists?
  101.   #   Info      : Tests to see if Map exists
  102.   #   Author    : Kain Nobel
  103.   #   Call Info : Map ID is the Map in question
  104.   #-----------------------------------------------------------------------------
  105.   def exists?(map_id)
  106.     FileTest.exist?(sprintf("Data/Map%03d.rxdata", map_id))
  107.   end
  108.   #-----------------------------------------------------------------------------
  109.   # * Name      : Map Infos
  110.   #   Info      : Returns "Data/MapInfos.rxdata"
  111.   #   Author    : Kain Nobel
  112.   #   Call Info : Miscellaneous
  113.   #-----------------------------------------------------------------------------
  114.   def map_infos
  115.     @map_infos ||= load_data("Data/MapInfos.rxdata")
  116.     @map_infos
  117.   end
  118.   #-----------------------------------------------------------------------------
  119.   # * Name      : Map Count
  120.   #   Info      : Returns number of valid Map filenames
  121.   #   Author    : Kain Nobel
  122.   #   Call Info : None, returns number of maps in project folder
  123.   #-----------------------------------------------------------------------------
  124.   def map_count
  125.     map_infos.keys.size
  126.   end
  127.   #-----------------------------------------------------------------------------
  128.   # * Name      : Map Name
  129.   #   Info      : Sends name of the map in question to a string
  130.   #   Author    : Kain Nobel
  131.   #   Call Info : Map ID (Optional) returns specified Map ID's name
  132.   #-----------------------------------------------------------------------------
  133.   def map_name(map_id = @map_id)
  134.     begin ; return map_infos[map_id].name
  135.     rescue ; return ""
  136.     end
  137.   end
  138.   #-----------------------------------------------------------------------------
  139.   # * Name      : Parent ID
  140.   #   Info      : Returns ID of parent map
  141.   #   Author    : Kain Nobel
  142.   #   Call Info : Map ID (Optional) returns specified Map ID's parent Map ID
  143.   #-----------------------------------------------------------------------------
  144.   def parent_id(map_id = @map_id)
  145.     begin  ; return map_infos[map_id].parent_id
  146.     rescue ; return 0
  147.     end
  148.   end
  149.   #-----------------------------------------------------------------------------
  150.   # * Name      : Parent Name
  151.   #   Info      : Sends name of the parent map in question to a string
  152.   #   Author    : Kain Nobel
  153.   #   Call Info : Map ID (Optional) returns specified Map ID's parent's name
  154.   #-----------------------------------------------------------------------------
  155.   def parent_name
  156.     begin ; return map_name(parent_id)
  157.     rescue ; return ""
  158.     end
  159.   end
  160.   #-----------------------------------------------------------------------------
  161.   # * Name      : Print List
  162.   #   Info      : Prints an Event's Command List in a human readable format
  163.   #   Author    : Kain Nobel
  164.   #   Call Info : Event ID, the event whom's list shall be printed
  165.   #-----------------------------------------------------------------------------
  166.   def print_list(event_id = nil)
  167.     event_id |= this_event.id
  168.     list = String.new
  169.     unless $game_map.events[event_id].nil?
  170.       for c in $game_map.events[event_id].list
  171.         code = c.code.to_s
  172.         code.gsub!("101", "Show Text")
  173.         code.gsub!("102", "Show Choices")
  174.         code.gsub!("401", "" * c.indent)
  175.         code.gsub!("402", "When [**]")
  176.         code.gsub!("403", "When Cancel")
  177.         code.gsub!("103", "Input Number")
  178.         code.gsub!("104", "Change Text Options")
  179.         code.gsub!("105", "Button Input Processing")
  180.         code.gsub!("106", "Wait")
  181.         code.gsub!("108", "Comment")
  182.         code.gsub!("111", "Conditional Branch")
  183.         code.gsub!("411", "Else")
  184.         code.gsub!("412", "Branch End")
  185.         code.gsub!("112", "Loop")
  186.         code.gsub!("413", "Repeat Above")
  187.         code.gsub!("113", "Break Loop")
  188.         code.gsub!("115", "Exit Event Processing")
  189.         code.gsub!("116", "Erase Event")
  190.         code.gsub!("117", "Call Common Event")
  191.         code.gsub!("118", "Label")
  192.         code.gsub!("119", "Jump to Label")
  193.         code.gsub!("121", "Control Switches")
  194.         code.gsub!("122", "Control Variables")
  195.         code.gsub!("123", "Control Self Switch")
  196.         code.gsub!("124", "Control Timer")
  197.         code.gsub!("125", "Change Gold")
  198.         code.gsub!("126", "Change Items")
  199.         code.gsub!("127", "Change Weapons")
  200.         code.gsub!("128", "Change Armor")
  201.         code.gsub!("129", "Change Party Member")
  202.         code.gsub!("131", "Change Windowskin")
  203.         code.gsub!("132", "Change Battle BGM")
  204.         code.gsub!("133", "Change Battle End ME")
  205.         code.gsub!("134", "Change Save Access")
  206.         code.gsub!("135", "Change Menu Access")
  207.         code.gsub!("136", "Change Encounter")
  208.         code.gsub!("201", "Transfer Player")
  209.         code.gsub!("202", "Set Event Location")
  210.         code.gsub!("203", "Scroll Map")
  211.         code.gsub!("204", "Change Map Settings")
  212.         code.gsub!("205", "Change Fog Color Tone")
  213.         code.gsub!("206", "Change Fog Opacity")
  214.         code.gsub!("207", "Show Animation")
  215.         code.gsub!("208", "Change Transparent Flag")
  216.         code.gsub!("209", "Set Move Route")
  217.         code.gsub!("210", "Wait for Move's Completion")
  218.         code.gsub!("221", "Prepare for Transition")
  219.         code.gsub!("222", "Execute Transition")
  220.         code.gsub!("223", "Change Screen Color Tone")
  221.         code.gsub!("224", "Screen Flash")
  222.         code.gsub!("225", "Screen Shake")
  223.         code.gsub!("231", "Show Picture")
  224.         code.gsub!("232", "Move Picture")
  225.         code.gsub!("233", "Rotate Picture")
  226.         code.gsub!("234", "Change Picture Color Tone")
  227.         code.gsub!("235", "Erase Picture")
  228.         code.gsub!("236", "Set Weather Effects")
  229.         code.gsub!("241", "Play BGM")
  230.         code.gsub!("242", "Fade Out BGM")
  231.         code.gsub!("245", "Play BGS")
  232.         code.gsub!("246", "Fade Out BGS")
  233.         code.gsub!("247", "Memorize BGM/BGS")
  234.         code.gsub!("248", "Restore BGM/BGS")
  235.         code.gsub!("249", "Play ME")
  236.         code.gsub!("250", "Play SE")
  237.         code.gsub!("251", "Stop SE")
  238.         code.gsub!("301", "Battle Processing")
  239.         code.gsub!("601", "If Win")
  240.         code.gsub!("602", "If Escape")
  241.         code.gsub!("603", "If Lose")
  242.         code.gsub!("302", "Shop Processing")
  243.         code.gsub!("303", "Name Input Processing")
  244.         code.gsub!("311", "Change HP")
  245.         code.gsub!("312", "Change SP")
  246.         code.gsub!("313", "Change State")
  247.         code.gsub!("314", "Recover All")
  248.         code.gsub!("315", "Change EXP")
  249.         code.gsub!("316", "Change Level")
  250.         code.gsub!("317", "Change Parameters")
  251.         code.gsub!("318", "Change Skills")
  252.         code.gsub!("319", "Change Equipment")
  253.         code.gsub!("320", "Change Actor Name")
  254.         code.gsub!("321", "Change Actor Class")
  255.         code.gsub!("322", "Change Actor Graphic")
  256.         code.gsub!("331", "Change Enemy HP")
  257.         code.gsub!("332", "Change Enemy SP")
  258.         code.gsub!("333", "Change Enemy State")
  259.         code.gsub!("334", "Enemy Recover All")
  260.         code.gsub!("335", "Enemy Appearance")
  261.         code.gsub!("336", "Enemy Transform")
  262.         code.gsub!("337", "Show Battle Animation")
  263.         code.gsub!("338", "Deal Damage")
  264.         code.gsub!("339", "Force Action")
  265.         code.gsub!("340", "Abort Battle")
  266.         code.gsub!("351", "Call Menu Screen")
  267.         code.gsub!("352", "Call Save Screen")
  268.         code.gsub!("353", "Game Over")
  269.         code.gsub!("354", "Return to Title Screen")
  270.         code.gsub!("355", "Script")
  271.         code.gsub!("655", "")
  272.         code.gsub!("0",   "")
  273.         code = ("  " * c.indent) + "@>#{code}:#{c.parameters}\n"
  274.         list += code
  275.       end
  276.     end
  277.     print list
  278.   end
  279. end
Expand to see the code.

RGSS.Window.Movable Spoiler
  1. #===============================================================================
  2. # ** Window_Base
  3. #-------------------------------------------------------------------------------
  4. #   Additional methods appended to the origional Window_Base, used to enhance
  5. # the default Window system in some way.
  6. #===============================================================================
  7. class Window_Base < Window
  8.   #-----------------------------------------------------------------------------
  9.   # * Customizable Constant
  10.   #-----------------------------------------------------------------------------
  11.   Default_Speed = 3
  12.   #-----------------------------------------------------------------------------
  13.   # * Public Instance Variables
  14.   #-----------------------------------------------------------------------------
  15.   attr_accessor :exit_x
  16.   attr_accessor :exit_y
  17.   attr_accessor :exit_z
  18.   attr_accessor :exit_width
  19.   attr_accessor :exit_height
  20.   attr_accessor :exit_opacity
  21.   attr_accessor :exit_contents_opacity
  22.   attr_accessor :new_x
  23.   attr_accessor :new_y
  24.   attr_accessor :new_z
  25.   attr_accessor :new_w
  26.   attr_accessor :new_h
  27.   attr_accessor :new_o
  28.   attr_accessor :new_co
  29.   attr_accessor :delay
  30.   #-----------------------------------------------------------------------------
  31.   # * Alias Listing
  32.   #-----------------------------------------------------------------------------
  33.   alias_method :movable_win_base_update,      :update
  34.   #-----------------------------------------------------------------------------
  35.   # * New Width = (n)
  36.   #-----------------------------------------------------------------------------
  37.   def new_width=(n)
  38.     self.new_w = n
  39.   end
  40.   #-----------------------------------------------------------------------------
  41.   # * New Height = (n)
  42.   #-----------------------------------------------------------------------------
  43.   def new_height=(n)
  44.     self.new_h = n
  45.   end
  46.   #-----------------------------------------------------------------------------
  47.   # * New Opacity = (n)
  48.   #-----------------------------------------------------------------------------
  49.   def new_opacity=(n)
  50.     self.new_o = n
  51.   end
  52.   #-----------------------------------------------------------------------------
  53.   # * New Contents Opacity = (n)
  54.   #-----------------------------------------------------------------------------
  55.   def new_contents_opacity=(n)
  56.     self.new_co = n
  57.   end
  58.   #-----------------------------------------------------------------------------
  59.   # * Update Method
  60.   #-----------------------------------------------------------------------------
  61.   def update
  62.     movable_win_base_update
  63.     if @new_x.kind_of?(Numeric) || !@new_x.nil?
  64.       x_to(@new_x)
  65.     end
  66.     if @new_y.kind_of?(Numeric) || !@new_y.nil?
  67.       y_to(@new_y)
  68.     end
  69.     if @new_w.kind_of?(Numeric) || !@new_w.nil?
  70.       width_to(@new_w)
  71.     end
  72.     if @new_h.kind_of?(Numeric) || !@new_h.nil?
  73.       height_to(@new_h)
  74.     end
  75.     if @new_z.kind_of?(Numeric) || !@new_z.nil?
  76.       fade_z(@new_z)
  77.     end
  78.     if @new_o.kind_of?(Numeric) || !@new_o.nil?
  79.       fade_opacity(@new_o)
  80.     end
  81.     if @new_co.kind_of?(Numeric) || !@new_co.nil?
  82.       fade_contents(@new_co)
  83.     end
  84.   end
  85.   #-----------------------------------------------------------------------------
  86.   # * Move To (X, Y, Speed, Opacity)
  87.   #-----------------------------------------------------------------------------
  88.   def move_to(new_x = self.x, new_y = self.y, delay = @delay, opacity = nil)
  89.     x_to(new_x) unless new_x == self.x
  90.     y_to(new_y) unless new_y == self.y
  91.     fade_opacity(opacity, delay) unless opacity.nil?
  92.   end
  93.   #-----------------------------------------------------------------------------
  94.   # * X Move To (Destination, Speed, Opacity)
  95.   #-----------------------------------------------------------------------------
  96.   def x_to(n = self.x, delay = @delay, opacity = nil)
  97.     delay ||= 5
  98.     unless self.x == n
  99.       @new_x = n
  100.       self.x -= ((self.x - n + 9) / delay).abs if self.x > n
  101.       self.x += ((self.x - n + 0) / delay).abs if self.x < n
  102.     else ; @new_x = nil
  103.     end
  104.     fade_opacity(opacity, delay) unless opacity.nil?
  105.   end
  106.   #-----------------------------------------------------------------------------
  107.   # * Y Move To (Destination, Speed, Opacity)
  108.   #-----------------------------------------------------------------------------
  109.   def y_to(n = self.y, delay = @delay, opacity = nil)
  110.     delay ||= 5
  111.     unless self.y == n
  112.       @new_y = n
  113.       self.y -= ((self.y - n + 9) / delay).abs if self.y > n
  114.       self.y += ((self.y - n + 0) / delay).abs if self.y < n
  115.     else ; @new_y = nil
  116.     end
  117.     fade_opacity(opacity, delay) unless opacity.nil?
  118.   end
  119.   #-----------------------------------------------------------------------------
  120.   # * Width To
  121.   #-----------------------------------------------------------------------------
  122.   def width_to(n = self.width, delay = @delay)
  123.     delay ||= 5
  124.     unless self.width == n
  125.       @new_w = n
  126.       self.width -= ((self.width + n) / delay).abs if self.width > n
  127.       self.width += ((self.width + n) / delay).abs if self.width < n
  128.     else ; @new_w = nil
  129.     end
  130.   end
  131.   #-----------------------------------------------------------------------------
  132.   # * Height To
  133.   #-----------------------------------------------------------------------------
  134.   def height_to(n = self.height, delay = @delay)
  135.     delay ||= 5
  136.     unless self.height == n
  137.       @new_h = n
  138.       self.height -= ((self.height - n + 9) / delay).abs if self.height > n
  139.       self.height += ((self.height - n + 0) / delay).abs if self.height < n
  140.       return
  141.     else ; @new_h = nil
  142.     end
  143.   end
  144.   #-----------------------------------------------------------------------------
  145.   # * Fade Opacity (Opacity, Speed)
  146.   #-----------------------------------------------------------------------------
  147.   def fade_opacity(n = nil, delay = @delay)
  148.     unless self.opacity == n || n.nil?
  149.       @new_o = n
  150.       self.opacity -= ((self.opacity - n) / delay).abs if self.opacity > n
  151.       self.opacity += ((self.opacity - n) / delay).abs if self.opacity < n
  152.     else ; @new_o = nil
  153.     end
  154.   end
  155.   #-----------------------------------------------------------------------------
  156.   # * Fade Contents (Opacity, Speed)
  157.   #-----------------------------------------------------------------------------
  158.   def fade_contents(n = nil, delay = @delay)
  159.     unless self.contents_opacity == n || n.nil?
  160.       @new_co = n
  161.       if self.contents_opacity > n
  162.         self.contents_opacity -= ((self.contents_opacity - n) / delay).abs
  163.       elsif self.contents_opacity < n
  164.         self.contents_opacity += ((self.contents_opacity + n) / delay).abs
  165.       else
  166.         @new_co = nil
  167.       end
  168.     end
  169.   end
  170.   #-----------------------------------------------------------------------------
  171.   # * Fade Z
  172.   #-----------------------------------------------------------------------------
  173.   def fade_z(n, delay = @delay)
  174.     unless self.z == n
  175.       @new_z = n
  176.       self.z -= ((self.z - n) / delay).abs if self.z > n
  177.       self.z += ((self.z - n) / delay).abs if self.z < n
  178.     else ; @new_z = nil
  179.     end
  180.   end
  181.   #-----------------------------------------------------------------------------
  182.   # * Set Position
  183.   #-----------------------------------------------------------------------------
  184.   def position(edge = 0, offset = 0)
  185.     if edge.is_a?(Integer)
  186.       if edge == 5 || edge == -5 || edge > 9 || edge < -9
  187.         edge = 0
  188.       end
  189.     else ; return
  190.     end
  191.     o = offset.is_a?(Integer) ? offset : 0
  192.     case edge
  193.     when 0
  194.       self.x, self.y = *get_xy_position(0)
  195.     when 2
  196.       self.x, self.y = *get_xy_position(2)
  197.       unless o.zero? ; self.y -= o ; end
  198.     when 4
  199.       self.x, self.y = *get_xy_position(4)
  200.       unless o.zero? ; self.x += o ; end
  201.     when 6
  202.       self.x, self.y = *get_xy_position(6)
  203.       unless o.zero? ; self.x -= o ; end
  204.     when 8
  205.       self.x, self.y = *get_xy_position(8)
  206.       unless o.zero? ; self.y += o ; end
  207.     when 1
  208.       self.x, self.y = *get_xy_position(1)
  209.       unless o.zero? ; self.x += o ; self.y -= o ; end
  210.     when 3
  211.       self.x, self.y = *get_xy_position(3)
  212.       unless o.zero? ; self.x -= o ; self.y -= o ; end
  213.     when 7
  214.       self.x, self.y = *get_xy_position(7)
  215.       unless o.zero? ; self.x += o ; self.y += o ; end
  216.     when 9
  217.       self.x, self.y = *get_xy_position(9)
  218.       unless o.zero? ; self.x -= o ; self.y += o ; end
  219.     when -2
  220.       self.x, self.y = *get_xy_position(-2)
  221.     when -4
  222.       self.x, self.y = *get_xy_position(-4)
  223.     when -6
  224.       self.x, self.y = *get_xy_position(-6)
  225.     when -8
  226.       self.x, self.y = *get_xy_position(-8)
  227.     when -1
  228.       self.x, self.y = *get_xy_position(-1)
  229.     when -3
  230.       self.x, self.y = *get_xy_position(-3)
  231.     when -7
  232.       self.x, self.y = *get_xy_position(-5)
  233.     when -9
  234.       self.x, self.y = *get_xy_position(-9)
  235.     end
  236.   end
  237.   #-----------------------------------------------------------------------------
  238.   # * Move Pos
  239.   #-----------------------------------------------------------------------------
  240.   def pos_to(edge)
  241.     return unless n.is_a?(Numeric)
  242.     move_to(get_x_position(edge), get_y_position(edge))
  243.   end
  244.   #-----------------------------------------------------------------------------
  245.   # * Get X/Y Position
  246.   #-----------------------------------------------------------------------------
  247.   def get_xy_position(n = 0)
  248.     [get_x_position(n), get_y_position(n)]
  249.   end
  250.   #-----------------------------------------------------------------------------
  251.   # * Get X Position
  252.   #-----------------------------------------------------------------------------
  253.   def get_x_position(n = 0)
  254.     case n
  255.     when 0,2,5,8    ; return (320 - (self.width / 2))
  256.     when 1,4,7      ; return 0
  257.     when 3,6,9      ; return (640 - self.width)
  258.     when 0,-2,-5,-8 ; return (320 - (self.width / 2))
  259.     when -1,-4,-7   ; return -self.width
  260.     when -3,-6,-9   ; return 640 + self.width
  261.     end
  262.   end
  263.   #-----------------------------------------------------------------------------
  264.   # * Get Y Position
  265.   #-----------------------------------------------------------------------------
  266.   def get_y_position(n = 0)
  267.     case n
  268.     when 0,4,5,6    ; return (240 - (self.height / 2))
  269.     when 1,2,3      ; return (480 - self.height)
  270.     when 7,8,9      ; return 0
  271.     when 0,-4,-5,-6 ; return (240 - (self.height / 2))
  272.     when -1,-2,-3   ; return 480
  273.     when -7,-8,-9   ; return -self.height
  274.     end
  275.   end
  276.   #-----------------------------------------------------------------------------
  277.   # * Centered X?
  278.   #-----------------------------------------------------------------------------
  279.   def x_center?
  280.     self.width_center_offset == 0
  281.   end
  282.   #-----------------------------------------------------------------------------
  283.   # * Centered Y?
  284.   #-----------------------------------------------------------------------------
  285.   def y_center?
  286.     self.height_center_offset == 0
  287.   end
  288.   #-----------------------------------------------------------------------------
  289.   # * Closest to Left?
  290.   #-----------------------------------------------------------------------------
  291.   def closest_to_left?
  292.     self.width_center_offset < 0
  293.   end
  294.   #-----------------------------------------------------------------------------
  295.   # * Closest To Right?
  296.   #-----------------------------------------------------------------------------
  297.   def closest_to_right?
  298.     self.width_center_offset > 0
  299.   end
  300.   #-----------------------------------------------------------------------------
  301.   # * Closest To Top?
  302.   #-----------------------------------------------------------------------------
  303.   def closest_to_top?
  304.     self.height_center_offset < 0
  305.   end
  306.   #-----------------------------------------------------------------------------
  307.   # * Closest To Bottom?
  308.   #-----------------------------------------------------------------------------
  309.   def closest_to_bottom?
  310.     self.height_center_offset > 0
  311.   end
  312.   #-----------------------------------------------------------------------------
  313.   # * Width Center Offset
  314.   #-----------------------------------------------------------------------------
  315.   def width_center_offset
  316.     -(320 - self.width)
  317.   end
  318.   #-----------------------------------------------------------------------------
  319.   # * Height Center Offset
  320.   #-----------------------------------------------------------------------------
  321.   def height_center_offset
  322.     -(240 - self.height)
  323.   end
  324.   #-----------------------------------------------------------------------------
  325.   # * Init Movement Variables
  326.   #-----------------------------------------------------------------------------
  327.   def exit_movement_variables
  328.     @exit_movement_variables ||= Array.new
  329.     if @exit_movement_variables.empty?
  330.       @exit_movement_variables << @exit_x
  331.       @exit_movement_variables << @exit_y
  332.       @exit_movement_variables << @exit_z
  333.       @exit_movement_variables << @exit_width
  334.       @exit_movement_variables << @exit_height
  335.       @exit_movement_variables << @exit_opacity
  336.       @exit_movement_variables << @exit_contents_opacity
  337.     end
  338.     @exit_movement_variables
  339.   end
  340.   #-----------------------------------------------------------------------------
  341.   # * New Movement Variables
  342.   #-----------------------------------------------------------------------------
  343.   def new_movement_variables
  344.     @new_movement_variables ||= Array.new
  345.     if @new_movement_variables.empty?
  346.       @new_movement_variables << @new_x
  347.       @new_movement_variables << @new_y
  348.       @new_movement_variables << @new_w
  349.       @new_movement_variables << @new_h
  350.       @new_movement_variables << @new_z
  351.       @new_movement_variables << @new_o
  352.       @new_movement_variables << @new_co
  353.     end
  354.     @new_movement_variables
  355.   end
  356.   #-----------------------------------------------------------------------------
  357.   # * Animation Nil?
  358.   #-----------------------------------------------------------------------------
  359.   def movement_nil?
  360.     new_movement_variables.each {|var| return false unless var.nil?}
  361.     true
  362.   end
  363. end
  364.  
  365. #===============================================================================
  366. # ** SDK::Scene_Base
  367. #===============================================================================
  368.  
  369.  
  370. class SDK::Scene_Base
  371.   #-----------------------------------------------------------------------------
  372.   # * Alias Listings
  373.   #-----------------------------------------------------------------------------
  374.   alias_method :winmovable_sdkscnbase_maindispose,  :main_dispose
  375.   #-----------------------------------------------------------------------------
  376.   # * Each Window
  377.   #-----------------------------------------------------------------------------
  378.   def all_windows
  379.     all_windows = Array.new
  380.     self.instance_variables.each do |obj|
  381.       object = eval obj
  382.       if object.is_a?(Window) && object != all_windows
  383.         all_windows << object
  384.       end
  385.     end
  386.     return all_windows
  387.   end
  388.   #-----------------------------------------------------------------------------
  389.   # * Main Animation In?
  390.   #-----------------------------------------------------------------------------
  391.   def window_movement_wait?
  392.     all_windows.each {|win| return false if win.movement_nil?}
  393.     return true
  394.   end
  395.   #-----------------------------------------------------------------------------
  396.   # * Main Animation Out
  397.   #-----------------------------------------------------------------------------
  398.   def main_dispose
  399.     all_windows.each do |win|
  400.       win.new_x = win.exit_x
  401.       win.new_y = win.exit_y
  402.       win.new_z = win.exit_z
  403.       win.new_w = win.exit_width
  404.       win.new_h = win.exit_height
  405.       win.new_o = win.exit_opacity
  406.       win.new_co= win.exit_contents_opacity
  407.     end
  408.     Graphics.transition(0)
  409.     frames = Window_Base::Default_Speed * 5
  410.     begin
  411.       all_windows.each {|win| win.update}
  412.       Graphics.update
  413.       frames -= 1
  414.     end until frames == 0
  415.     Graphics.freeze
  416.     winmovable_sdkscnbase_maindispose
  417.   end
  418. end
Expand to see the code.

Map Name HUD Spoiler
  1. #===============================================================================
  2. # ** Map : MapNameHUD
  3. #===============================================================================
  4. #-------------------------------------------------------------------------------
  5. # * SDK Log
  6. #-------------------------------------------------------------------------------
  7. if Object.const_defined?(:SDK)
  8.   SDK.log('Map.MapNameHUD', 'Kain Nobel ©', 3.5, '2009.06.17')
  9. end
  10. #===============================================================================
  11. # ** MapName
  12. #===============================================================================
  13.  
  14. module MapNameHUD
  15. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
  16. # ~**                CUSTOMIZABLE CONSTANTS - BEGIN                        **~ #
  17. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
  18.   #-----------------------------------------------------------------------------
  19.   # * Font name settings, can be set to depending on map ID or default.
  20.   #-----------------------------------------------------------------------------
  21.   FontNames = Hash.new
  22.   FontNames.default = Font.default_name
  23.   #-----------------------------------------------------------------------------
  24.   # * Font size settings, can be set to depending on map ID or default.
  25.   #-----------------------------------------------------------------------------
  26.   FontSizes = Hash.new
  27.   FontSizes.default = Font.default_size
  28.   #-----------------------------------------------------------------------------
  29.   # * Windowskins
  30.   #-----------------------------------------------------------------------------
  31.   Windowskins = Hash.new
  32.   Windowskins.default = nil
  33.   #-----------------------------------------------------------------------------
  34.   # * Define which maps to display thier name (false disable IncludeParents)
  35.   #-----------------------------------------------------------------------------
  36.   IncludeNames = Hash.new
  37.   IncludeNames.default = true
  38.   #-----------------------------------------------------------------------------
  39.   # * Define which maps to display with the parent maps' name.
  40.   #-----------------------------------------------------------------------------
  41.   IncludeParents = Hash.new
  42.   IncludeParents.default = false
  43.   #-----------------------------------------------------------------------------
  44.   # * Position to show the map name HUD at when it pops up.
  45.   #-----------------------------------------------------------------------------
  46.   Position = Hash.new
  47.   Position.default = 0
  48.   #-----------------------------------------------------------------------------
  49.   # * Settings that apply to if the HUD shows briefly, or permanent and how long
  50.   #     Syntax :
  51.   #       * True    : This means the HUD will be shown for 40 frames (default).
  52.   #       * Numeric : This means the HUD will be shown for X ammount of frames.
  53.   #       * False   : This means the HUD will be permanent on that map.
  54.   #-----------------------------------------------------------------------------
  55.   ShowBrief = Hash.new
  56.   ShowBrief.default = 120
  57.   #-----------------------------------------------------------------------------
  58.   # * Setting for the opacity of the HUD, can be defined for different maps.
  59.   #-----------------------------------------------------------------------------
  60.   Opacity = Hash.new
  61.   Opacity.default = 160
  62.   #-----------------------------------------------------------------------------
  63.   # * Any kind of text (code) you want cut out of map name (ex "[W]" or "_wrap")
  64.   #-----------------------------------------------------------------------------
  65.   Cut_Names = Hash.new
  66.   Cut_Names.default = ["[W]"]
  67. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
  68. # ~**                 CUSTOMIZABLE CONSTANTS - END                         **~ #
  69. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
  70.   @@bitmap = Bitmap.new(32, 32)
  71.   #-----------------------------------------------------------------------------
  72.   # * Module Function
  73.   #-----------------------------------------------------------------------------
  74.   module_function
  75.   #-----------------------------------------------------------------------------
  76.   # * MapNameHUD.id
  77.   #-----------------------------------------------------------------------------
  78.   def id
  79.     $game_map.map_id
  80.   end
  81.   #-----------------------------------------------------------------------------
  82.   # * Map_Name.window_skin
  83.   #-----------------------------------------------------------------------------
  84.   def window_skin
  85.     begin
  86.       RPG::Cache.windowskin(Windowskin[id])
  87.     rescue
  88.       RPG::Cache.windowskin($game_system.windowskin_name)
  89.     end
  90.   end
  91.   #-----------------------------------------------------------------------------
  92.   # * MapNameHUD.map_name
  93.   #-----------------------------------------------------------------------------
  94.   def map_name
  95.     name = String.new
  96.     if include_parent?
  97.       name += $game_map.parent_name
  98.     end
  99.     if include_name?
  100.       name += $game_map.map_name
  101.     end
  102.     cut_names.each {|n| name.gsub!(n, '')}
  103.     name
  104.   end
  105.   #-----------------------------------------------------------------------------
  106.   # * MapNameHUD.include_parent?
  107.   #-----------------------------------------------------------------------------
  108.   def include_parent?
  109.     IncludeParents[id] == true
  110.   end
  111.   #-----------------------------------------------------------------------------
  112.   # * MapNameHUD.include_name?
  113.   #-----------------------------------------------------------------------------
  114.   def include_name?
  115.     IncludeNames[id] == true
  116.   end
  117.   #-----------------------------------------------------------------------------
  118.   # * MapNameHUD.cut_names
  119.   #-----------------------------------------------------------------------------
  120.   def cut_names
  121.     (Cut_Names[id].is_a?(Array) ? Cut_Names[id] : Array.new)
  122.   end
  123.   #-----------------------------------------------------------------------------
  124.   # * MapNameHUD.font_name
  125.   #-----------------------------------------------------------------------------
  126.   def font_name
  127.     (FontNames[id].is_a?(String) ? FontNames[id] : Font.default_name)
  128.   end
  129.   #-----------------------------------------------------------------------------
  130.   # * MapNameHUD.font_size
  131.   #-----------------------------------------------------------------------------
  132.   def font_size
  133.     (FontSizes[id].is_a?(String) ? FontSizes[id] : Font.default_size)
  134.   end
  135.   #-----------------------------------------------------------------------------
  136.   # * MapNameHUD.opacity
  137.   #-----------------------------------------------------------------------------
  138.   def opacity
  139.     (Opacity[id].is_a?(Numeric) ? Opacity[id] : 160)
  140.   end
  141.   #-----------------------------------------------------------------------------
  142.   # * MapNameHUD.position
  143.   #-----------------------------------------------------------------------------
  144.   def position
  145.     ([1,2,3,4,6,7,8,9].include?(Position[id]) ? Position[id] : 3)
  146.   end
  147.   #-----------------------------------------------------------------------------
  148.   # * MapNameHUD.brief
  149.   #-----------------------------------------------------------------------------
  150.   def brief
  151.     ShowBrief[id]
  152.   end
  153.   #-----------------------------------------------------------------------------
  154.   # * MapNameHUD.text_width
  155.   #-----------------------------------------------------------------------------
  156.   def text_width
  157.     @@bitmap.font.name = font_name
  158.     @@bitmap.font.size = font_size
  159.     @@bitmap.text_size(map_name).width
  160.   end
  161.   #-----------------------------------------------------------------------------
  162.   # * MapNameHUD.text_height
  163.   #-----------------------------------------------------------------------------
  164.   def text_height
  165.     @@bitmap.font.name = font_name
  166.     @@bitmap.font.size = font_size
  167.     @@bitmap.text_size(map_name).height
  168.   end
  169.   #-----------------------------------------------------------------------------
  170.   # * MapNameHUD.window_width
  171.   #-----------------------------------------------------------------------------
  172.   def window_width
  173.     [(text_width + 32), 64].max
  174.   end
  175.   #-----------------------------------------------------------------------------
  176.   # * MapNameHUD.window_height
  177.   #-----------------------------------------------------------------------------
  178.   def window_height
  179.     [(text_height + 32), 64].min
  180.   end
  181.   #-----------------------------------------------------------------------------
  182.   # * MapNameHUD.position_x_out
  183.   #-----------------------------------------------------------------------------
  184.   def position_x_out
  185.     if map_name.empty?
  186.       return 640
  187.     elsif [1,4,7].include?(position)
  188.       return -window_width
  189.     elsif [3,6,9].include?(position)
  190.       return (640 + window_width)
  191.     elsif [8,2].include?(position)
  192.       return (320 - (window_width * 0.5))
  193.     end
  194.   end
  195.   #-----------------------------------------------------------------------------
  196.   # * MapNameHUD.position_y_out
  197.   #-----------------------------------------------------------------------------
  198.   def position_y_out
  199.     if map_name.empty?
  200.       return 480
  201.     elsif [1,2,3].include?(position)
  202.       return (480 + window_height)
  203.     elsif [7,8,9].include?(position)
  204.       return -window_height
  205.     elsif [4,6].include?(position)
  206.       return (240 - (window_height * 0.5))
  207.     end
  208.   end
  209.   #-----------------------------------------------------------------------------
  210.   # * MapNameHUD.position_x_in
  211.   #-----------------------------------------------------------------------------
  212.   def position_x_in
  213.     if map_name.empty?
  214.       return 640
  215.     elsif [1,4,7].include?(position)
  216.       return 16
  217.     elsif [3,6,9].include?(position)
  218.       return (640 - (window_width + 16))
  219.     elsif [4,6].include?(position)
  220.       return (320 - (window_width * 0.5))
  221.     end
  222.   end
  223.   #-----------------------------------------------------------------------------
  224.   # * MapNameHUD.position_y_in
  225.   #-----------------------------------------------------------------------------
  226.   def position_y_in
  227.     if map_name.empty?
  228.       return 480
  229.     elsif [1,2,3].include?(position)
  230.       return 480 - (window_height + 16)
  231.     elsif [7,8,9].include?(position)
  232.       return 16
  233.     elsif [4,6].include?(position)
  234.       return (240 - (window_height * 0.5))
  235.     end
  236.   end
  237.   #-----------------------------------------------------------------------------
  238.   # * MapNameHUD.window_parameters
  239.   #-----------------------------------------------------------------------------
  240.   def window_parameters
  241.     params = Array.new
  242.     params << position_x_out
  243.     params << position_y_out
  244.     params << window_width
  245.     params << window_height
  246.     params
  247.   end
  248.   #-----------------------------------------------------------------------------
  249.   # * MapNameHUD.text_parameters
  250.   #-----------------------------------------------------------------------------
  251.   def text_parameters
  252.     x = 0
  253.     y = 0
  254.     w = text_width
  255.     h = text_height
  256.     text = map_name
  257.     align = 1
  258.     if [1,4,7].include?(position)
  259.       align = 2
  260.     elsif [3,6,9].include?(position)
  261.       align = 0
  262.     end
  263.     [x, y, w, h, text, align]
  264.   end
  265. end
  266.  
  267. #===============================================================================
  268. # ** Window_MapNameHUD
  269. #===============================================================================
  270.  
  271. class Window_MapNameHUD < Window_Base
  272.   #-----------------------------------------------------------------------------
  273.   # * Included Modules
  274.   #-----------------------------------------------------------------------------
  275.   include MapNameHUD
  276.   #-----------------------------------------------------------------------------
  277.   # * Object Initialization
  278.   #-----------------------------------------------------------------------------
  279.   def initialize
  280.     super(*window_parameters)
  281.     self.contents = Bitmap.new(width - 32, height - 32)
  282.     refresh
  283.   end
  284.   #-----------------------------------------------------------------------------
  285.   # * Update
  286.   #-----------------------------------------------------------------------------
  287.   def update
  288.     super
  289.     if @map_id != $game_map.map_id
  290.       refresh
  291.       return
  292.     end
  293.     if @brief
  294.       update_brief
  295.       return
  296.     end
  297.   end
  298.   #-----------------------------------------------------------------------------
  299.   # * Update Brief
  300.   #-----------------------------------------------------------------------------
  301.   def update_brief
  302.     @reached_xy ||= self.x == position_x_in && self.y == position_y_in
  303.     if @brief.is_a?(Numeric) && @reached_xy
  304.       @brief -= 1
  305.       if @brief < 0
  306.         @brief = false
  307.         self.new_x = position_x_out
  308.         self.new_y = position_y_out
  309.       end
  310.     end
  311.   end
  312.   #-----------------------------------------------------------------------------
  313.   # * Refresh
  314.   #-----------------------------------------------------------------------------
  315.   def refresh
  316.     @map_id = id
  317.     unless self.contents.nil? || self.contents.disposed?
  318.       self.contents.dispose
  319.       self.contents = nil
  320.     end
  321.     self.x = position_x_out
  322.     self.y = position_y_out
  323.     self.new_x = position_x_in
  324.     self.new_y = position_y_in
  325.     self.contents = Bitmap.new(window_width - 32, window_height - 32)
  326.     self.width = window_width
  327.     self.height = window_height
  328.     self.windowskin = window_skin
  329.     self.contents.draw_text(*text_parameters)
  330.     @reached_xy = nil
  331.     @brief = brief
  332.   end
  333. end
  334.  
  335. #===============================================================================
  336. # ** Scene_Map
  337. #===============================================================================
  338.  
  339. class Scene_Map < SDK::Scene_Base
  340.   #-----------------------------------------------------------------------------
  341.   # * Alias Listings
  342.   #-----------------------------------------------------------------------------
  343.   alias_method :mapnameHUD_snmap_mainwindow, :main_window
  344.   #-----------------------------------------------------------------------------
  345.   # * Main Window
  346.   #-----------------------------------------------------------------------------
  347.   def main_window
  348.     @map_name_HUD = Window_MapNameHUD.new
  349.     mapnameHUD_snmap_mainwindow
  350.   end
  351. end
  352.  
  353. ###==> THIS IS FOR USERS WHO DON'T USE SDK <==###
  354.  
  355. =begin
  356.  
  357. #===============================================================================
  358. # ** Scene_Map
  359. #===============================================================================
  360.  
  361. class Scene_Map
  362.   #-----------------------------------------------------------------------------
  363.   # * Alias Listings
  364.   #-----------------------------------------------------------------------------
  365.   alias_method :mapnameHUD_snmap_main,    :main
  366.   alias_method :mapnameHUD_snmap_update,  :update
  367.   #-----------------------------------------------------------------------------
  368.   # * Main
  369.   #-----------------------------------------------------------------------------
  370.   def main
  371.     @map_name_HUD = Window_MapNameHUD.new
  372.     mapnameHUD_snmap_main
  373.     @map_name_HUD.dispose
  374.   end
  375.   #-----------------------------------------------------------------------------
  376.   # * Update
  377.   #-----------------------------------------------------------------------------
  378.   def update
  379.     if @map_name_HUD.respond_to?(:update)
  380.       unless @map_name_HUD.disposed?
  381.         @map_name_HUD.update
  382.       end
  383.     end
  384.     mapnameHUD_snmap_update
  385.   end
  386. end
  387.  
  388. =end
Expand to see the code.


Instructions

Place Below SDK (if using) and Above Main! If you're not using SDK, you can replace the SDK Scene_Map code with the code below it (line 355 and on, between the =begin and =end). Sorry I didn't post VX version but that sounds easy enough I'll do it later.

Obviously requires the RGSS.Map code I've added, not in official MACL yet (because a certain someone who is in charge of updating that stuff is always gone... XD) This simply has the common methods for referring to $game_map.map_infos, $game_map.map_name, $game_map.parent_name, etc...

Compatibility

This script aliases the following methods... (SDK) Spoiler
Scene_Map.main_window

This script aliases the following methods... (Non-SDK) Spoiler
Scene_Map.main
Scene_Map.update


Credit & Thanks

clipnotdone : For reporting a couple silly bugs I overlooked, thank you!

Author's Notes

Even a simple HUD can be dynamic! Why not give people more control? :P

Terms and Conditions

Another "Free to use in commercial and non-commercial games" script, credit is required thanks :D
Line 335 and below seems to have a few bugs in it.
I tried both with and without the SDK

Content Hidden Spoiler
Replacing line 335 and below with the code in between =begin and =end resulted in this for me.
Image

After removing the line that mentions the SDK, pretty much the entire section is regarded as a syntax error.
and any attempt to test the game result in crashing; unless pretty much the entire section is removed.
Image

I then tried starting a new project with nothing but this script and the SDK, and I got this as soon as a map loaded up.
Image


Content Hidden Spoiler
Please dont kill me for necroposting D:
As long as I'm still around, its not a necropost =P

The first error occured because I always forget to delete the < SDK::Scene_Base in the Non-SDK version of Scene_Map, that was a mistake on my part. It would've probably worked if you deleted that line.

Second error occured probably because you had an extra 'end' or were missing an 'end' in the script probably when you edited it. At least thats what it appears to be, I could be wrong.

The last one, NoMethodError for new_x= occured because I forgot to post the Window movable class which I use for this script (its the same class I used with my CMS in the contest, I made it before I knew that MACL had its own Movable module.)

Anyways, I've updated the top post. Place the first two scripts below SDK (if using) and MACL (if using) but above everything else. The Map HUD script, place it anywhere below that and above main and it should work fine now. Again if you don't use SDK its not required, just replace the first Scene_Map code with the one below it and you should be good to go!

I've updated the top post, replace what you have with the 3 classes and it should work now. Also, thanks a bunch for reporting these bugs otherwise I would've never known of them :thumb:
Great!

I like this script alot

Thank you very much

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=65664