#===== Rpg Makver VX ACE Script =============================
#= Simple Hud
#===== By: ==================================================
#= lilcooldude69
#===== Current Version: =====================================
#= 1.0
#===== Compatible With: =====================================
#= Rpg Maker VX ACE
#===== Description: =========================================
#= Sells items useful for 2-2 Classes
#===== Additional Comments: =================================
#=
#============================================================
module Hud_config
#Configuration
SWITCH = 13 #the number of the switched used to make it visible Example: if this is 1 then Switch 001 will turn on the hud.
EXPTERM = "Exp" #Term used for The Exp Bar
OPACITY = 70 #used for the opacity of the window, Mess with this to your liking
#end config
end
#=====DO NOT EDIT PAST HERE UNLESS YOU KNOW WHAT YOUR DOING======#
#=================EXCLUDING WHAT WAS SAID ABOVE==================#
include Hud_config
module Cache
#--------------------------------------------------------------------------
# * Get Icon Graphic
#--------------------------------------------------------------------------
def self.box_icon(filename)
load_bitmap("Graphics/#{CRYSTAL:

ARTY::ICON_FOLDER}/", filename)
end
end
#=====
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# * Icon in the Box
#--------------------------------------------------------------------------
def box_icon
if $imported["CE-Daycare&Egg"] && egg?
folder = "Graphics/#{CRYSTAL:

ARTY::ICON_FOLDER}/"
c = sprintf("icon%3.3dEgg", self.class.id)
if FileTest.exists?("#{folder}#{c}.png")
return c
else
return "iconEgg"
end
else
folder = "Graphics/#{CRYSTAL:

ARTY::ICON_FOLDER}/"
c = sprintf("icon%3.3d%s", self.class.id, @form == 0 ? "" : "_#{@form}")
if FileTest.exists?("#{folder}#{c}.png")
return c
else
c = sprintf("icon%3.3d", self.class.id,)
if FileTest.exists?("#{folder}#{c}.png")
return c
else
raise SyntaxError.new(sprintf("The class %s does not have an icon file for
it. Please make sure that you make one for it. Refer to Crystal Engine -
Party Menu for naming infromation.", self.class.name))
end
end
end
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Icon Graphic
#--------------------------------------------------------------------------
def draw_poke_icon(icon_name, x, y)
bitmap = Cache.box_icon(icon_name)
rect = Rect.new(0, 0, 64, 64)
contents.blt(x, y, bitmap, rect)
bitmap.dispose
end
end
class Window_Hud < Window_Base
#----------------------------------------------------
# * Object Initialization
#----------------------------------------------------
def initialize
super(0,0, 125,125)
create_contents
self.visible = $game_switches[sWITCH]
@actor = $game_party.members[0]
refresh
end
def exp_gauge_color1; text_color(31); end;
def exp_gauge_color2; text_color(27); end;
#----------------------------------------------------
# * Refresh
#----------------------------------------------------
def refresh
self.contents.clear
contents.clear
draw_window_content
end
#----------------------------------------------------
# * Draw Window Contents * Drawing of all the contents gold, hp bar, etc
#----------------------------------------------------
def draw_window_content
@level = @actor.level
@hp = @actor.hp
@exp = @actor.exp
@box_icon=@actor.box_icon
draw_poke_icon(@actor.box_icon, 0, 0)
contents.font.size = 20
draw_actor_name(@actor, 0, 0)
draw_actor_level(@actor, 45, 0)
draw_actor_hp(@actor, 0, 17, 48)
draw_exp(@actor, 0, 60, 102)
end
#-----------------------------------------------------
# * Update * used to keep things up to date
#-----------------------------------------------------
def update
super
self.visible = $game_switches[sWITCH]
return if !self.visible
if @level != @actor.level or @hp != @actor.hp or @exp != @actor.exp
refresh
end
end
#-----------------------------------------------------
# * Custom Definition for the experience bar free to use if you like
#-----------------------------------------------------
def draw_exp(poke, x, y, width = 124)
now_exp = poke.exp - poke.current_level_exp
next_exp = poke.next_level_exp - poke.current_level_exp
rate = now_exp * 1.0 / next_exp
fill_w = (width * rate).to_i
gauge_y = y + line_height - 8
contents.fill_rect(x, gauge_y, width, 6, Color.new(255,255,255))
contents.gradient_fill_rect(x, gauge_y, fill_w, 6, Color.new(24,144,248), Color.new(24,144,248))
change_color(system_color)
draw_text(x, y, 30, line_height, EXPTERM)
change_color(text_color(27))
if poke.max_level? ? draw_text(x + width - 72, y, 72, line_height, "------------", 2)
:
draw_text(x + width - 72, y, 72, line_height, poke.next_level_exp.to_i - poke.exp.to_i, 2)
end
end
end
#return if actor.max_level?
#------------------------------------------------------
# * Scene_Map Class, For keeping it on the map
#------------------------------------------------------
class Scene_Map < Scene_Base
alias start_window start
alias term_window terminate
alias update_window update
def start
start_window
@winhud = Window_Hud.new
update
end
def terminate
@winhud.dispose
term_window
end
def update
update_window
@winhud.update
end
end