Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

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

Code:
#===============================================================================

# ** Game_Map

#-------------------------------------------------------------------------------

# Methods List

# ------------

#

# this_event

# event_count

# exists?

# map_infos

# map_count

# map_name

# parent_id

# parent_name

# print_list

#===============================================================================

#-------------------------------------------------------------------------------

# * MACL Loading

#-------------------------------------------------------------------------------

if Object.const_defined?(:MACL)

  MACL::Loaded << 'RGSS.Map'

end

#===============================================================================

# ** Game_Map

#-------------------------------------------------------------------------------

#   Added a library of query methods for retrieving information such as event

# count and obtaining information from MapInfos.rxdata

#===============================================================================

class Game_Map

  #-----------------------------------------------------------------------------

  # * Name      : Events At

  #   Info      : Returns an array of events at location

  #   Author    : Kain Nobel

  #   Call Info : Two Arguments Integer X, Y - Position to Check

  #               D (Optional) Integer - Directional modifier to check

  #-----------------------------------------------------------------------------

  def events_at(x, y, d = 0)

    events = Array.new

    x += (d == 6 ? 1 : d == 4 ? -1 : 0)

    y += (d == 2 ? 1 : d == 8 ? -1 : 0)

    @events.each_value {|e| events << e if (e.x == x && e.y == y)}

    events

  end

  #-----------------------------------------------------------------------------

  # * Name      : Event At

  #   Info      : Returns very first event from events_at method.

  #   Author    : SephirothSpawn / Kain Nobel

  #   Call Info : Two Arguments Integer X, Y - Position to Check

  #               D (Optional) Integer - Directional modifier to check

  #-----------------------------------------------------------------------------

  def event_at(x, y, d = 0)

    events_at(x, y, d)[0]

  end

  #-----------------------------------------------------------------------------

  # * Name      : Characters At

  #   Info      : Returns an array of characters at location

  #   Author    : Kain Nobel

  #   Call Info : Two Arguments Integer X, Y - Position to Check

  #               D (Optional) Integer - Directional modifier to check

  #-----------------------------------------------------------------------------

  def characters_at(x, y, d = 0, attr = nil)

    characters = Array.new

    x += (d == 6 ? 1 : d == 4 ? -1 : 0)

    y += (d == 2 ? 1 : d == 8 ? -1 : 0)

    @characters.each_value {|character|

    if character.x == x && character.y == y

      eval "characters << (attr.nil? ? character : character.#{attr})"

    end}

    characters

  end

  #-----------------------------------------------------------------------------

  # * Name      : Character At

  #   Info      : Returns very first character from characters_at method.

  #   Author    : SephirothSpawn / Kain Nobel

  #   Call Info : Two Arguments Integer X, Y - Position to Check

  #               D (Optional) Integer - Directional modifier to check

  #-----------------------------------------------------------------------------

  def character_at(x, y, d = 0, attr = nil)

    characters_at(x, y, d, attr)[0]

  end

  #-----------------------------------------------------------------------------

  # * Name      : This Event

  #   Info      : Finds the first event directly in front of $game_player

  #   Author    : Kain Nobel

  #   Call Info : None, returns event here or event in front or nil if no event

  #-----------------------------------------------------------------------------

  def this_event

    $game_player.this_event

  end

  #-----------------------------------------------------------------------------

  # * Name      : Event Count

  #   Info      : Simply counts how many events are on the $game_map

  #   Author    : Kain Nobel

  #   Call Info : None, returns number of events on map

  #-----------------------------------------------------------------------------

  def event_count

    (@events.nil? || @events.empty? ? 0 : @events.size)

  end

  #-----------------------------------------------------------------------------

  # * Name      : Exists?

  #   Info      : Tests to see if Map exists

  #   Author    : Kain Nobel

  #   Call Info : Map ID is the Map in question

  #-----------------------------------------------------------------------------

  def exists?(map_id)

    FileTest.exist?(sprintf("Data/Map%03d.rxdata", map_id))

  end

  #-----------------------------------------------------------------------------

  # * Name      : Map Infos

  #   Info      : Returns "Data/MapInfos.rxdata"

  #   Author    : Kain Nobel

  #   Call Info : Miscellaneous

  #-----------------------------------------------------------------------------

  def map_infos

    @map_infos ||= load_data("Data/MapInfos.rxdata")

    @map_infos

  end

  #-----------------------------------------------------------------------------

  # * Name      : Map Count

  #   Info      : Returns number of valid Map filenames

  #   Author    : Kain Nobel

  #   Call Info : None, returns number of maps in project folder

  #-----------------------------------------------------------------------------

  def map_count

    map_infos.keys.size

  end

  #-----------------------------------------------------------------------------

  # * Name      : Map Name

  #   Info      : Sends name of the map in question to a string

  #   Author    : Kain Nobel

  #   Call Info : Map ID (Optional) returns specified Map ID's name

  #-----------------------------------------------------------------------------

  def map_name(map_id = @map_id)

    begin ; return map_infos[map_id].name

    rescue ; return ""

    end

  end

  #-----------------------------------------------------------------------------

  # * Name      : Parent ID

  #   Info      : Returns ID of parent map

  #   Author    : Kain Nobel

  #   Call Info : Map ID (Optional) returns specified Map ID's parent Map ID

  #-----------------------------------------------------------------------------

  def parent_id(map_id = @map_id)

    begin  ; return map_infos[map_id].parent_id

    rescue ; return 0

    end

  end

  #-----------------------------------------------------------------------------

  # * Name      : Parent Name

  #   Info      : Sends name of the parent map in question to a string

  #   Author    : Kain Nobel

  #   Call Info : Map ID (Optional) returns specified Map ID's parent's name

  #-----------------------------------------------------------------------------

  def parent_name

    begin ; return map_name(parent_id)

    rescue ; return ""

    end

  end

  #-----------------------------------------------------------------------------

  # * Name      : Print List

  #   Info      : Prints an Event's Command List in a human readable format

  #   Author    : Kain Nobel

  #   Call Info : Event ID, the event whom's list shall be printed

  #-----------------------------------------------------------------------------

  def print_list(event_id = nil)

    event_id |= this_event.id

    list = String.new

    unless $game_map.events[event_id].nil?

      for c in $game_map.events[event_id].list

        code = c.code.to_s

        code.gsub!("101", "Show Text")

        code.gsub!("102", "Show Choices")

        code.gsub!("401", "" * c.indent)

        code.gsub!("402", "When [**]")

        code.gsub!("403", "When Cancel")

        code.gsub!("103", "Input Number")

        code.gsub!("104", "Change Text Options")

        code.gsub!("105", "Button Input Processing")

        code.gsub!("106", "Wait")

        code.gsub!("108", "Comment")

        code.gsub!("111", "Conditional Branch")

        code.gsub!("411", "Else")

        code.gsub!("412", "Branch End")

        code.gsub!("112", "Loop")

        code.gsub!("413", "Repeat Above")

        code.gsub!("113", "Break Loop")

        code.gsub!("115", "Exit Event Processing")

        code.gsub!("116", "Erase Event")

        code.gsub!("117", "Call Common Event")

        code.gsub!("118", "Label")

        code.gsub!("119", "Jump to Label")

        code.gsub!("121", "Control Switches")

        code.gsub!("122", "Control Variables")

        code.gsub!("123", "Control Self Switch")

        code.gsub!("124", "Control Timer")

        code.gsub!("125", "Change Gold")

        code.gsub!("126", "Change Items")

        code.gsub!("127", "Change Weapons")

        code.gsub!("128", "Change Armor")

        code.gsub!("129", "Change Party Member")

        code.gsub!("131", "Change Windowskin")

        code.gsub!("132", "Change Battle BGM")

        code.gsub!("133", "Change Battle End ME")

        code.gsub!("134", "Change Save Access")

        code.gsub!("135", "Change Menu Access")

        code.gsub!("136", "Change Encounter")

        code.gsub!("201", "Transfer Player")

        code.gsub!("202", "Set Event Location")

        code.gsub!("203", "Scroll Map")

        code.gsub!("204", "Change Map Settings")

        code.gsub!("205", "Change Fog Color Tone")

        code.gsub!("206", "Change Fog Opacity")

        code.gsub!("207", "Show Animation")

        code.gsub!("208", "Change Transparent Flag")

        code.gsub!("209", "Set Move Route")

        code.gsub!("210", "Wait for Move's Completion")

        code.gsub!("221", "Prepare for Transition")

        code.gsub!("222", "Execute Transition")

        code.gsub!("223", "Change Screen Color Tone")

        code.gsub!("224", "Screen Flash")

        code.gsub!("225", "Screen Shake")

        code.gsub!("231", "Show Picture")

        code.gsub!("232", "Move Picture")

        code.gsub!("233", "Rotate Picture")

        code.gsub!("234", "Change Picture Color Tone")

        code.gsub!("235", "Erase Picture")

        code.gsub!("236", "Set Weather Effects")

        code.gsub!("241", "Play BGM")

        code.gsub!("242", "Fade Out BGM")

        code.gsub!("245", "Play BGS")

        code.gsub!("246", "Fade Out BGS")

        code.gsub!("247", "Memorize BGM/BGS")

        code.gsub!("248", "Restore BGM/BGS")

        code.gsub!("249", "Play ME")

        code.gsub!("250", "Play SE")

        code.gsub!("251", "Stop SE")

        code.gsub!("301", "Battle Processing")

        code.gsub!("601", "If Win")

        code.gsub!("602", "If Escape")

        code.gsub!("603", "If Lose")

        code.gsub!("302", "Shop Processing")

        code.gsub!("303", "Name Input Processing")

        code.gsub!("311", "Change HP")

        code.gsub!("312", "Change SP")

        code.gsub!("313", "Change State")

        code.gsub!("314", "Recover All")

        code.gsub!("315", "Change EXP")

        code.gsub!("316", "Change Level")

        code.gsub!("317", "Change Parameters")

        code.gsub!("318", "Change Skills")

        code.gsub!("319", "Change Equipment")

        code.gsub!("320", "Change Actor Name")

        code.gsub!("321", "Change Actor Class")

        code.gsub!("322", "Change Actor Graphic")

        code.gsub!("331", "Change Enemy HP")

        code.gsub!("332", "Change Enemy SP")

        code.gsub!("333", "Change Enemy State")

        code.gsub!("334", "Enemy Recover All")

        code.gsub!("335", "Enemy Appearance")

        code.gsub!("336", "Enemy Transform")

        code.gsub!("337", "Show Battle Animation")

        code.gsub!("338", "Deal Damage")

        code.gsub!("339", "Force Action")

        code.gsub!("340", "Abort Battle")

        code.gsub!("351", "Call Menu Screen")

        code.gsub!("352", "Call Save Screen")

        code.gsub!("353", "Game Over")

        code.gsub!("354", "Return to Title Screen")

        code.gsub!("355", "Script")

        code.gsub!("655", "")

        code.gsub!("0",   "")

        code = ("  " * c.indent) + "@>#{code}:#{c.parameters}\n"

        list += code

      end

    end

    print list

  end

end
Code:
#===============================================================================

# ** Window_Base

#-------------------------------------------------------------------------------

#   Additional methods appended to the origional Window_Base, used to enhance

# the default Window system in some way.

#===============================================================================

class Window_Base < Window

  #-----------------------------------------------------------------------------

  # * Customizable Constant

  #-----------------------------------------------------------------------------

  Default_Speed = 3

  #-----------------------------------------------------------------------------

  # * Public Instance Variables

  #-----------------------------------------------------------------------------

  attr_accessor :exit_x

  attr_accessor :exit_y

  attr_accessor :exit_z

  attr_accessor :exit_width

  attr_accessor :exit_height

  attr_accessor :exit_opacity

  attr_accessor :exit_contents_opacity

  attr_accessor :new_x

  attr_accessor :new_y

  attr_accessor :new_z

  attr_accessor :new_w

  attr_accessor :new_h

  attr_accessor :new_o

  attr_accessor :new_co

  attr_accessor :delay

  #-----------------------------------------------------------------------------

  # * Alias Listing

  #-----------------------------------------------------------------------------

  alias_method :movable_win_base_update,      :update

  #-----------------------------------------------------------------------------

  # * New Width = (n)

  #-----------------------------------------------------------------------------

  def new_width=(n)

    self.new_w = n

  end

  #-----------------------------------------------------------------------------

  # * New Height = (n)

  #-----------------------------------------------------------------------------

  def new_height=(n)

    self.new_h = n

  end

  #-----------------------------------------------------------------------------

  # * New Opacity = (n)

  #-----------------------------------------------------------------------------

  def new_opacity=(n)

    self.new_o = n

  end

  #-----------------------------------------------------------------------------

  # * New Contents Opacity = (n)

  #-----------------------------------------------------------------------------

  def new_contents_opacity=(n)

    self.new_co = n

  end

  #-----------------------------------------------------------------------------

  # * Update Method

  #-----------------------------------------------------------------------------

  def update

    movable_win_base_update

    if @new_x.kind_of?(Numeric) || !@new_x.nil?

      x_to(@new_x)

    end

    if @new_y.kind_of?(Numeric) || !@new_y.nil?

      y_to(@new_y)

    end

    if @new_w.kind_of?(Numeric) || !@new_w.nil?

      width_to(@new_w)

    end

    if @new_h.kind_of?(Numeric) || !@new_h.nil?

      height_to(@new_h)

    end

    if @new_z.kind_of?(Numeric) || !@new_z.nil?

      fade_z(@new_z)

    end

    if @new_o.kind_of?(Numeric) || !@new_o.nil?

      fade_opacity(@new_o)

    end

    if @new_co.kind_of?(Numeric) || !@new_co.nil?

      fade_contents(@new_co)

    end

  end

  #-----------------------------------------------------------------------------

  # * Move To (X, Y, Speed, Opacity)

  #-----------------------------------------------------------------------------

  def move_to(new_x = self.x, new_y = self.y, delay = @delay, opacity = nil)

    x_to(new_x) unless new_x == self.x

    y_to(new_y) unless new_y == self.y

    fade_opacity(opacity, delay) unless opacity.nil?

  end

  #-----------------------------------------------------------------------------

  # * X Move To (Destination, Speed, Opacity)

  #-----------------------------------------------------------------------------

  def x_to(n = self.x, delay = @delay, opacity = nil)

    delay ||= 5

    unless self.x == n

      @new_x = n

      self.x -= ((self.x - n + 9) / delay).abs if self.x > n

      self.x += ((self.x - n + 0) / delay).abs if self.x < n

    else ; @new_x = nil

    end

    fade_opacity(opacity, delay) unless opacity.nil?

  end

  #-----------------------------------------------------------------------------

  # * Y Move To (Destination, Speed, Opacity)

  #-----------------------------------------------------------------------------

  def y_to(n = self.y, delay = @delay, opacity = nil)

    delay ||= 5

    unless self.y == n

      @new_y = n

      self.y -= ((self.y - n + 9) / delay).abs if self.y > n

      self.y += ((self.y - n + 0) / delay).abs if self.y < n

    else ; @new_y = nil

    end

    fade_opacity(opacity, delay) unless opacity.nil?

  end

  #-----------------------------------------------------------------------------

  # * Width To

  #-----------------------------------------------------------------------------

  def width_to(n = self.width, delay = @delay)

    delay ||= 5

    unless self.width == n

      @new_w = n

      self.width -= ((self.width + n) / delay).abs if self.width > n

      self.width += ((self.width + n) / delay).abs if self.width < n

    else ; @new_w = nil

    end

  end

  #-----------------------------------------------------------------------------

  # * Height To

  #-----------------------------------------------------------------------------

  def height_to(n = self.height, delay = @delay)

    delay ||= 5

    unless self.height == n

      @new_h = n

      self.height -= ((self.height - n + 9) / delay).abs if self.height > n

      self.height += ((self.height - n + 0) / delay).abs if self.height < n

      return

    else ; @new_h = nil

    end

  end

  #-----------------------------------------------------------------------------

  # * Fade Opacity (Opacity, Speed)

  #-----------------------------------------------------------------------------

  def fade_opacity(n = nil, delay = @delay)

    unless self.opacity == n || n.nil?

      @new_o = n

      self.opacity -= ((self.opacity - n) / delay).abs if self.opacity > n

      self.opacity += ((self.opacity - n) / delay).abs if self.opacity < n

    else ; @new_o = nil

    end

  end

  #-----------------------------------------------------------------------------

  # * Fade Contents (Opacity, Speed)

  #-----------------------------------------------------------------------------

  def fade_contents(n = nil, delay = @delay)

    unless self.contents_opacity == n || n.nil?

      @new_co = n

      if self.contents_opacity > n

        self.contents_opacity -= ((self.contents_opacity - n) / delay).abs

      elsif self.contents_opacity < n

        self.contents_opacity += ((self.contents_opacity + n) / delay).abs

      else

        @new_co = nil

      end

    end

  end

  #-----------------------------------------------------------------------------

  # * Fade Z

  #-----------------------------------------------------------------------------

  def fade_z(n, delay = @delay)

    unless self.z == n

      @new_z = n

      self.z -= ((self.z - n) / delay).abs if self.z > n

      self.z += ((self.z - n) / delay).abs if self.z < n

    else ; @new_z = nil

    end

  end

  #-----------------------------------------------------------------------------

  # * Set Position

  #-----------------------------------------------------------------------------

  def position(edge = 0, offset = 0)

    if edge.is_a?(Integer)

      if edge == 5 || edge == -5 || edge > 9 || edge < -9

        edge = 0

      end

    else ; return

    end

    o = offset.is_a?(Integer) ? offset : 0

    case edge

    when 0

      self.x, self.y = *get_xy_position(0)

    when 2

      self.x, self.y = *get_xy_position(2)

      unless o.zero? ; self.y -= o ; end

    when 4

      self.x, self.y = *get_xy_position(4)

      unless o.zero? ; self.x += o ; end

    when 6

      self.x, self.y = *get_xy_position(6)

      unless o.zero? ; self.x -= o ; end

    when 8

      self.x, self.y = *get_xy_position(8)

      unless o.zero? ; self.y += o ; end

    when 1

      self.x, self.y = *get_xy_position(1)

      unless o.zero? ; self.x += o ; self.y -= o ; end

    when 3

      self.x, self.y = *get_xy_position(3)

      unless o.zero? ; self.x -= o ; self.y -= o ; end

    when 7

      self.x, self.y = *get_xy_position(7)

      unless o.zero? ; self.x += o ; self.y += o ; end

    when 9

      self.x, self.y = *get_xy_position(9)

      unless o.zero? ; self.x -= o ; self.y += o ; end

    when -2

      self.x, self.y = *get_xy_position(-2)

    when -4

      self.x, self.y = *get_xy_position(-4)

    when -6

      self.x, self.y = *get_xy_position(-6)

    when -8

      self.x, self.y = *get_xy_position(-8)

    when -1

      self.x, self.y = *get_xy_position(-1)

    when -3

      self.x, self.y = *get_xy_position(-3)

    when -7

      self.x, self.y = *get_xy_position(-5)

    when -9

      self.x, self.y = *get_xy_position(-9)

    end

  end

  #-----------------------------------------------------------------------------

  # * Move Pos

  #-----------------------------------------------------------------------------

  def pos_to(edge)

    return unless n.is_a?(Numeric)

    move_to(get_x_position(edge), get_y_position(edge))

  end

  #-----------------------------------------------------------------------------

  # * Get X/Y Position

  #-----------------------------------------------------------------------------

  def get_xy_position(n = 0)

    [get_x_position(n), get_y_position(n)]

  end

  #-----------------------------------------------------------------------------

  # * Get X Position

  #-----------------------------------------------------------------------------

  def get_x_position(n = 0)

    case n

    when 0,2,5,8    ; return (320 - (self.width / 2))

    when 1,4,7      ; return 0

    when 3,6,9      ; return (640 - self.width)

    when 0,-2,-5,-8 ; return (320 - (self.width / 2))

    when -1,-4,-7   ; return -self.width

    when -3,-6,-9   ; return 640 + self.width

    end

  end

  #-----------------------------------------------------------------------------

  # * Get Y Position

  #-----------------------------------------------------------------------------

  def get_y_position(n = 0)

    case n

    when 0,4,5,6    ; return (240 - (self.height / 2))

    when 1,2,3      ; return (480 - self.height)

    when 7,8,9      ; return 0

    when 0,-4,-5,-6 ; return (240 - (self.height / 2))

    when -1,-2,-3   ; return 480

    when -7,-8,-9   ; return -self.height

    end

  end

  #-----------------------------------------------------------------------------

  # * Centered X?

  #-----------------------------------------------------------------------------

  def x_center?

    self.width_center_offset == 0

  end

  #-----------------------------------------------------------------------------

  # * Centered Y?

  #-----------------------------------------------------------------------------

  def y_center?

    self.height_center_offset == 0

  end

  #-----------------------------------------------------------------------------

  # * Closest to Left?

  #-----------------------------------------------------------------------------

  def closest_to_left?

    self.width_center_offset < 0

  end

  #-----------------------------------------------------------------------------

  # * Closest To Right?

  #-----------------------------------------------------------------------------

  def closest_to_right?

    self.width_center_offset > 0

  end

  #-----------------------------------------------------------------------------

  # * Closest To Top?

  #-----------------------------------------------------------------------------

  def closest_to_top?

    self.height_center_offset < 0

  end

  #-----------------------------------------------------------------------------

  # * Closest To Bottom?

  #-----------------------------------------------------------------------------

  def closest_to_bottom?

    self.height_center_offset > 0

  end

  #-----------------------------------------------------------------------------

  # * Width Center Offset

  #-----------------------------------------------------------------------------

  def width_center_offset

    -(320 - self.width)

  end

  #-----------------------------------------------------------------------------

  # * Height Center Offset

  #-----------------------------------------------------------------------------

  def height_center_offset

    -(240 - self.height)

  end

  #-----------------------------------------------------------------------------

  # * Init Movement Variables

  #-----------------------------------------------------------------------------

  def exit_movement_variables

    @exit_movement_variables ||= Array.new

    if @exit_movement_variables.empty?

      @exit_movement_variables << @exit_x

      @exit_movement_variables << @exit_y

      @exit_movement_variables << @exit_z

      @exit_movement_variables << @exit_width

      @exit_movement_variables << @exit_height

      @exit_movement_variables << @exit_opacity

      @exit_movement_variables << @exit_contents_opacity

    end

    @exit_movement_variables

  end

  #-----------------------------------------------------------------------------

  # * New Movement Variables

  #-----------------------------------------------------------------------------

  def new_movement_variables

    @new_movement_variables ||= Array.new

    if @new_movement_variables.empty?

      @new_movement_variables << @new_x

      @new_movement_variables << @new_y

      @new_movement_variables << @new_w

      @new_movement_variables << @new_h

      @new_movement_variables << @new_z

      @new_movement_variables << @new_o

      @new_movement_variables << @new_co

    end

    @new_movement_variables

  end

  #-----------------------------------------------------------------------------

  # * Animation Nil?

  #-----------------------------------------------------------------------------

  def movement_nil?

    new_movement_variables.each {|var| return false unless var.nil?}

    true

  end

