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.

Display Map Name

What is the RGSS2 code for current map name please?
Thanks anyone who can help.
EDIT: This is my window
Code:
#==============================================================================
# ** Window_Mapname
#------------------------------------------------------------------------------
#  This window deals with the map name shown on the CMS.
#==============================================================================
class Window_Mapname < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     x : window X coordinate
  #     y : window Y coordinate
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 268, 52)
    self.back_opacity = 256
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
  end
end
How would I display the current map name into that?
 

e

Sponsor

There is no public accessor for the game map id. It is hidden. In theory.

You can still get with the following tidbit:

Code:
$game_map.instance_variable_get("@map_id")
 
I don't mind if there is a longer code for displaying it. I'll look at some other people's scripts actually.
EDIT: I actually want the map name not ID. sory for the confusion.
EDIT2: Okay I have it now. If anyone else wants to use:
Code:
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This is an addon to Game_Map to allow the use of mapname
#  Access it with $game_map.mapname
#==============================================================================
class Game_Map
  attr_reader :map_id
  def mapname
    $mapname = load_data("Data/MapInfos.rvdata")
    $mapname[@map_id].name
  end
end
Place that at the top of your script and access it with $game_map.mapname
 

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