Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # Simple Map HUD
- # Author: Nicke
- # Created: 07/06/2011
- # Edited: 05/12/2011
- # Version: 1.1a
- #==============================================================================
- # 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 ||= {})["NICKE-MAP"] = true
- module NICKE
- module MAP_HUD
- #==============================================================================#
- # ** Settings
- #==============================================================================#
- # MAP_FONT |FONT| |SIZE| |COLOR| |SHADOW|
- MAP_FONT = ["Tahoma", 16, Color.new(255,215,100), true]
- # MAP_WINDOW |X| |Y| |Z| |OPACITY|
- MAP_WINDOW = [-12, -20, 200, 0]
- # MAP_HUD |ICON| |VISIBLITY| |SHOW_ICON|
- MAP_HUD = [153, 1, true]
- SHOW_MAP_ID = nil # Show map for ID(s).
- MAPNAME_REPLACE = { # Map ID => "ReplacedName"
- } # Don't remove this line!
- # If you don't use the replace function feel free to comment it out.
- #=========================================================================#
- Map_Example = "This text will be shown for id 1 to 5."
- Map_Example2 = "This text will be shown for id 6 and 8."
- def self.replace_mapname(oldname, map_id)
- case map_id
- when 1..5 ; return Map_Example
- when 6,8 ; return Map_Example2
- 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. ***
- include NICKE::MAP_HUD
- #==============================================================================#
- # ** Game_Map
- #------------------------------------------------------------------------------
- # Method for reading the map id and name.
- #==============================================================================#
- class Game_Map
- attr_reader :name
- 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 map.
- #==============================================================================#
- class Window_Base < Window
- def draw_map_hud(x, y)
- self.contents.font.name = MAP_FONT[0]
- self.contents.font.size = MAP_FONT[1]
- self.contents.font.color = MAP_FONT[2]
- self.contents.font.shadow = MAP_FONT[3]
- 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, 360, WLH + 38)
- @map_id = $game_map.map_id
- refresh
- end
- def refresh
- self.contents.clear
- draw_map_hud(0, 0) # // Draw map.
- draw_icon(MAP_HUD[0], 0, 6) if MAP_HUD[2]
- end
- def update
- super
- if @map_id != $game_map.map_id # // Refresh if map changed.
- 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, &block)
- nicke_map_hud_start(*args, &block)
- create_map_hud
- @map_hud.visible = $game_switches[MAP_HUD[1]]
- if SHOW_MAP_ID != nil
- if SHOW_MAP_ID.include?($game_map.map_id)
- @map_hud.visible = true
- else
- @map_hud.visible = false
- end
- end
- end
- alias nicke_map_hud_terminate terminate unless $@
- def terminate(*args, &block)
- nicke_map_hud_terminate(*args, &block)
- dispose_map_hud
- end
- def create_map_hud
- @map_hud = Simple_Map_HUD.new(MAP_WINDOW[0], MAP_WINDOW[1])
- @map_hud.z = MAP_WINDOW[2]
- @map_hud.opacity = MAP_WINDOW[3]
- 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(*args, &block)
- nicke_map_hud_update(*args, &block)
- @map_hud.update
- @map_hud.visible = $game_switches[MAP_HUD[1]]
- if SHOW_MAP_ID != nil
- if 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
Advertisement