Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # XS - Moon Hud
- # Original Author: Nicke
- # Edited by: Nekosune
- # Created: 02/04/2012
- # Edited: 09/04/2012
- # Version: 1.0a
- #==============================================================================
- # 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.
- #
- # A small hud to Moon phase on the map.
- #
- # *** Only for RPG Maker VX Ace. ***
- #==============================================================================
- ($imported ||= {})["NEKO-MOON_HUD"] = true
- module NEKO
- module MOON_HUD
- #--------------------------------------------------------------------------#
- # * Settings
- #--------------------------------------------------------------------------#
- # FONT = [name, size, color, bold, shadow]
- FONT = [["Verdana"], 14, Color.new(255,255,255), true, true]
- # HUD = [width, x, y, z, opacity, skin]
- HUD = [270, 295, -5, 200, 0, nil]
- # VAR_HUD_SWITCH = switch_id
- VAR_HUD_SWITCH = 1
- HOUR_VAR=2
- MIN_VAR=1
- # VAR_LIST = [variable_id, vocab (nil), icon_index (nil), x, y]
- VAR_LIST = [] # Don't remove!
- VAR_LIST[0] = [4, nil, nil] # Set variable_id to same variable as DAYB from Time script
- # Set the symbol for the amount.
- # Can be set to "" to disable.
- # SYMBOL = string
- SYMBOL = ""
- # The space beetween the variables.
- # SPACING = number
- SPACING = 24
- end
- end
- # *** Don't edit below unless you know what you are doing. ***
- #==============================================================================#
- # ** Window_Var_Hud
- #------------------------------------------------------------------------------
- # Class for drawing the variable hud.
- #==============================================================================#
- class Window_Var_Hud < Window_Base
- def initialize
- # // Method to initialize the var hud window.
- super(0, 0, window_width, fitting_height(NEKO::MOON_HUD::VAR_LIST.size+1))
- refresh
- end
- def window_width
- # // Method to return the width.
- return NEKO::MOON_HUD::HUD[0]
- end
- def draw_var(var, unit, x, y, width)
- # // Method to draw a variable with the content.
- vl=$game_variables[var]
- vl=vl%28
- moon="New Moon"
- if vl >3 and vl <=7
- moon="Waxing Crescent"
- elsif vl >7 and vl <=10
- moon="First Quater"
- elsif vl >10 and vl <=14
- moon="Waxing Gibbeous"
- elsif vl >14 and vl <=17
- moon="Full Moon"
- elsif vl >17 and vl <=21
- moon="Waning Gibbeous"
- elsif vl >21 and vl <=24
- moon="Third Quater"
- elsif vl >24 and vl<=28
- moon="Waning Crescent"
- elsif vl >28
- moon="New Moon"
- end
- value = "#{moon}#{NEKO::MOON_HUD::SYMBOL}"
- contents.font = Font.new(NEKO::MOON_HUD::FONT[0], NEKO::MOON_HUD::FONT[1])
- contents.font.color = NEKO::MOON_HUD::FONT[2]
- contents.font.bold = NEKO::MOON_HUD::FONT[3]
- contents.font.shadow = NEKO::MOON_HUD::FONT[4]
- draw_text(x, y, width - 60, line_height, value, 2)
- draw_text(x, y, width - 18, line_height, unit, 2) unless unit.nil?
- value="Day: #{$game_variables[var]} %02d:%02d" % [$game_variables[NEKO::MOON_HUD::HOUR_VAR],$game_variables[NEKO::MOON_HUD::MIN_VAR]]
- debug(y)
- debug(y+NEKO::MOON_HUD::SPACING)
- debug(value)
- draw_text(x, y+NEKO::MOON_HUD::SPACING, width - 60, line_height, value, 2)
- reset_font_settings
- end
- def refresh
- # // Method to refresh the variable hud.
- contents.clear
- draw_var_hud
- end
- def draw_var_hud
- # // Method to draw the var hud.
- y = 0
- @vars = {}
- for i in NEKO::MOON_HUD::VAR_LIST
- x = i[1].nil? ? 32 : -10
- draw_var(i[0], i[1], x, y, contents.width - 8)
- draw_icon(i[2], 210, y - 2) unless i[2].nil?
- y += NEKO::MOON_HUD::SPACING
- @vars[i[0]] = $game_variables[NEKO::MOON_HUD::MIN_VAR]
- end
- end
- def update
- # // Method to update the variable hud if a value has been changed.
- super
- for i in NEKO::MOON_HUD::VAR_LIST
- refresh if($game_variables[NEKO::MOON_HUD::MIN_VAR] != @vars[i[0]])
- end
- end
- end
- #==============================================================================
- # ** Scene_Map
- #------------------------------------------------------------------------------
- # Show variable hud on the map.
- #==============================================================================
- class Scene_Map < Scene_Base
- alias neko_var_hud_window_start start
- def start(*args, &block)
- # // Method to start the var hud window on the map.
- neko_var_hud_window_start(*args, &block)
- create_var_hud_window
- @var_hud_window.visible = $game_switches[NEKO::MOON_HUD::VAR_HUD_SWITCH]
- end
- alias neko_var_hud_window_terminate terminate
- def terminate(*args, &block)
- # // Method to terminate the var hud window on the map.
- neko_var_hud_window_terminate(*args, &block)
- end
- def create_var_hud_window
- # // Method to create the variable window.
- @var_hud_window = Window_Var_Hud.new
- @var_hud_window.x = NEKO::MOON_HUD::HUD[1]
- @var_hud_window.y = NEKO::MOON_HUD::HUD[2]
- @var_hud_window.z = NEKO::MOON_HUD::HUD[3]
- @var_hud_window.opacity = NEKO::MOON_HUD::HUD[4]
- @var_hud_window.windowskin = Cache.system(NEKO::MOON_HUD::HUD[5]) unless NEKO::MOON_HUD::HUD[5].nil?
- end
- alias neko_var_hud_window_update update
- def update(*args, &block)
- # // Method to update the var hud window on the map.
- neko_var_hud_window_update(*args, &block)
- @var_hud_window.visible = $game_switches[NEKO::MOON_HUD::VAR_HUD_SWITCH]
- end
- end # END OF FILE
- #=*==========================================================================*=#
- # ** END OF FILE
- #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment