Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # Simple Map HUD
- # Author: Nicke
- # Created: 07/06/2011
- # Edited: 15/06/2011
- # Version: 1.0
- #==============================================================================
- # Instructions
- # -----------------------------------------------------------------------------
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
- #==============================================================================
- $imported = {} if $imported == nil
- $imported["NICKE-MAP"] = true
- module NICKE
- module MAP_HUD
- #==============================================================================#
- # ** Settings
- #==============================================================================#
- MAP_HUD_FONT = ["Rockwell"] # Font name.
- MAP_HUD_SIZE = 18 # Font size.
- MAP_HUD_COLOR = Color.new(255,215,100) # Font color.
- MAP_HUD_SHADOW = true # Font shadow.
- X_MAP_HUD = -12 # X position.
- Y_MAP_HUD = -20 # Y position.
- Z_MAP_HUD = 200 # Z order.
- OPACITY = 0 # Opacity level.
- SHOW_ICON = true # Icon visibility.
- ICON_INDEX = 153 # Map icon ID to be displayed.
- VISIBLE_SWITCH = 8 # Switch ID to turn on/off the map window.
- SHOW_MAP_ID = nil # Show map for ID(s). nil to turn it off.
- ANCIENT_CAVERNS = "Ancient Caverns"
- MAPNAME_REPLACE = { # Map ID => "ReplacedName"
- } # Don't remove this line!
- # Method for replacing the map name.
- def self.replace_mapname(oldname, map_id)
- case map_id
- when 8, 16..19, 21, 24..28, 30..34 ; return ANCIENT_CAVERNS
- end
- return MAPNAME_REPLACE[map_id] if MAPNAME_REPLACE.has_key?(map_id)
- return oldname
- end
- end
- end
- # *** Don't edit below unless you know what you are doing. ***
- #==============================================================================#
- # ** Game_Map
- #------------------------------------------------------------------------------
- # Method for reading the map id and name.
- #==============================================================================#
- class Game_Map
- attr_reader :name
- #--------------------------------------------------------------------------
- # *setup
- #--------------------------------------------------------------------------
- alias nicke_map_hud_setup setup
- def setup(map_id)
- nicke_map_hud_setup(map_id)
- @map_infos = load_data("Data/MapInfos.rvdata") if @map_infos.nil?
- @name = NICKE::MAP_HUD.replace_mapname(@map_infos[@map_id].name, @map_id)
- end
- end
- #==============================================================================#
- # ** Window_Base
- #------------------------------------------------------------------------------
- # Method for drawing the gold.
- #==============================================================================#
- class Window_Base < Window
- def draw_map_hud(x, y)
- self.contents.font.name = NICKE::MAP_HUD::MAP_HUD_FONT
- self.contents.font.size = NICKE::MAP_HUD::MAP_HUD_SIZE
- self.contents.font.color = NICKE::MAP_HUD::MAP_HUD_COLOR
- self.contents.font.shadow = NICKE::MAP_HUD::MAP_HUD_SHADOW
- self.contents.draw_text(x + 30, y, 260, 32, $game_map.name.to_s, 0)
- end
- end
- #==============================================================================
- # ** Simple_Map_HUD
- #------------------------------------------------------------------------------
- # This window displays the current location.
- #==============================================================================
- class Simple_Map_HUD < Window_Base
- def initialize(x, y)
- super(x, y, 260, WLH + 38)
- @map_id = $game_map.map_id
- refresh()
- end
- def refresh()
- self.contents.clear()
- draw_map_hud( 0, 0 )
- if NICKE::MAP_HUD::SHOW_ICON != false
- draw_icon(NICKE::MAP_HUD::ICON_INDEX, 0, 6)
- end
- end
- def update()
- super()
- if @map_id != $game_map.map_id
- refresh()
- @map_id = $game_map.map_id
- end
- end
- end
- #==============================================================================
- # ** Scene_Map
- #------------------------------------------------------------------------------
- # Show a location window on the map.
- #==============================================================================
- class Scene_Map < Scene_Base
- alias nicke_map_hud_start start unless $@
- def start(*args)
- create_map_hud
- @map_hud.visible = $game_switches[NICKE::MAP_HUD::VISIBLE_SWITCH]
- if NICKE::MAP_HUD::SHOW_MAP_ID != nil
- if NICKE::MAP_HUD::SHOW_MAP_ID.include?($game_map.map_id)
- @map_hud.visible = true
- else
- @map_hud.visible = false
- end
- end
- nicke_map_hud_start(*args)
- end
- alias nicke_map_hud_terminate terminate unless $@
- def terminate
- nicke_map_hud_terminate
- dispose_map_hud
- end
- def create_map_hud
- @map_hud = Simple_Map_HUD.new(NICKE::MAP_HUD::X_MAP_HUD,
- NICKE::MAP_HUD::Y_MAP_HUD)
- @map_hud.opacity = NICKE::MAP_HUD::OPACITY
- @map_hud.z = NICKE::MAP_HUD::Z_MAP_HUD
- end
- def dispose_map_hud
- @map_hud.dispose unless @map_hud.nil?
- @map_hud = nil
- end
- alias nicke_map_hud_update update unless $@
- def update
- nicke_map_hud_update
- @map_hud.update
- @map_hud.visible = $game_switches[NICKE::MAP_HUD::VISIBLE_SWITCH]
- if NICKE::MAP_HUD::SHOW_MAP_ID != nil
- if NICKE::MAP_HUD::SHOW_MAP_ID.include?($game_map.map_id)
- @map_hud.visible = true
- else
- @map_hud.visible = false
- end
- end
- end
- end # END OF FILE
- #=*==========================================================================*=#
- # ** END OF FILE
- #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment