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.

MOG Location Name Properties [RMVX]

Here's the script for MOG's Location Displayer. It displays the map name as the character enters the map.
Code:
#_______________________________________________________________________________
# MOG_Location_Name_VX V1.0            
#_______________________________________________________________________________
# By Moghunter       
# http://www.atelier-rgss.com
#_______________________________________________________________________________
# Apresenta uma janela com o nome do map.
# É necessário ter uma imagem com o nome de  MAPNAME
# dentro da pasta Graphics/System.
#_______________________________________________________________________________
module MOG
#Font Name.
MPFONT = "Georgia"
#Fade ON/OFF(True - False).
MPNMFD = true
#Fade Time.
MPNMTM = 10
#Window Position.
# 0 = Upper Left.
# 1 = Lower Left.
# 2 = Upper Right.
# 3 = Lower Right.
MPNMPS = 2
# Disable Switch(ID).
WM_SWITCH_VIS_DISABLE = 15
end
#_________________________________________________
###############
# Game_System #
###############
class Game_System
attr_accessor :fdtm
attr_accessor :mpnm_x
attr_accessor :mpnm_y
alias mog_vx06_initialize initialize
def initialize
mog_vx06_initialize
@fdtm = 255 + 40 * MOG::MPNMTM
if MOG::MPNMPS == 0 
@mpnm_x = -300
@mpnm_y = 0
elsif MOG::MPNMPS == 1
@mpnm_x = -300
@mpnm_y = 320
elsif MOG::MPNMPS == 2
@mpnm_x = 640
@mpnm_y = 0
else 
@mpnm_x = 640
@mpnm_y = 320
end  
end
def mpnm_x
return @mpnm_x
end
def mpnm_y
return @mpnm_y
end
def fdtm
if @fdtm <= 0
@fdtm = 0 
end
return @fdtm
end
end 
############
# Game_Map #
############
class Game_Map
attr_reader   :map_id  
def mpname
$mpname = load_data("Data/MapInfos.rvdata") 
$mpname[@map_id].name
end
end
###############
# Window Base #
###############
class Window_Base < Window
def nd_mapic 
mapic = Cache.system("")     
end  
def draw_mpname(x,y)
mapic = Cache.system("Mpname") rescue nd_mapic   
cw = mapic.width  
ch = mapic.height 
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch + 65, mapic, src_rect)
self.contents.font.name = MOG::MPFONT
self.contents.font.size = 22
self.contents.font.bold = true
self.contents.font.shadow = true
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 76, y + 27, 110, 32, $game_map.mpname.to_s,1)
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x + 75, y + 26, 110, 32, $game_map.mpname.to_s,1)
end
end
##########
# Mpname #
##########
class Mpname < Window_Base
def initialize(x , y)
super($game_system.mpnm_x, $game_system.mpnm_y, 250, WLH + 70)
self.opacity = 0
refresh
end
def refresh
self.contents.clear
draw_mpname(10,0)    
end
end
#############
# Scene_Map #
#############
class Scene_Map
alias mog_vx06_start start 
def start
@mpnm = Mpname.new($game_system.mpnm_x, $game_system.mpnm_y)
@mpnm.contents_opacity = $game_system.fdtm
if $game_switches[MOG::WM_SWITCH_VIS_DISABLE] == false
@mpnm.visible = true
else
@mpnm.visible = false  
end  
mog_vx06_start  
end  
alias mog_vx06_terminate terminate
def terminate
mog_vx06_terminate
@mpnm.dispose 
end
alias mog_vx06_update update
def update 
mog_vx06_update  
location_name_update 
end
def location_name_update
$game_system.mpnm_x = @mpnm.x
$game_system.mpnm_y = @mpnm.y
if $game_switches[MOG::WM_SWITCH_VIS_DISABLE] == true or $game_system.fdtm <= 0
@mpnm.visible = false  
else
@mpnm.visible = true 
end 
if MOG::MPNMPS == 0 or MOG::MPNMPS == 1 
if @mpnm.x < 0
@mpnm.x += 5
elsif @mpnm.x >= 0
@mpnm.x = 0
end   
else
if @mpnm.x > 300
@mpnm.x -= 5
elsif @mpnm.x <= 300
@mpnm.x = 300
end     
end 
@mpnm.contents_opacity = $game_system.fdtm
if MOG::MPNMFD == true
$game_system.fdtm -= 3
end
end
alias mog_vx06_update_transfer_player update_transfer_player
def update_transfer_player
return unless $game_player.transfer? 
@mpnm.contents_opacity = 0
mog_vx06_update_transfer_player
if MOG::MPNMPS == 0 
$game_system.mpnm_x = -340
$game_system.mpnm_y = 0
elsif MOG::MPNMPS == 1
$game_system.mpnm_x = -340
$game_system.mpnm_y = 320
elsif MOG::MPNMPS == 2
$game_system.mpnm_x = 640
$game_system.mpnm_y = 0
else 
$game_system.mpnm_x = 640
$game_system.mpnm_y = 320
end  
@mpnm.y = $game_system.mpnm_y
@mpnm.x = $game_system.mpnm_x
$game_system.fdtm = 255 + 60 * MOG::MPNMTM
@mpnm.refresh
end
end
$mogscript = {} if $mogscript == nil
$mogscript["location_name_vx"] = true

Please use code tags even if it's in a spoiler, thanks. -Regi

Is it possible to restrict it to only show name of maps I want?
 
This PC doesn't have my working copy of VX, so I really didn't get to test this out, and I'm still kinda half awake, but it might do.

WM_DISABLED_MAPNAMES = [1, 4, 7, 12]  #<---Find this line, change the map ID's where needed.

Then let me know if it works!

Code:
#===============================================================================
# MOG_Location_Name_VX V1.0 (English Version)
#-------------------------------------------------------------------------------
# This script is origionally by MogHunter
# Commented and Indented by Kain Nobel
# http://www.atelier-rgss.com
#-------------------------------------------------------------------------------
# This script presents a window with the name of the Map.
# It is necessary to take a picture with the name of "MAPNAME"
# Place these graphics inside Graphics/System.
#===============================================================================
module MOG
  # Font Name
  MPFONT = "Georgia"
  #Fade ON/OFF (True - False).
  MPNMFD = true
  #Fade Time
  MPNMTM = 10
  #Window Position
  # 0 = Upper Left
  # 1 = Lower Left
  # 2 = Upper Right
  # 3 = Lower Right
  MPNMPS = 2
  # Disable Switch ID
  WM_SWITCH_VIS_DISABLE = 15
  WM_DISABLED_MAPNAMES = [1, 4, 7, 12]
end
################################################################################
#===============================================================================
# ** Game_System
#===============================================================================
class Game_System
  # [Attributes]----------------------------------------------------------------
  attr_accessor :fdtm
  attr_accessor :map_name_x
  attr_accessor :map_name_y
  #-----------------------------------------------------------------------------
  alias_method :mog_vx06_initialize, :initialize
  #-----------------------------------------------------------------------------
  # * Initialize Method
  #-----------------------------------------------------------------------------
  def initialize
    # Do origional initialize
    mog_vx06_initialize
    @fdtm = 255 + 40 * MOG::MPNMTM
    if MOG::MPNMPS == 0 
      @map_name_x = -300
      @map_name_y = 0
    elsif MOG::MPNMPS == 1
      @map_name_x = -300
      @map_name_y = 320
    elsif MOG::MPNMPS == 2
      @map_name_x = 640
      @map_name_y = 0
    else 
      @map_name_x = 640
      @map_name_y = 320
    end  
  end
  #-----------------------------------------------------------------------------
  # * Define Map Name X
  #-----------------------------------------------------------------------------
  def map_name_x
    return @map_name_x
  end
  def map_name_y
    return @map_name_y
  end
  def fdtm
    if @fdtm <= 0
      @fdtm = 0 
    end
      return @fdtm
    end
  end 
################################################################################
#===============================================================================
# * Game_Map
#===============================================================================
class Game_Map
  attr_reader   :map_id
  #-----------------------------------------------------------------------------
  # * Define Map Name
  #-----------------------------------------------------------------------------
  def map_name
    $map_name = load_data("Data/MapInfos.rvdata") 
    $map_name[@map_id].name
  end
end
################################################################################
#===============================================================================
# * Window_Base
#===============================================================================
class Window_Base < Window
  #-----------------------------------------------------------------------------
  # * Define Map Pic
  #-----------------------------------------------------------------------------
  def new_map_pic
    map_pic = Cache.system("")     
  end
  #-----------------------------------------------------------------------------
  # * Draw Map Name
  #-----------------------------------------------------------------------------
  def draw_map_name(x,y)
    map_pic = Cache.system("Window_MapName") rescue new_map_pic   
    cw = map_pic.width  
    ch = map_pic.height 
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x , y - ch + 65, map_pic, src_rect)
    self.contents.font.name = MOG::MPFONT
    self.contents.font.size = 22
    self.contents.font.bold = true
    self.contents.font.shadow = true
    self.contents.font.color = Color.new(0,0,0,255)
    self.contents.draw_text(x + 76, y + 27, 110, 32, $game_map.map_name.to_s,1)
    self.contents.font.color = Color.new(255,255,255,255)
    self.contents.draw_text(x + 75, y + 26, 110, 32, $game_map.map_name.to_s,1)
  end
end
################################################################################
#===============================================================================
# ** Window_MapName
#===============================================================================
class Window_MapName < Window_Base
  #-----------------------------------------------------------------------------
  # * Initialize
  #-----------------------------------------------------------------------------
  def initialize(x , y)
    super($game_system.map_name_x, $game_system.map_name_y, 250, WLH + 70)
    self.opacity = 0
    refresh
  end
  #-----------------------------------------------------------------------------
  # * Refresh
  #-----------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_map_name(10, 0)
  end
end
################################################################################
#===============================================================================
# ** Scene_Map
#===============================================================================
class Scene_Map
  #-----------------------------------------------------------------------------
  alias_method :mog_vx06_start,                   :start
  alias_method :mog_vx06_terminate,               :terminate
  alias_method :mog_vx06_update_transfer_player,  :update_transfer_player
  alias_method :mog_vx06_update,                  :update
  #-----------------------------------------------------------------------------
  # * Define Start
  #-----------------------------------------------------------------------------
  def start
    @mpnm = Window_MapName.new($game_system.map_name_x, $game_system.map_name_y)
    @mpnm.contents_opacity = $game_system.fdtm
    if $game_switches[MOG::WM_SWITCH_VIS_DISABLE] == false
      @mpnm.visible = true
    else
      @mpnm.visible = false
    end
    mog_vx06_start
  end
  #-----------------------------------------------------------------------------
  # * Terminate Method
  #-----------------------------------------------------------------------------
  def terminate
    # Call origional terminate method
    mog_vx06_terminate
    @mpnm.dispose 
  end
  #-----------------------------------------------------------------------------
  # * Update Method
  #-----------------------------------------------------------------------------
  def update 
    mog_vx06_update
    # Call origional Method
    location_name_update
  end
  #-----------------------------------------------------------------------------
  # * Location Name Update Method
  #-----------------------------------------------------------------------------
  def location_name_update
    $game_system.map_name_x = @mpnm.x
    $game_system.map_name_y = @mpnm.y
    @argument =  MOG::WM_DISABLED_MAPNAMES.include?($game_map.map_id) ? true : false
    if $game_switches[MOG::WM_SWITCH_VIS_DISABLE] == true or 
                                      $game_system.fdtm <= 0
      @mpnm.visible = false  
    else
      @mpnm.visible = @argument != true ? true : false
    end
    if MOG::MPNMPS == 0 or MOG::MPNMPS == 1 
      if @mpnm.x < 0
        @mpnm.x += 5
      elsif @mpnm.x >= 0
        @mpnm.x = 0
      end   
    else
      if @mpnm.x > 300
        @mpnm.x -= 5
      elsif @mpnm.x <= 300
        @mpnm.x = 300
      end
    end 
    @mpnm.contents_opacity = $game_system.fdtm
    if MOG::MPNMFD == true
    $game_system.fdtm -= 3
    end
  end
  #-----------------------------------------------------------------------------
  # * Update Transfer Player
  #-----------------------------------------------------------------------------
  def update_transfer_player
    return unless $game_player.transfer? 
    @mpnm.contents_opacity = 0
    # Call origional Method
    mog_vx06_update_transfer_player
    if MOG::MPNMPS == 0 
      $game_system.map_name_x = -340
      $game_system.map_name_y = 0
    elsif MOG::MPNMPS == 1
      $game_system.map_name_x = -340
      $game_system.map_name_y = 320
    elsif MOG::MPNMPS == 2
      $game_system.map_name_x = 640
      $game_system.map_name_y = 0
    else 
      $game_system.map_name_x = 640
      $game_system.map_name_y = 320
    end  
    @mpnm.y = $game_system.map_name_y
    @mpnm.x = $game_system.map_name_x
    $game_system.fdtm = 255 + 60 * MOG::MPNMTM
    @mpnm.refresh
  end
end
################################################################################
$mogscript = {} if $mogscript == nil
$mogscript["location_name_vx"] = true


This is the little code snippet I added, basically just an argument.

Code:
class Scene_Map
  #-----------------------------------------------------------------------------
  # * Location Name Update Method
  #-----------------------------------------------------------------------------
  def location_name_update
    $game_system.map_name_x = @mpnm.x
    $game_system.map_name_y = @mpnm.y
    @argument =  MOG::WM_DISABLED_MAPNAMES.include?($game_map.map_id) ? true : false
    if $game_switches[MOG::WM_SWITCH_VIS_DISABLE] == true or 
                                      $game_system.fdtm <= 0
      @mpnm.visible = false  
    else
      @mpnm.visible = @argument != true ? true : false
    end
    if MOG::MPNMPS == 0 or MOG::MPNMPS == 1 
      if @mpnm.x < 0
        @mpnm.x += 5
      elsif @mpnm.x >= 0
        @mpnm.x = 0
      end   
    else
      if @mpnm.x > 300
        @mpnm.x -= 5
      elsif @mpnm.x <= 300
        @mpnm.x = 300
      end
    end 
    @mpnm.contents_opacity = $game_system.fdtm
    if MOG::MPNMFD == true
    $game_system.fdtm -= 3
    end
  end
  #...
end

What does 'fdtm' do, is it something having to do with time? I'm just curious so I can re-translate it for other scripters to read.
 
The image disappears and the text remains? My bad, I forgot this tid bit, this should work...

Go to Window_Base, and replace your draw_map_name method with this one.

Code:
  def draw_map_name(x,y)
    map_pic = Cache.system("Window_MapName") rescue new_map_pic   
    cw = map_pic.width  
    ch = map_pic.height 
    src_rect = Rect.new(0, 0, cw, ch)
    @argument =  MOG::WM_DISABLED_MAPNAMES.include?($game_map.map_id) ? true : false
    unless @argument != false
      self.contents.blt(x , y - ch + 65, map_pic, src_rect)
      self.contents.font.name = MOG::MPFONT
      self.contents.font.size = 22
      self.contents.font.bold = true
      self.contents.font.shadow = true
      self.contents.font.color = Color.new(0,0,0,255)
      self.contents.draw_text(x + 76, y + 27, 110, 32, $game_map.map_name.to_s,1)
      self.contents.font.color = Color.new(255,255,255,255)
      self.contents.draw_text(x + 75, y + 26, 110, 32, $game_map.map_name.to_s,1)
    end
  end
end
 
I probably changed the name of the dummy map background pic to the one I had made, because I didn't have the one from the origional script... yup, its because the script is looking for a different file, mine was "Window_MapName" but the one you have is "MPNAME", since the file didn't exist it went to the rescue method which automatically sets the map pic to "" meaning no graphic is shown.

Here, just paste this in over it, I promise it works this time! I made a very tiny change, where you can set the Map_Pic in the public constants.

