CODE
#==============================================================================
# **Basic Hud w/all information
# *Author: lilcooldude69
#------------------------------------------------------------------------------
# P.S. this is my first script so be nice :c
#==============================================================================
#==============================================================================
class Game_Actor
def maxexp
return @exp_list[@level +1]
end
end
class Window_Noobhud < Window_Base
Switch = 1 # Switch = "number of the switch to turn off the hud or turn it on"
Exp = "E" # Exp = "Experience term"
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 192, 160)
create_contents
self.visible = $game_switches[Switch]
@actor = $game_party.members[0]
refresh
end
def draw_actor_exp_gauge(actor, x, y, width = 120)
gw = width * actor.exp / actor.maxexp
gc1 = text_color(21) # Exp bar color 1
gc2 = text_color(17) # Exp bar color 2
self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
end
def draw_actor_exp(actor, x, y, width = 30)
self.contents.font.color = system_color
self.contents.draw_text(x, y, width, WLH, Exp)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
self.back_opacity = 70
@name = @actor.name
@level = @actor.level
@hp = @actor.hp
@mp = @actor.mp
@exp = @actor.exp
@gold = $game_party.gold
@face = [@actor.face_name, @actor.face_index]
# comment out (# at the start of the line) if you don't want them to appear
draw_actor_face_picture(@actor, 0, 0, 100, 94) # Actor face
draw_actor_name(@actor, 0, 0) # Actor name
draw_actor_level(@actor, 0, 20) # Actor level
draw_actor_exp_gauge(@actor, 0, 72, 160) # Exp bar
draw_actor_exp(@actor, 0, 72, 30) # Exp term
draw_currency_value(@gold, 0, 50, 160) # Money
draw_actor_hp_gauge(@actor, 60, 0, 100) # Hp bar
draw_actor_hp(@actor, 60, 0, 100) # Hp term
draw_actor_mp_gauge(@actor, 60, 20, 100) # Mp bar
draw_actor_mp(@actor, 60, 20, 100) # Mp term
draw_actor_graphic(@actor, 16, 128) # Actor sprite
draw_actor_state(@actor, 40, 100, 96) # Actor states
# -------------------------------------------------------------------------
end
def draw_actor_face_picture(actor, x, y, opacity, size = 94)
bitmap = Cache.face(actor.face_name)
rect = Rect.new(0, 0, 0, 0)
rect.x = actor.face_index % 4 * 96 + (96 - size) / 2
rect.y = actor.face_index / 4 * 96 + (96 - size) / 2
rect.width = size
rect.height = size
self.contents.blt(x, y, bitmap, rect, opacity)
bitmap.dispose
end
#--------------------------------------------------------------------------
# * Update keeps things upto date and refreshes the data
#--------------------------------------------------------------------------
def update
self.visible = $game_switches[Switch]
return if !self.visible
if @level != @actor.level or @hp != @actor.hp or @exp != @actor.exp or
@mp != @actor.mp or @gold != $game_party.gold
refresh
end
end
end
#--------------------------------------------------------------------------
# * Scene_Map to keep it on when you turn it on
#--------------------------------------------------------------------------
class Scene_Map < Scene_Base
alias start_window start
alias term_window terminate
alias update_window update
def start
start_window
@winhud = Window_Noobhud.new
end
def terminate
@winhud.dispose
term_window
end
def update
update_window
@winhud.update
end
end