end

 

#===============================================================================

# ** SDK::Scene_Base

#===============================================================================

 

 

class SDK::Scene_Base

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :winmovable_sdkscnbase_maindispose,  :main_dispose

  #-----------------------------------------------------------------------------

  # * Each Window

  #-----------------------------------------------------------------------------

  def all_windows

    all_windows = Array.new

    self.instance_variables.each do |obj|

      object = eval obj

      if object.is_a?(Window) && object != all_windows

        all_windows << object

      end

    end

    return all_windows

  end

  #-----------------------------------------------------------------------------

  # * Main Animation In?

  #-----------------------------------------------------------------------------

  def window_movement_wait?

    all_windows.each {|win| return false if win.movement_nil?}

    return true

  end

  #-----------------------------------------------------------------------------

  # * Main Animation Out

  #-----------------------------------------------------------------------------

  def main_dispose

    all_windows.each do |win|

      win.new_x = win.exit_x

      win.new_y = win.exit_y

      win.new_z = win.exit_z

      win.new_w = win.exit_width

      win.new_h = win.exit_height

      win.new_o = win.exit_opacity

      win.new_co= win.exit_contents_opacity

    end

    Graphics.transition(0)

    frames = Window_Base::Default_Speed * 5

    begin

      all_windows.each {|win| win.update}

      Graphics.update

      frames -= 1

    end until frames == 0

    Graphics.freeze

    winmovable_sdkscnbase_maindispose

  end

end
Code:
#===============================================================================

# ** Map : MapNameHUD

#===============================================================================

#-------------------------------------------------------------------------------

# * SDK Log

#-------------------------------------------------------------------------------

if Object.const_defined?(:SDK)

  SDK.log('Map.MapNameHUD', 'Kain Nobel ©', 3.5, '2009.06.17')

end

#===============================================================================

# ** MapName

#===============================================================================

 

module MapNameHUD

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#

# ~**                CUSTOMIZABLE CONSTANTS - BEGIN                        **~ #

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#

  #-----------------------------------------------------------------------------

  # * Font name settings, can be set to depending on map ID or default.

  #-----------------------------------------------------------------------------

  FontNames = Hash.new

  FontNames.default = Font.default_name

  #-----------------------------------------------------------------------------

  # * Font size settings, can be set to depending on map ID or default.

  #-----------------------------------------------------------------------------

  FontSizes = Hash.new

  FontSizes.default = Font.default_size

  #-----------------------------------------------------------------------------

  # * Windowskins

  #-----------------------------------------------------------------------------

  Windowskins = Hash.new

  Windowskins.default = nil

  #-----------------------------------------------------------------------------

  # * Define which maps to display thier name (false disable IncludeParents)

  #-----------------------------------------------------------------------------

  IncludeNames = Hash.new

  IncludeNames.default = true

  #-----------------------------------------------------------------------------

  # * Define which maps to display with the parent maps' name.

  #-----------------------------------------------------------------------------

  IncludeParents = Hash.new

  IncludeParents.default = false

  #-----------------------------------------------------------------------------

  # * Position to show the map name HUD at when it pops up.

  #-----------------------------------------------------------------------------

  Position = Hash.new

  Position.default = 0

  #-----------------------------------------------------------------------------

  # * Settings that apply to if the HUD shows briefly, or permanent and how long

  #     Syntax :

  #       * True    : This means the HUD will be shown for 40 frames (default).

  #       * Numeric : This means the HUD will be shown for X ammount of frames.

  #       * False   : This means the HUD will be permanent on that map.

  #-----------------------------------------------------------------------------

  ShowBrief = Hash.new

  ShowBrief.default = 120

  #-----------------------------------------------------------------------------

  # * Setting for the opacity of the HUD, can be defined for different maps.

  #-----------------------------------------------------------------------------

  Opacity = Hash.new

  Opacity.default = 160

  #-----------------------------------------------------------------------------

  # * Any kind of text (code) you want cut out of map name (ex "[W]" or "_wrap")

  #-----------------------------------------------------------------------------

  Cut_Names = Hash.new

  Cut_Names.default = ["[W]"]

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#