Code:
#===============================================================================
# MOG_Location_Name_VX V1.0 (English Version)
#-------------------------------------------------------------------------------
# This script is origionally by MogHunter
# Commented and Indented by Kain Nobel
# http://www.atelier-rgss.com
#-------------------------------------------------------------------------------
# This script presents a window with the name of the Map.
# It is necessary to take a picture with the name of "MAPNAME"
# Place these graphics inside Graphics/System.
#===============================================================================
module MOG
  # Font Name
  Map_Font          = "Georgia"
  #Fade ON/OFF (True - False).
  Map_Fade          = true
  #Fade Time
  Map_FadeDelay     = 10
  #Window Position
  # 0 = Upper Left
  # 1 = Lower Left
  # 2 = Upper Right
  # 3 = Lower Right
  Map_Position      = 2
  # Map Pic
  Map_Pic           = "MPNAME"
  # Disable Switch ID
  Map_DisableSwitch = 15
  Map_DisabledMaps  = [1, 4, 7, 12]
end
################################################################################
#===============================================================================
# ** Game_System
#===============================================================================
class Game_System
  # [Attributes]----------------------------------------------------------------
  attr_accessor :fade_time
  attr_accessor :map_name_x
  attr_accessor :map_name_y
  #-----------------------------------------------------------------------------
  alias_method :mog_vx06_initialize, :initialize
  #-----------------------------------------------------------------------------
  # * Initialize Method
  #-----------------------------------------------------------------------------
  def initialize
    # Do origional initialize
    mog_vx06_initialize
    @fade_time = 255 + 40 * MOG::Map_FadeDelay
    if MOG::Map_Position == 0 
      @map_name_x = -300
      @map_name_y = 0
    elsif MOG::Map_Position == 1
      @map_name_x = -300
      @map_name_y = 320
    elsif MOG::Map_Position == 2
      @map_name_x = 640
      @map_name_y = 0
    else 
      @map_name_x = 640
      @map_name_y = 320
    end  
  end
  #-----------------------------------------------------------------------------
  # * Define Map Name X
  #-----------------------------------------------------------------------------
  def map_name_x
    return @map_name_x
  end
  #-----------------------------------------------------------------------------
  # * Define Map Name Y
  #-----------------------------------------------------------------------------
  def map_name_y
    return @map_name_y
  end
  #-----------------------------------------------------------------------------
  # * Define Fade Time
  #-----------------------------------------------------------------------------
  def fade_time
    if @fade_time <= 0
      @fade_time = 0 
    end
    return @fade_time
  end
end
################################################################################
#===============================================================================
# * Game_Map
#===============================================================================
class Game_Map
  attr_reader   :map_id
  #-----------------------------------------------------------------------------
  # * Define Map Name
  #-----------------------------------------------------------------------------
  def map_name
    $map_name = load_data("Data/MapInfos.rvdata") 
    $map_name[@map_id].name
  end
end
################################################################################
#===============================================================================
# * Window_Base
#===============================================================================
class Window_Base < Window
  #-----------------------------------------------------------------------------
  # * Define Map Pic
  #-----------------------------------------------------------------------------
  def new_map_pic
    map_pic = Cache.system("")     
  end
  #-----------------------------------------------------------------------------
  # * Draw Map Name
  #-----------------------------------------------------------------------------
  def draw_map_name(x,y)
    map_pic = Cache.system(MOG::Map_Pic) rescue new_map_pic
    cw = map_pic.width  
    ch = map_pic.height 
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x , y - ch + 65, map_pic, src_rect)
    self.contents.font.name = MOG::Map_Font
    self.contents.font.size = 22
    self.contents.font.bold = true
    self.contents.font.shadow = true
    self.contents.font.color = Color.new(0,0,0,255)
    self.contents.draw_text(x + 76, y + 27, 110, 32, $game_map.map_name.to_s,1)
    self.contents.font.color = Color.new(255,255,255,255)
    self.contents.draw_text(x + 75, y + 26, 110, 32, $game_map.map_name.to_s,1)
  end
