#==============================================================================
# ** HUD
#------------------------------------------------------------------------------
# Mr.Mo "Muhammet Sivri"
# Version 1.7
# 10.01.06
# Credit: Prexus for the Original Background. Axerax for edited HUD Background.
# Axerax for HUD Display and Mini-Map Backdrop HUD.
# Notes: Be sure you have the Selwyn Passability Mini-Map before trying to use
# this version of the HUD. As well follow steps provided by Selwyn in his script
# to display the Mini-Map itself, my HUD will not display it for you, it is only
# a backdrop that displays the name of the map you are currently on.
#==============================================================================
#-------------------------------------------------------------------------------
# Begin SDK Enabled Check
#-------------------------------------------------------------------------------
if SDK.state("Mr.Mo's ABS")
#--------------------------------------------------------------------------
# * Constants - MAKE YOUR EDITS HERE
#--------------------------------------------------------------------------
HP_X = 54 # X POS of the HP Bar
HP_Y = 3 # Y POS of the HP Bar
HP_WIDTH = 55 # WIDTH of the HP Bar
HP_HEIGHT = 5 # Height of the HP Bar
#--------------------------------------------------------------------------
SP_X = 54 # X POS of the SP Bar
SP_Y = 22 # Y POS of the SP Bar
SP_WIDTH = 55 # WIDTH of the SP Bar
SP_HEIGHT = 5 # Height of the SP Bar
#--------------------------------------------------------------------------
EXP_X = 55 # X POS of the EXP Bar
EXP_Y = 42 # Y POS of the EXP Bar
EXP_WIDTH = 60 # WIDTH of the EXP Bar
EXP_HEIGHT = 5 # Height of the EXP Bar
#--------------------------------------------------------------------------
STATES_SHOW = true # Show states?
STATES_X = 170 # States X display
STATES_Y = 430 # States Y display
#--------------------------------------------------------------------------
SHOW_DASH = true # Show dash bar?
DASH_X = 95 # X POS of the DASH Bar
DASH_Y = 430 # Y POS of the DASH Bar
DASH_WIDTH = 55 # WIDTH of the DASH Bar
DASH_HEIGHT = 5 # Height of the DASH Bar
DASH_BAR = "018-Simple03" # The file used for gradient
#--------------------------------------------------------------------------
SHOW_SNEAK = true # Show SNEAK bar?
SNEAK_X = 95 # X POS of the SNEAK Bar
SNEAK_Y = 445 # Y POS of the SNEAK Bar
SNEAK_WIDTH = 55 # WIDTH of the SNEAK Bar
SNEAK_HEIGHT = 5 # Height of the SNEAK Bar
SNEAK_BAR = "019-Simple04" # The file used for gradient
#--------------------------------------------------------------------------
LOW_HP = 150 # What HP should the low HP icon be shown?
#--------------------------------------------------------------------------
HP_ITEMID = 1 # POTION ITEM ID
SP_ITEMID = 4 # SP Increase Item ID
#--------------------------------------------------------------------------
class Window_MrMo_HUD < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(-16, -16, 700, 700)
#Record Old Data
@actor = $game_party.actors[0]
@old_hp = @actor.hp
@old_sp = @actor.sp
@old_exp = @actor.exp
@level = @actor.level
@hp_n = $game_party.item_number(HP_ITEMID)
@sp_n = $game_party.item_number(SP_ITEMID)
@gold_n = $game_party.gold
@states = @actor.states.to_s
@dash = $ABS.dash_min
@sneak = $ABS.sneak_min
#Create Bitmap
self.contents = Bitmap.new(width - 32, height - 32)
#Hide Window
self.opacity = 0
#Refresh
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.font.color = normal_color
self.contents.font.size = 12
#Record new data
@actor = $game_party.actors[0]
@old_hp = @actor.hp
@old_sp = @actor.sp
@old_exp = @actor.exp
@level = @actor.level
@hp_n = $game_party.item_number(HP_ITEMID)
@sp_n = $game_party.item_number(SP_ITEMID)
@gold_n = $game_party.gold
@states = @actor.states.to_s
@dash = $ABS.dash_min
@sneak = $ABS.sneak_min
@time = $kts.time.to_s
#Show the Pictures
bitmap = RPG::Cache.picture("HUD Graphic")
self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 175, 175))
bitmap = RPG::Cache.picture("HUD Display")
self.contents.blt(15, 380, bitmap, Rect.new(0, 0, 175, 175))
bitmap = RPG::Cache.picture("Mini-Map HUD")
self.contents.blt(493, 362.5, bitmap, Rect.new(0, 0, 175, 175))
bitmap = RPG::Cache.picture("HUD Time Display")
self.contents.blt(553.5, 338.5, bitmap, Rect.new(0, 0, 175, 175))
#Show Map Name
map_infos = load_data("Data/MapInfos.rxdata")
name = map_infos[$game_map.map_id].name.to_s
self.contents.draw_text(520, 455, 400, 32, name.to_s)
#Show the HP Symbol
bitmap = RPG::Cache.icon("HP Symbol")
self.contents.blt(0, -2, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(35, -9, 640, 32, "HP")
#Draw the HP BAR
draw_gradient_bar(HP_X, HP_Y, @actor.hp, @actor.maxhp, HP_BAR, HP_WIDTH, HP_HEIGHT)
#Show the SP Symbol
bitmap = RPG::Cache.icon("SP Symbol")
self.contents.blt(0, 18, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(35, 11, 640, 32, "SP")
#Draw the SP Bar
draw_gradient_bar(SP_X, SP_Y, @actor.sp, @actor.maxsp, SP_BAR, SP_WIDTH, SP_HEIGHT)
#Show the EXP Symbol
bitmap = RPG::Cache.icon("EXP Symbol")
self.contents.blt(0, 37, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(35, 30, 640, 32, "EXP")
#Draw the EXP Bar
min = @actor.level == 99 ? 1 : @actor.now_exp
max = @actor.level == 99 ? 1 : @actor.next_exp
draw_gradient_bar(EXP_X, EXP_Y, min, max, EXP_BAR, EXP_WIDTH, EXP_HEIGHT)
#Show Hero Icon
bitmap = RPG::Cache.icon("Hero")
self.contents.blt(2, 59, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(35, 49, 640, 32, "Hero:")
self.contents.draw_text(30, 59, 640, 32, @actor.name.to_s)
#Show Level Icon
bitmap = RPG::Cache.icon("Level")
self.contents.blt(2, 81, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(33, 72, 640, 32, "Level:")
self.contents.draw_text(43, 82, 640, 32, @actor.level.to_s)
#Show Gold Icon
bitmap = RPG::Cache.icon("Gold")
self.contents.blt(35, 390, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(30, 400, 640, 32, $game_party.gold.to_s)
#Show Clock
self.contents.font.color = system_color
self.contents.font.color = normal_color
self.contents.font.size = 14
self.contents.draw_text(570, 270, 175, 175, $kts.time.to_s)
#If the HP is too low
if @actor.hp.to_i <= LOW_HP
bitmap = RPG::Cache.icon("Skull")
self.contents.blt(130, 0, bitmap, Rect.new(0, 0, 24, 24))
end
#If the SP Item is more then 0
if $game_party.item_number(SP_ITEMID) > 0
bitmap = RPG::Cache.icon("SP Potion")
self.contents.blt(110, 20, bitmap, Rect.new(0, 0, 24, 24))
end
#if the HP Item is more then 0
if $game_party.item_number(HP_ITEMID) > 0
bitmap = RPG::Cache.icon("HP Potion")
self.contents.blt(110, 0, bitmap, Rect.new(0, 0, 24, 24))
end
return if !STATES_SHOW
#Draw States Background
n = -2
for id in @actor.states
state = $data_states[id]
next if state == nil
bitmap = RPG::Cache.picture("States Display")
x = (n*40) + 185
self.contents.blt(x, 50, bitmap, Rect.new(0, 0, 49, 58))
n += 1
end
#Draw States
n = -2
for id in @actor.states
state = $data_states[id]
next if state == nil
bitmap = RPG::Cache.icon(state.name+"_Icon")
x = (n*40) + +195
self.contents.blt(x, 65, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(x, 66.5, 49, 58, state.name.to_s)
n += 1
end
#Change font size
self.contents.font.size = 20
#Dash Bar
self.contents.draw_text(DASH_X - 40, DASH_Y-10, 40, 32, "") if SHOW_DASH
draw_gradient_bar(DASH_X, DASH_Y, $ABS.dash_min, $ABS.dash_max, DASH_BAR, DASH_WIDTH, DASH_HEIGHT) if SHOW_DASH
#SNEAK Bar
self.contents.draw_text(SNEAK_X - 40, SNEAK_Y-10, 40, 32, "") if SHOW_SNEAK
draw_gradient_bar(SNEAK_X, SNEAK_Y, $ABS.sneak_min, $ABS.sneak_max, SNEAK_BAR, SNEAK_WIDTH, SNEAK_HEIGHT) if SHOW_SNEAK
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
refresh if something_changed?
end
#--------------------------------------------------------------------------
# * Something Changed?
#--------------------------------------------------------------------------
def something_changed?
return false if Graphics.frame_count % 30 != 0
return true if @actor != $game_party.actors[0]
return true if @old_hp != @actor.hp or @old_sp != @actor.sp or @old_exp != @actor.exp
return true if @level != @actor.level
return true if @hp_n != $game_party.item_number(HP_ITEMID) or @sp_n != $game_party.item_number(SP_ITEMID)
return true if @gold_n != $game_party.gold
return true if @states.to_s != @actor.states.to_s
return true if @dash != $ABS.dash_min or @sneak != $ABS.sneak_min
return true if @time != $kts.time.to_s
return false
end
end
#==============================================================================
# * Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
alias mrmo_hud_main_draw main_draw
alias mrmo_hud_main_dispose main_dispose
alias mrmo_hud_update_graphics update_graphics
#--------------------------------------------------------------------------
# * Main Draw
#--------------------------------------------------------------------------
def main_draw
@mrmo_hud = Window_MrMo_HUD.new
mrmo_hud_main_draw
end
#--------------------------------------------------------------------------
# * Main Dispose
#--------------------------------------------------------------------------
def main_dispose
@mrmo_hud.dispose
mrmo_hud_main_dispose
end
#--------------------------------------------------------------------------
# * Update Graphics
#--------------------------------------------------------------------------
def update_graphics
mrmo_hud_update_graphics
@mrmo_hud.update
end
end
#--------------------------------------------------------------------------
# * SDK End
#--------------------------------------------------------------------------
end
#--------------------------------------------------------------------------
# * Load Gradient from RPG::Cache
#--------------------------------------------------------------------------
module RPG
module Cache
def self.gradient(filename, hue = 0)
self.load_bitmap("Graphics/Gradients/", filename, hue)
end
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# * Constants Bar Types and Hues for parameters and parameter names
#--------------------------------------------------------------------------
HP_BAR = "014-Reds01"
SP_BAR = "013-Blues01"
EXP_BAR = "015-Greens01"
ATK_BAR = "020-Metallic01"
PDEF_BAR = "020-Metallic01"
MDEF_BAR = "020-Metallic01"
STR_BAR = "020-Metallic01"
DEX_BAR = "020-Metallic01"
AGI_BAR = "020-Metallic01"
INT_BAR = "020-Metallic01"
HUES = [150,180,60,30,270,350,320]
STATS = ["atk","pdef","mdef","str","dex","agi","int"]
# leave this alone if you don't know what you are doing
OUTLINE = 1
BORDER = 1
#--------------------------------------------------------------------------
# * Draw Gradient Bar
#--------------------------------------------------------------------------
def draw_gradient_bar(x, y, min, max, file, width = nil, height = nil, hue = 0, back = "Back", back2 = "Back2")
bar = RPG::Cache.gradient(file, hue)
back = RPG::Cache.gradient(back)
back2 = RPG::Cache.gradient(back2)
cx = BORDER
cy = BORDER
dx = OUTLINE
dy = OUTLINE
zoom_x = width != nil ? width : back.width
zoom_y = height != nil ? height : back.height
percent = min / max.to_f if max != 0
percent = 0 if max == 0
back_dest_rect = Rect.new(x,y,zoom_x,zoom_y)
back2_dest_rect = Rect.new(x+dx,y+dy,zoom_x -dx*2,zoom_y-dy*2)
bar_dest_rect = Rect.new(x+cx,y+cy,zoom_x * percent-cx*2,zoom_y-cy*2)
back_source_rect = Rect.new(0,0,back.width,back.height)
back2_source_rect = Rect.new(0,0,back2.width,back2.height)
bar_source_rect = Rect.new(0,0,bar.width* percent,bar.height)
self.contents.stretch_blt(back_dest_rect, back, back_source_rect)
self.contents.stretch_blt(back2_dest_rect, back2, back2_source_rect)
self.contents.stretch_blt(bar_dest_rect, bar, bar_source_rect)
end
def draw_vertical_gradient_bar(x, y, min, max, file, width = nil, height = nil, hue = 0, back = "Back", back2 = "Back2")
bar = RPG::Cache.gradient(file, hue)
back = RPG::Cache.gradient(back)
back2 = RPG::Cache.gradient(back2)
cx = BORDER
cy = BORDER
dx = OUTLINE
dy = OUTLINE
zoom_x = width != nil ? width : back.width
zoom_y = height != nil ? height : back.height
percent = min / max.to_f if max != 0
percent = 0 if max == 0
bar_y = (zoom_y - zoom_y * percent).ceil
source_y = bar.height - bar.height * percent
back_dest_rect = Rect.new(x,y,zoom_x,zoom_y)
back2_dest_rect = Rect.new(x+dx,y+dy,zoom_x -dx*2,zoom_y-dy*2)
bar_dest_rect = Rect.new(x+cx,y+bar_y+cy,zoom_x-cx*2,(zoom_y * percent).to_i-cy*2)
back_source_rect = Rect.new(0,0,back.width,back.height)
back2_source_rect = Rect.new(0,0,back2.width,back2.height)
bar_source_rect = Rect.new(0,source_y,bar.width,bar.height * percent)
self.contents.stretch_blt(back_dest_rect, back, back_source_rect)
self.contents.stretch_blt(back2_dest_rect, back2, back2_source_rect)
self.contents.stretch_blt(bar_dest_rect, bar, bar_source_rect)
end
#--------------------------------------------------------------------------
# * Draw HP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
alias trick_draw_actor_hp draw_actor_hp
def draw_actor_hp(actor, x, y, width = 144)
# Calculate if there is draw space for MaxHP
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
width = hp_x - x
width += $game_temp.in_battle ? 50 : 100
# Draw HP
draw_gradient_bar(x, y + 16, actor.hp, actor.maxhp, HP_BAR, width, 8)
trick_draw_actor_hp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw SP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
alias trick_draw_actor_sp draw_actor_sp
def draw_actor_sp(actor, x, y, width = 144)
# Calculate if there is draw space for MaxHP
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
width = sp_x - x
width += $game_temp.in_battle ? 50 : 100
# Draw SP
draw_gradient_bar(x, y + 16, actor.sp, actor.maxsp, SP_BAR, width, 8)
trick_draw_actor_sp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw Exp
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
alias trick_bars_base_exp draw_actor_exp
def draw_actor_exp(actor, x, y)
min = actor.level == 99 ? 1 : actor.now_exp
max = actor.level == 99 ? 1 : actor.next_exp
draw_gradient_bar(x, y + 16, min, max, EXP_BAR, 192, 8)
trick_bars_base_exp(actor, x, y)
end
#--------------------------------------------------------------------------
# * Draw Parameter
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# type : draw which parameter
#--------------------------------------------------------------------------
alias trick_bars_base_parameter draw_actor_parameter
def draw_actor_parameter(actor, x, y, type)
hue = HUES[type]
stat = eval("actor.#{STATS[type]}")
bar_type = eval("#{STATS[type].upcase}_BAR")
draw_gradient_bar(x, y + 18, stat, 999, bar_type, 190, 8, hue)
trick_bars_base_parameter(actor, x, y, type)
end
end
class Game_Actor
#--------------------------------------------------------------------------
# * Get the current EXP
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Get the next level's EXP
#--------------------------------------------------------------------------
def next_exp
exp = @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
return exp
end
end
Expand to see the code.