# ~**                 CUSTOMIZABLE CONSTANTS - END                         **~ #

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#

  @@bitmap = Bitmap.new(32, 32)

  #-----------------------------------------------------------------------------

  # * Module Function

  #-----------------------------------------------------------------------------

  module_function

  #-----------------------------------------------------------------------------

  # * MapNameHUD.id

  #-----------------------------------------------------------------------------

  def id

    $game_map.map_id

  end

  #-----------------------------------------------------------------------------

  # * Map_Name.window_skin

  #-----------------------------------------------------------------------------

  def window_skin

    begin

      RPG::Cache.windowskin(Windowskin[id])

    rescue

      RPG::Cache.windowskin($game_system.windowskin_name)

    end

  end

  #-----------------------------------------------------------------------------

  # * MapNameHUD.map_name

  #-----------------------------------------------------------------------------

  def map_name

    name = String.new

    if include_parent?

      name += $game_map.parent_name

    end

    if include_name?

      name += $game_map.map_name

    end

    cut_names.each {|n| name.gsub!(n, '')}

    name

  end

  #-----------------------------------------------------------------------------

  # * MapNameHUD.include_parent?

  #-----------------------------------------------------------------------------

  def include_parent?

    IncludeParents[id] == true

  end

  #-----------------------------------------------------------------------------

  # * MapNameHUD.include_name?

  #-----------------------------------------------------------------------------

  def include_name?

    IncludeNames[id] == true

  end

  #-----------------------------------------------------------------------------

  # * MapNameHUD.cut_names

  #-----------------------------------------------------------------------------

  def cut_names

    (Cut_Names[id].is_a?(Array) ? Cut_Names[id] : Array.new)

  end

  #-----------------------------------------------------------------------------

  # * MapNameHUD.font_name

  #-----------------------------------------------------------------------------

  def font_name

    (FontNames[id].is_a?(String) ? FontNames[id] : Font.default_name)

  end

  #-----------------------------------------------------------------------------

  # * MapNameHUD.font_size

  #-----------------------------------------------------------------------------

  def font_size

    (FontSizes[id].is_a?(String) ? FontSizes[id] : Font.default_size)

  end

  #-----------------------------------------------------------------------------

  # * MapNameHUD.opacity

  #-----------------------------------------------------------------------------

  def opacity

    (Opacity[id].is_a?(Numeric) ? Opacity[id] : 160)

  end

  #-----------------------------------------------------------------------------

  # * MapNameHUD.position

  #-----------------------------------------------------------------------------

  def position

    ([1,2,3,4,6,7,8,9].include?(Position[id]) ? Position[id] : 3)

  end

  #-----------------------------------------------------------------------------

  # * MapNameHUD.brief

  #-----------------------------------------------------------------------------

  def brief

    ShowBrief[id]

  end

  #-----------------------------------------------------------------------------

  # * MapNameHUD.text_width

  #-----------------------------------------------------------------------------

  def text_width

    @@bitmap.font.name = font_name

    @@bitmap.font.size = font_size

    @@bitmap.text_size(map_name).width

  end

  #-----------------------------------------------------------------------------

  # * MapNameHUD.text_height

  #-----------------------------------------------------------------------------

  def text_height

    @@bitmap.font.name = font_name

    @@bitmap.font.size = font_size

    @@bitmap.text_size(map_name).height

  end

  #-----------------------------------------------------------------------------

  # * MapNameHUD.window_width

  #-----------------------------------------------------------------------------

  def window_width

    [(text_width + 32), 64].max

  end

  #-----------------------------------------------------------------------------

  # * MapNameHUD.window_height

  #-----------------------------------------------------------------------------

  def window_height

    [(text_height + 32), 64].min

  end

  #-----------------------------------------------------------------------------

  # * MapNameHUD.position_x_out

  #-----------------------------------------------------------------------------

  def position_x_out

    if map_name.empty?

      return 640

    elsif [1,4,7].include?(position)

      return -window_width

    elsif [3,6,9].include?(position)

      return (640 + window_width)

    elsif [8,2].include?(position)

      return (320 - (window_width * 0.5))

    end

  end

  #-----------------------------------------------------------------------------

  # * MapNameHUD.position_y_out

  #-----------------------------------------------------------------------------

  def position_y_out

    if map_name.empty?

      return 480

    elsif [1,2,3].include?(position)

      return (480 + window_height)

    elsif [7,8,9].include?(position)

      return -window_height

    elsif [4,6].include?(position)

      return (240 - (window_height * 0.5))

    end

  end

  #-----------------------------------------------------------------------------

  # * MapNameHUD.position_x_in

  #-----------------------------------------------------------------------------

  def position_x_in

    if map_name.empty?

      return 640

    elsif [1,4,7].include?(position)

      return 16

    elsif [3,6,9].include?(position)

      return (640 - (window_width + 16))

    elsif [4,6].include?(position)

      return (320 - (window_width * 0.5))

    end

  end

  #-----------------------------------------------------------------------------

  # * MapNameHUD.position_y_in

  #-----------------------------------------------------------------------------

  def position_y_in

    if map_name.empty?

      return 480

    elsif [1,2,3].include?(position)

      return 480 - (window_height + 16)

    elsif [7,8,9].include?(position)

      return 16

    elsif [4,6].include?(position)

      return (240 - (window_height * 0.5))

    end

  end

  #-----------------------------------------------------------------------------

  # * MapNameHUD.window_parameters

  #-----------------------------------------------------------------------------

  def window_parameters

    params = Array.new

    params << position_x_out

    params << position_y_out

    params << window_width

    params << window_height

    params

  end

  #-----------------------------------------------------------------------------

  # * MapNameHUD.text_parameters

  #-----------------------------------------------------------------------------

  def text_parameters

    x = 0

    y = 0

    w = text_width

    h = text_height

    text = map_name

    align = 1

    if [1,4,7].include?(position)

      align = 2

    elsif [3,6,9].include?(position)

      align = 0

    end

    [x, y, w, h, text, align]

  end

