#_______________________________________________________________________________
# MOG XAS Hud V2.2
# ENHANCEMENT V0.5
#_______________________________________________________________________________
# By Moghunter
# http://www.atelier-rgss.com
#_______________________________________________________________________________
# Enhanced with animated faces feature for BlizzABS by Subsonic_Noise
# http://www.google.de
#_______________________________________________________________________________
# My Enhancement just assigns faces to BlizzABS animation sprite, which means
# you can't have animations for actions which have animation sprites disabled
# You can define sprites that don't need a face at Window_Base.animated.
# I'll make an add. condition for _hit because BlizzABS doesn't use Hit Sprites.
#
# Thanks to:
# Blizzard for helping me with this script and not getting annoyed
# Aqua for telling me how to define variables^^ Yeah I'm a N00b.
#_______________________________________________________________________________
module XAS_HUD
#Position of the HUD
WINDOW_STATUS_X = 0
WINDOW_STATUS_Y = 370
#ID of the switch that disables the HUD
DISABLE_STATUS_HUD_SWITCH = 5
end
$mogscript = {} if $mogscript == nil
$mogscript["XAS_Hud"] = true
###############
# Window_Base #
###############
class Window_Base < Window
def animated
#Exceptions can be defined here
case $game_player.current_sprite[0, 4]
when '' then return '_fc'
when '_idl' then return '_fc'
when '_itm' then return '_fc'
end
#returns the current sprite for the draw_face method
return $game_player.current_sprite[0, 4]
end
def draw_maphp2(actor, x, y)
actor = $game_party.actors[0]
self.contents.font.size = 20
back = RPG::Cache.picture("BAR_Meter")
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, back, src_rect)
meter = RPG::Cache.picture("HP_Meter")
cw = meter.width * actor.hp / actor.maxhp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
text = RPG::Cache.picture("HP_Tx")
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 35, y - ch + 30, text, src_rect)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 111, y - 1, 48, 32, actor.hp.to_s, 2)
lowhp = actor.maxhp * 20 / 100
avhp = actor.maxhp * 50 / 100
if actor.hp <= lowhp
self.contents.font.color = Color.new(255,55,55,255)
elsif actor.hp <= avhp
self.contents.font.color = Color.new(255,255,55,255)
else
self.contents.font.color = Color.new(255,255,255,255)
end
self.contents.draw_text(x + 110, y - 2, 48, 32, actor.hp.to_s, 2)
end
def draw_mapsp2(actor, x, y)
self.contents.font.size = 20
back = RPG::Cache.picture("BAR_Meter")
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, back, src_rect)
meter = RPG::Cache.picture("SP_Meter")
cw = meter.width * actor.sp / actor.maxsp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
text = RPG::Cache.picture("SP_Tx")
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 40, y - ch + 30, text, src_rect)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 111, y - 1, 48, 32, actor.sp.to_s, 2)
self.contents.font.color = Color.new(250,255,255,255)
self.contents.draw_text(x + 110, y - 2, 48, 32, actor.sp.to_s, 2)
end
def draw_mexp(actor, x, y)
self.contents.font.size = 16
actor = $game_party.actors[0]
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
bitmap = RPG::Cache.picture("Exp_Meter")
if actor.level < 99
cw = bitmap.width * rate
else
cw = bitmap.width
end
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 40 , y - ch + 30, bitmap, src_rect)
bitmap2 = RPG::Cache.picture("Exp_Back")
cw = bitmap2.width
ch = bitmap2.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 40 , y - ch + 30, bitmap2, src_rect)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 55, y + 1, 84, 32, "Exp",0)
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x + 54, y, 84, 32, "Exp",0)
end
def nada
face = RPG::Cache.picture("")
end
def draw_heroface(actor,x,y)
face = RPG::Cache.picture(actor.name + animated) rescue nada
cw = face.width
ch = face.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, face, src_rect)
end
def draw_actor_statemap(actor, x, y, width = 100)
self.contents.font.size = 16
text = make_battler_state_text(actor, width, true)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 1, y + 1, width, 32, text)
self.contents.font.color = Color.new(250,255,255,255)
self.contents.draw_text(x, y, width, 32, text)
end
def draw_actor_levelmap(actor, x, y)
self.contents.font.size = 20
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.color = Color.new(50,255,250,255)
self.contents.draw_text(x + 1, y + 1, 32, 32, "Lv")
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 30, y, 24, 32, actor.level.to_s, 1)
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x + 31, y + 1, 24, 32, actor.level.to_s, 1)
end
end
##############
# Game_Actor #
##############
class Game_Actor < Game_Battler
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#####################
# Window_Status_Map #
#####################
class Window_HUD < Window_Base
def reset
@old_hp = @actor.hp
@old_sp = @actor.sp
@old_level = @actor.level
@old_state = @actor.states.to_s
@old_exp = @actor.exp
@old_face = $game_player.current_sprite[0, 4]
end
def initialize
super(0, 0, 240, 120)
self.contents = Bitmap.new(width - 32, height - 32)
self.windowskin = RPG::Cache.windowskin("")
self.contents.font.bold = true
self.contents.font.name = "Georgia"
self.opacity = 0
@actor = $game_party.actors[0]
if @actor != nil
reset
refresh
end
end
def refresh
self.contents.clear
draw_maphp2(@actor, 35, 35)
draw_mapsp2(@actor, - 40, 60)
draw_heroface(@actor, 0, 70)
draw_actor_statemap(@actor, 130, 60, 70)
draw_actor_levelmap(@actor, 80, 10)
draw_mexp(@actor, 90, 10)
reset
end
def update
@actor = $game_party.actors[0]
if @actor != nil
if @old_hp != @actor.hp or
@old_sp != @actor.sp or
@old_level != @actor.level or
@old_state != @actor.states.to_s or
@old_exp != @actor.exp or
@old_face != $game_player.current_sprite[0, 4]
refresh
end
end
end
end
###############
# Game_Player #
###############
class Game_Player2 < Game_Character
attr_accessor :wref
end
#############
# Scene_Map #
#############
class Scene_Map
alias mog11_main main
def main
@sthero = Window_HUD.new
@sthero.x = XAS_HUD::WINDOW_STATUS_X
@sthero.y = XAS_HUD::WINDOW_STATUS_Y
if $game_switches[XAS_HUD::DISABLE_STATUS_HUD_SWITCH] == false
@sthero.visible = true
else
@sthero.visible = false
end
mog11_main
@sthero.dispose
end
alias mog11_update update
def update
if $game_switches[XAS_HUD::DISABLE_STATUS_HUD_SWITCH] == false
@sthero.visible = true
else
@sthero.visible = false
end
@sthero.update
mog11_update
end
end