end
################################################################################
#===============================================================================
# ** Window_MapName
#===============================================================================
class Window_MapName < Window_Base
  #-----------------------------------------------------------------------------
  # * Initialize
  #-----------------------------------------------------------------------------
  def initialize(x , y)
    super($game_system.map_name_x, $game_system.map_name_y, 250, WLH + 70)
    self.opacity = 0
    refresh
  end
  #-----------------------------------------------------------------------------
  # * Refresh
  #-----------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_map_name(10, 0)
  end
end
################################################################################
#===============================================================================
# ** Scene_Map
#===============================================================================
class Scene_Map
  #-----------------------------------------------------------------------------
  alias_method :mog_vx06_start,                   :start
  alias_method :mog_vx06_terminate,               :terminate
  alias_method :mog_vx06_update_transfer_player,  :update_transfer_player
  alias_method :mog_vx06_update,                  :update
  #-----------------------------------------------------------------------------
  # * Define Start
  #-----------------------------------------------------------------------------
  def start
    @mpnm = Window_MapName.new($game_system.map_name_x, $game_system.map_name_y)
    @mpnm.contents_opacity = $game_system.fade_time
    if $game_switches[MOG::Map_DisableSwitch] == false
      @mpnm.visible = true
    else
      @mpnm.visible = false
    end
    mog_vx06_start
  end
  #-----------------------------------------------------------------------------
  # * Terminate Method
  #-----------------------------------------------------------------------------
  def terminate
    # Call origional terminate method
    mog_vx06_terminate
    @mpnm.dispose 
  end
  #-----------------------------------------------------------------------------
  # * Update Method
  #-----------------------------------------------------------------------------
  def update 
    mog_vx06_update
    # Call origional Method
    location_name_update
  end
  #-----------------------------------------------------------------------------
  # * Location Name Update Method
  #-----------------------------------------------------------------------------
  def location_name_update
    $game_system.map_name_x = @mpnm.x
    $game_system.map_name_y = @mpnm.y
    @argument =  MOG::Map_DisabledMaps.include?($game_map.map_id) ? true : false
    if $game_switches[MOG::Map_DisableSwitch] == true or 
                                      $game_system.fade_time <= 0
      @mpnm.visible = false  
    else
      @mpnm.visible = @argument != true ? true : false
    end
    if MOG::Map_Position == 0 or MOG::Map_Position == 1 
      if @mpnm.x < 0
        @mpnm.x += 5
      elsif @mpnm.x >= 0
        @mpnm.x = 0
      end   
    else
      if @mpnm.x > 300
        @mpnm.x -= 5
      elsif @mpnm.x <= 300
        @mpnm.x = 300
      end
    end 
    @mpnm.contents_opacity = $game_system.fade_time
    if MOG::Map_Fade == true
    $game_system.fade_time -= 3
    end
  end
  #-----------------------------------------------------------------------------
  # * Update Transfer Player
  #-----------------------------------------------------------------------------
  def update_transfer_player
    return unless $game_player.transfer? 
    @mpnm.contents_opacity = 0
    # Call origional Method
    mog_vx06_update_transfer_player
    if MOG::Map_Position == 0 
      $game_system.map_name_x = -340
      $game_system.map_name_y = 0
    elsif MOG::Map_Position == 1
      $game_system.map_name_x = -340
      $game_system.map_name_y = 320
    elsif MOG::Map_Position == 2
      $game_system.map_name_x = 640
      $game_system.map_name_y = 0
    else 
      $game_system.map_name_x = 640
      $game_system.map_name_y = 320
    end  
    @mpnm.y = $game_system.map_name_y
    @mpnm.x = $game_system.map_name_x
    $game_system.fade_time = 255 + 60 * MOG::Map_FadeDelay
    @mpnm.refresh
  end
end
################################################################################
$mogscript = {} if $mogscript == nil
$mogscript["location_name_vx"] = true
 
If it's not too difficult, do you think it's possible to change the trigger, so instead of using

WM_DISABLED_MAPNAMES = [1, 4, 7, 12]

To choose which maps not to display, use

WM_ENABLED_MAPNAMES = [ X,X,X,X]

To choose which maps to show?
 

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