end

 

#===============================================================================

# ** Window_MapNameHUD

#===============================================================================

 

class Window_MapNameHUD < Window_Base

  #-----------------------------------------------------------------------------

  # * Included Modules

  #-----------------------------------------------------------------------------

  include MapNameHUD

  #-----------------------------------------------------------------------------

  # * Object Initialization

  #-----------------------------------------------------------------------------

  def initialize

    super(*window_parameters)

    self.contents = Bitmap.new(width - 32, height - 32)

    refresh

  end

  #-----------------------------------------------------------------------------

  # * Update

  #-----------------------------------------------------------------------------

  def update

    super

    if @map_id != $game_map.map_id

      refresh

      return

    end

    if @brief

      update_brief

      return

    end

  end

  #-----------------------------------------------------------------------------

  # * Update Brief

  #-----------------------------------------------------------------------------

  def update_brief

    @reached_xy ||= self.x == position_x_in && self.y == position_y_in

    if @brief.is_a?(Numeric) && @reached_xy

      @brief -= 1

      if @brief < 0

        @brief = false

        self.new_x = position_x_out

        self.new_y = position_y_out

      end

    end

  end

  #-----------------------------------------------------------------------------

  # * Refresh

  #-----------------------------------------------------------------------------

  def refresh

    @map_id = id

    unless self.contents.nil? || self.contents.disposed?

      self.contents.dispose

      self.contents = nil

    end

    self.x = position_x_out

    self.y = position_y_out

    self.new_x = position_x_in

    self.new_y = position_y_in

    self.contents = Bitmap.new(window_width - 32, window_height - 32)

    self.width = window_width

    self.height = window_height

    self.windowskin = window_skin

    self.contents.draw_text(*text_parameters)

    @reached_xy = nil

    @brief = brief

  end

end

 

#===============================================================================

# ** Scene_Map

#===============================================================================

 

class Scene_Map < SDK::Scene_Base

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :mapnameHUD_snmap_mainwindow, :main_window

  #-----------------------------------------------------------------------------

  # * Main Window

  #-----------------------------------------------------------------------------

  def main_window

    @map_name_HUD = Window_MapNameHUD.new

    mapnameHUD_snmap_mainwindow

  end

end

 

###==> THIS IS FOR USERS WHO DON'T USE SDK <==###

 

=begin

 

#===============================================================================

# ** Scene_Map

#===============================================================================

 

class Scene_Map

  #-----------------------------------------------------------------------------

  # * Alias Listings

  #-----------------------------------------------------------------------------

  alias_method :mapnameHUD_snmap_main,    :main

  alias_method :mapnameHUD_snmap_update,  :update

  #-----------------------------------------------------------------------------

  # * Main

  #-----------------------------------------------------------------------------

  def main

    @map_name_HUD = Window_MapNameHUD.new

    mapnameHUD_snmap_main

    @map_name_HUD.dispose

  end

  #-----------------------------------------------------------------------------

  # * Update

  #-----------------------------------------------------------------------------

  def update

    if @map_name_HUD.respond_to?(:update)

      unless @map_name_HUD.disposed?

        @map_name_HUD.update

      end

    end

    mapnameHUD_snmap_update

  end

end

 

=end

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

Scene_Map.main_window
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

Replacing line 335 and below with the code in between =begin and =end resulted in this for me.
SE1.jpg


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.
SE2.jpg


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.
SE3.jpg

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:
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top