Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ╔══════════════════════════════════════════════════════╤═══════╤════════════╗
- # ║ Custom Map Name Display │ v1.04 │ (05/14/15) ║
- # ╠══════════════════════════════════════════════════════╧═══════╧════════════╣
- # ║ Author: William Couillard ║
- # ║ E-Mail: cooliebk18@yahoo.com ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ ABOUT ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ This script gives you options on how to display map names. ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ TERMS OF USE ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ ► Do not edit the script's header or comments. ║
- # ║ ► Free to use in commercial projects as long as proper credit is given to ║
- # ║ ALL the names in the above header. ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ FEATURES ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ ► Various customizations for Window_MapName to change how map names are ║
- # ║ displayed. ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ CHANGE LOG ║
- # ╠═══════════════════════════════════════════════════════════════════╤═══════╣
- # ║ ■ May 14, 2015 : Window height option added, back opacity │ v1.04 ║
- # ║ limit option added. │ ║
- # ╟───────────────────────────────────────────────────────────────────┼───────╢
- # ║ ■ May 13, 2015 : Bugfixes. │ v1.03 ║
- # ╟───────────────────────────────────────────────────────────────────┼───────╢
- # ║ ■ November 22, 2013 : Fixed bug with window mode. │ v1.02 ║
- # ╟───────────────────────────────────────────────────────────────────┼───────╢
- # ║ ■ November 22, 2013 : Fixed bug with alignment. │ v1.01 ║
- # ╟───────────────────────────────────────────────────────────────────┼───────╢
- # ║ ■ September 13, 2013 : Initial release. │ v1.00 ║
- # ╠═══════════════════════════════════════════════════════════════════╧═══════╣
- # ║ NEXT VERSION ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ ■ Possible update to allow more customization options. ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ METHOD OVERWRITES ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ ► This script overwrites several methods in Window_MapName. ║
- # ╟───────────────────────────────────────────────────────────────────────────╢
- # ║ ■ class Window_MapName < Window_Base ║
- # ║ ► def initialize ║
- # ║ ► def window_width ║
- # ║ ► def window_height ║
- # ║ ► def update ║
- # ║ ► def update_fadein ║
- # ║ ► def update_fadeout ║
- # ║ ► def open ║
- # ║ ► def close ║
- # ║ ► def refresh ║
- # ║ ► def draw_background ║
- # ║ ► def back_color1 ║
- # ║ ► def back_color2 ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ NEW METHODS ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ This script creates one new method in Window_MapName. ║
- # ╟───────────────────────────────────────────────────────────────────────────╢
- # ║ ■ class Window_MapName < Window_Base ║
- # ║ ► def y_pos ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ INSTRUCTIONS ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ Simply paste this script anywhere above the Main script and below the ║
- # ║ Window_MapName script. ║
- # ╠═══════════════════════════════════════════════════════════════════════════╣
- # ║ IMPORT SETTING ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- $imported = {} if $imported.nil?
- $imported[:wc_custom_map_name_display] = true
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Coolie's Custom Map Name Display Module ║
- # ╟───────────────────────────────────────────────────────────────────────────╢
- # ║ This module manages this script's settings. ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- module COOLIE
- module MAPNAME
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Use Window or Transparency? (true/false) ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- MAPNAME_WINDOWMODE = true
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ No. of Frames to Show Map Name (60 frames = 1 second) ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- MAPNAME_SHOW_COUNT = 180
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Y Offset of Map Name Window ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- MAPNAME_Y = 0
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Width of Map Name Window ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- MAPNAME_WIDTH = 544
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Height of Map Name Window ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- MAPNAME_HEIGHT = 48
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Alignment of Map Name Window Text [0:Left, 1: Center, 2: Right] ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- MAPNAME_ALIGN = 1
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Alignment of Map Name Window [0:Left, 1: Center, 2: Right] ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- MAPNAME_W_ALIGN = 1
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Opacity Limit (Window opacity won't go higher than this value / 0-255) ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- MAPNAME_OPACITY_LIMIT = 255
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Map Color 1 (Used for gradient / 0-255) [R, G, B, Alpha] ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- MAPNAME_COLOR1 = Color.new(0, 0, 0, 160)
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Map Color 2 (Used for gradient / 0-255) [R, G, B, Alpha] ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- MAPNAME_COLOR2 = Color.new(0, 0, 0, 128)
- end
- end
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Window_MapName ║
- # ╟───────────────────────────────────────────────────────────────────────────╢
- # ║ This window displays the map name. ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- class Window_MapName < Window_Base
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Object Initialization ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- def initialize
- case COOLIE::MAPNAME::MAPNAME_W_ALIGN
- when 0
- super(0, y_pos, window_width, window_height)
- when 1
- super(Graphics.width / 2 - window_width / 2, y_pos, window_width,
- window_height)
- when 2
- super(Graphics.width - window_width, y_pos, window_width, window_height)
- end
- self.opacity = 0
- self.back_opacity = 0
- self.contents_opacity = 0
- @show_count = 0
- refresh
- end
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Method: y_pos ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- def y_pos
- return COOLIE::MAPNAME::MAPNAME_Y
- end
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Method: window_width ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- def window_width
- return COOLIE::MAPNAME::MAPNAME_WIDTH
- end
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Method: window_height ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- def window_height
- return COOLIE::MAPNAME::MAPNAME_HEIGHT
- end
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Method: update ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- def update
- super
- if @show_count > 0 && $game_map.name_display
- update_fadein
- @show_count -= 1
- self.opacity = COOLIE::MAPNAME::MAPNAME_OPACITY_LIMIT if self.opacity >=
- COOLIE::MAPNAME::MAPNAME_OPACITY_LIMIT
- else
- update_fadeout
- end
- end
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Method: update_fadein ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- def update_fadein
- if COOLIE::MAPNAME::MAPNAME_WINDOWMODE == false
- self.opacity += 0 unless $game_map.display_name.empty?
- self.back_opacity += 0 unless $game_map.display_name.empty?
- self.contents_opacity += 16
- else
- self.opacity += 16 unless $game_map.display_name.empty?
- self.back_opacity += 16 unless $game_map.display_name.empty?
- self.contents_opacity += 16
- end
- end
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Method: update_fadeout ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- def update_fadeout
- if COOLIE::MAPNAME::MAPNAME_WINDOWMODE == false
- self.opacity -= 0 unless $game_map.display_name.empty?
- self.back_opacity -= 0 unless $game_map.display_name.empty?
- self.contents_opacity -= 16
- else
- self.opacity -= 16 unless $game_map.display_name.empty?
- self.back_opacity -= 16 unless $game_map.display_name.empty?
- self.contents_opacity -= 16
- end
- end
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Method: open ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- def open
- refresh
- @show_count = COOLIE::MAPNAME::MAPNAME_SHOW_COUNT
- self.opacity = 0
- self.back_opacity = 0
- self.contents_opacity = 0
- self
- end
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Method: close ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- def close
- @show_count = 0
- self
- end
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Method: refresh ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- def refresh
- contents.clear
- unless $game_map.display_name.empty?
- draw_background(contents.rect) if COOLIE::MAPNAME::MAPNAME_WINDOWMODE == false
- draw_text(contents.rect, $game_map.display_name, COOLIE::MAPNAME::MAPNAME_ALIGN)
- end
- end
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Method: draw_background ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- def draw_background(rect)
- temp_rect = rect.clone
- temp_rect.width /= 2
- contents.gradient_fill_rect(temp_rect, back_color2, back_color1)
- temp_rect.x = temp_rect.width
- contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
- end
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Method: back_color1 ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- def back_color1
- COOLIE::MAPNAME::MAPNAME_COLOR1
- end
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ Method: back_color2 ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- def back_color2
- COOLIE::MAPNAME::MAPNAME_COLOR2
- end
- # ╔═══════════════════════════════════════════════════════════════════════════╗
- # ║ End of Script ║
- # ╚═══════════════════════════════════════════════════════════════════════════╝
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement