Jump to content

Recommended Posts

Original script is XAIL's Simple Gold HUD. I just edited and changed to variable hud.

 

#==============================================================================
#   Simple Variable Hud
#   Author: efeberk
#   Developer : XAIL
#   Created: 02/05/2012
#   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.
# *** BIG NOTE : Owner of script is XAIL. efeberk is just editor.
# *** Only for RPG Maker VX Ace. ***
#==============================================================================
($imported ||= {})["XAIL-SIMPLE-VARIABLE-HUD"] = true
VARIABLE_ID = 10 # variable id that you will use.
module XAIL
 module VARIABLE
 #--------------------------------------------------------------------------#
 # * Settings
 #--------------------------------------------------------------------------#
# FONT = [name, size, color, bold, shadow ]
FONT = [["Verdana"], 20, Color.new(105,79,187), true, true]
# VARIABLE_WINDOW = [width, x, y , opacity, skin ]
WINDOW =  [160, 405, -5,  200, 0, ""]



# VARIABLE = [icon, switch_id, show_icon, show_vocab, count_switch ]

VARIABLE =   [121, 61, true, false, 2]
# VARIABLE_COUNT = [ sound, vol, pitch, play ]
VARIABLE_COUNT = ["", 60, 100, false]
# Count timer for updating the variable.
VARIABLE_COUNT_WAIT = 4
# The time lapse between variable count changing.
VARIABLE_CHANGING = 1
 end
end
# *** Don't edit below unless you know what you are doing. ***
#==============================================================================#
# ** Window_Gold_Hud
#------------------------------------------------------------------------------
#  Class for drawing the variable.
#==============================================================================#
class Window_Variable_Hud < Window_Base
 def initialize
# // Method to initialize the variable window.
super(0, 0, window_width, fitting_height(1))
@last_variable = $game_variables[VARIABLE_ID]
@wait_period = XAIL::VARIABLE::VARIABLE_COUNT_WAIT
refresh
 end
 def window_width
# // Method to return the width.
return XAIL::VARIABLE::WINDOW[0]
 end
 def draw_variable(value, unit, x, y, width)
# // Method to draw the variable.
cx = text_size(unit).width
contents.font = Font.new(XAIL::VARIABLE::FONT[0], XAIL::VARIABLE::FONT[1])
contents.font.color = XAIL::VARIABLE::FONT[2]
contents.font.bold = XAIL::VARIABLE::FONT[3]
contents.font.shadow = XAIL::VARIABLE::FONT[4]
# // Draw variable.
draw_text(x, y, width - cx - 2, line_height, value, 2)
# // Draw vocab.
draw_text(x, y, width, line_height, unit, 2) if XAIL::VARIABLE::VARIABLE[3]
reset_font_settings
 end
 def refresh
# // Method to refresh the variable.
contents.clear
if $game_switches[XAIL::VARIABLE::VARIABLE[4]]
  draw_variable($game_variables[VARIABLE_ID], Vocab::currency_unit, -10, 0, contents.width - 8)
else
  draw_variable(@last_variable, Vocab::currency_unit, -10, 0, contents.width - 8)
end
draw_icon(XAIL::VARIABLE::VARIABLE[0], 100, -2) if XAIL::VARIABLE::VARIABLE[2]
 end
 def update
# // Method to update the variable.
super
@wait_period -= 1 if @wait_period != 0
if @last_variable != $game_variables[VARIABLE_ID] and @wait_period == 0
  if @last_variable < $game_variables[VARIABLE_ID]
	@last_variable += 1
  else
	@last_variable -= 1
  end
  if self.visible
	RPG::SE.new(XAIL::VARIABLE::VARIABLE_COUNT[0], XAIL::VARIABLE::VARIABLE_COUNT[1], XAIL::VARIABLE::VARIABLE_COUNT[2]).play if XAIL::VARIABLE::VARIABLE_COUNT[3]
  end
  refresh
  @wait_period = XAIL::VARIABLE::VARIABLE_CHANGING
end
 end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  Show variable window on the map.
#==============================================================================
class Scene_Map < Scene_Base
 alias xail_variable_window_start start unless $@
 def start(*args, &block)
# // Method to start the variable window on the map.
xail_variable_window_start(*args, &block)
create_variable_window
@variable_window.visible = $game_switches[XAIL::VARIABLE::VARIABLE[1]]
 end
 alias xail_variable_window_terminate terminate unless $@
 def terminate(*args, &block)
# // Method to terminate the variable window on the map.
xail_variable_window_terminate(*args, &block)
dispose_variable_window
 end
 def create_variable_window
# // Method to create the variable window.
@variable_window = Window_Variable_Hud.new
@variable_window.x = XAIL::VARIABLE::WINDOW[1]
@variable_window.y = XAIL::VARIABLE::WINDOW[2]
@variable_window.z = XAIL::VARIABLE::WINDOW[3]
@variable_window.opacity = XAIL::VARIABLE::WINDOW[4]
@variable_window.windowskin = Cache.system(XAIL::VARIABLE::WINDOW[5]) unless XAIL::VARIABLE::WINDOW[5] == ""
 end
 def dispose_variable_window
# // Method to dispose the variable window.
@variable_window.dispose unless @variable_window.nil?
@variable_window = nil
 end
 alias xail_variable_window_update update unless $@
 def update(*args, &block)
# // Method to update the variable window on the map.
xail_variable_window_update(*args, &block)
@variable_window.update
@variable_window.visible = $game_switches[XAIL::VARIABLE::VARIABLE[1]]
 end
end # END OF FILE
#=*==========================================================================*=#
# ** END OF FILE
#=*==========================================================================*=#

Edited by efeberk

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×