Guest Access
Go to page : 1, 2, 3
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
I've been working on this feature for quite some time...
a special thanks of support to Hackel and Falcao for
helpin' a brotha out ^,^ danke and gracias
also thanks to albertfish for helping out with the math on
positioning the hud to line up correctly with each enemy.
this script is fully customizable to show:
a digital counter (hemming text style)
script drawn gradient bars (no graphics required)
graphics bars (use your own graphics)
for the HP and SP of each XAS enemy!
AND a name feature to show each enemy's name.
and get this...
it appears once you are within a certain range in which you can adjust by a simple edit to the script.
XAS E-mini HUD V1.6 (window_base version)
(warning! lag detected)
special thanks to Hackel, Falcao, and Albertfish
-----------------------------------------------------------------------------
XAS E-mini HUD V2.0 (Sprite class version)
(no lag, unless using the name and numbers feature)
special thanks to Mr_Wiggles and Albertfish
-----------------------------------------
XAS 3.91 version
a special thanks of support to Hackel and Falcao for
helpin' a brotha out ^,^ danke and gracias
also thanks to albertfish for helping out with the math on
positioning the hud to line up correctly with each enemy.
this script is fully customizable to show:
a digital counter (hemming text style)
script drawn gradient bars (no graphics required)
graphics bars (use your own graphics)
for the HP and SP of each XAS enemy!
AND a name feature to show each enemy's name.
and get this...
it appears once you are within a certain range in which you can adjust by a simple edit to the script.
XAS E-mini HUD V1.6 (window_base version)
(warning! lag detected)
special thanks to Hackel, Falcao, and Albertfish
- Spoiler:
- Code:
################################################################################
# XAS Enemy HP Counter v1.6 by gameface101 - 1/31/2011 (less lag - working on it
################################################################################
module XAS_Emini_HUD
#DISPLAY SETTINGS ==========================================================
PRESS_HOLD = Input::A#press first
TRIGGER_HUD = Input::B#trigger second
DISABLE_SWITCH = 1#on or off by assigned switch
VISIBLE_DEF = false#default visibility
RANGE = 5#appear based of distance from enemy
#NAME OPTIONS ==============================================================
NAME = true# use name
NAME_SIZE = 12#font size
NAME_X = 13#horizontal position
NAME_Y = 46#vertical position
#DRAW OPTIONS ==============================================================
DRAW_BARS = true # display script drawn gradient bars
DRAW_HP_X = 11#horizontal position
DRAW_HP_Y = 46#vertical position
DRAW_HP_WID = 40#bar width
DRAW_HP_HET = 6#bar hieght
DRAW_SP_X = 11#horizontal position
DRAW_SP_Y = 52#vertical position
DRAW_SP_WID = 40#bar width
DRAW_SP_HET = 6#bar hieght
#PICTURE OPTIONS
BAR_PIX = false #use grapihcs for bars on/off
HP_BACK = "mini_back"
HP_BAR = "mini_hp"
SP_BACK = "mini_back2"
SP_BAR = "mini_sp"
PIX_X = -20
PIX_Y = -60
#NUMBER OPTIONS ============================================================
NUMBERS = true #use numbers for enemy HP, SP on/off
NUM_SIZE = 14
NUM_X = 40#
NUM_Y = 36#
end
#=========================================================================[class
class Window_Base < Window
include XAS_Emini_HUD
def draw_hmini_hud_bar(x, y, min, max, width = 152, height = 6,
bar_color = Color.new(150, 0, 0, 255),
end_color = Color.new(255, 255, 60, 255))
for i in 0..height
self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
end
#-------------------------------------------------------------------------------
for i in 1..(height - 1)
r = 100 * (height - i) / height + 0 * i / height
g = 100 * (height - i) / height + 0 * i / height
b = 100 * (height - i) / height + 0 * i / height
a = 255 * (height - i) / height + 255 * i / height
self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
end
#-------------------------------------------------------------------------------
for i in 1..( (min / max.to_f) * width - 1)
for j in 1..(height - 1)
r = bar_color.red * (width - i) / width + end_color.red * i / width
g = bar_color.green * (width - i) / width + end_color.green * i / width
b = bar_color.blue * (width - i) / width + end_color.blue * i / width
a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
end
end
end
#======================================================================[for loop
def e_mini_hud
for event in $game_map.events.values #for events
if event.battler != nil #if event.battler method will not equal nothing
unless XAS_BA_ENEMY::ENEMY_OBJECT.include?(event.battler.id) or XAS_BA_ENEMY::ITEM_ENEMY.include?(event.battler.id)
dis = ($game_player.x - event.x).abs + ($game_player.y - event.y).abs
if dis <= RANGE
x = (event.real_x - $game_map.display_x) / 4
y = (event.real_y - $game_map.display_y) / 4
#==========================================================================[name
if NAME == true
self.contents.font.color.set(0, 0, 0)#black
self.contents.font.size = NAME_SIZE
self.contents.draw_text(x + NAME_X - 1, y + NAME_Y - 1, 160, 32, event.battler.name, 0)
self.contents.draw_text(x + NAME_X - 1, y + NAME_Y + 2, 160, 32, event.battler.name, 0)
self.contents.draw_text(x + NAME_X + 1, y + NAME_Y - 1, 160, 32, event.battler.name, 0)
self.contents.draw_text(x + NAME_X + 1, y + NAME_Y + 2, 160, 32, event.battler.name, 0)
self.contents.font.color = normal_color
self.contents.draw_text(x + NAME_X, y + NAME_Y, 160, 32, event.battler.name, 0)
end
#============================================================[draw gradient bars
if DRAW_BARS == true
draw_hmini_hud_bar(x + DRAW_HP_X,y + DRAW_HP_Y,event.battler.hp,event.battler.maxhp,width=DRAW_HP_WID,height=DRAW_HP_HET,bar_color = Color.new(255,0,0,255),end_color = Color.new(100,0,0,255))
draw_hmini_hud_bar(x + DRAW_SP_X,y + DRAW_SP_Y,event.battler.sp,event.battler.maxsp,width=DRAW_SP_WID,height=DRAW_SP_HET,bar_color = Color.new(100,0,255,255),end_color = Color.new(50,0,100,255))
end
#=========================================================[use graphics for bars
if BAR_PIX == true
back = RPG::Cache.picture(HP_BACK)
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + PIX_X, y - 4 + PIX_Y, back, src_rect)
meter = RPG::Cache.picture(HP_BAR)
cw = meter.width * event.battler.hp / event.battler.maxhp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + PIX_X, y - 4 + PIX_Y , meter, src_rect)
if event.battler.maxsp > 0
back2 = RPG::Cache.picture(SP_BACK)
cw = back2.width
ch = back2.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + PIX_X, y + PIX_Y, back2, src_rect)
meter = RPG::Cache.picture(SP_BAR)
cw = meter.width * event.battler.sp / event.battler.maxsp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + PIX_X, y + PIX_Y, meter, src_rect)
end
end
#=======================================================================[numbers
if NUMBERS == true
self.contents.font.size = NUM_SIZE
self.contents.font.name = "Arial"
self.contents.font.color = Color.new(0,0,0,255)#black
self.contents.draw_text(x + NUM_X, y + NUM_Y , 28, 22, event.battler.hp.to_s, 2)
lowhp = event.battler.maxhp * 20 / 100
avhp = event.battler.maxhp * 50 / 100
if event.battler.hp <= lowhp
self.contents.font.color = Color.new(232,8,0,255)#red
elsif event.battler.hp <= avhp
self.contents.font.color = Color.new(253,241,7,255)#yellow
else
self.contents.font.color = Color.new(96,224,82,255)#green
end
self.contents.draw_text(x + NUM_X, y + NUM_Y , 29, 23,event.battler.hp.to_s, 2)
self.contents.font.size = 12
if event.battler.maxsp > 0
self.contents.font.name = "Arial"
self.contents.font.color = Color.new(0,0,0,255)#black
self.contents.draw_text(x + NUM_X, y + NUM_Y , 28, 42, event.battler.sp.to_s, 2)
lowsp = event.battler.maxsp * 20 / 100
avsp = event.battler.maxsp * 50 / 100
if event.battler.sp <= lowsp
self.contents.font.color = Color.new(194,210,255,255)#light blue
elsif event.battler.sp <= avsp
self.contents.font.color = Color.new(92,130,255,255)#medium blue
else
self.contents.font.color = Color.new(223,204,178,255)#pale
end
self.contents.draw_text(x + NUM_X , y + NUM_Y , 29, 43,event.battler.sp.to_s, 2)
end
end
end
end
end
end
end
end
#=========================================================================[class
class Window_EHP < Window_Base
include XAS_Emini_HUD
def initialize
super(-32, -32, 672, 532)
self.visible = (VISIBLE_DEF)
self.contents = Bitmap.new(width - 32, height - 32)
self.windowskin = RPG::Cache.windowskin("")
self.contents.font.bold = true
self.contents.font.name = "Arial"
self.opacity = 0
refresh
end
#----------------------------------------------------------------[refresh method
def refresh
self.contents.clear
e_mini_hud
end
#def update
# refresh
#end
end
#=========================================================================[class
class Scene_Map
include XAS_Emini_HUD
alias mohud_main main
def main
@hpenemy = Window_EHP.new
if $game_switches[DISABLE_SWITCH] == false
@hpenemy.visible = true
else
@hpenemy.visible = false
end
mohud_main
@hpenemy.dispose
end
alias mohud_update update
def update
if @hpenemy.visible == true and Input.press?(PRESS_HOLD) and Input.trigger?(TRIGGER_HUD)
@hpenemy.visible = false
elsif @hpenemy.visible == false and Input.press?(PRESS_HOLD) and Input.trigger?(TRIGGER_HUD)
@hpenemy.visible = true
end
@hpenemy.update
mohud_update
@hpenemy.update if @hpenemy.visible == true
@hpenemy.refresh if @hpenemy.visible == true
end
end
-----------------------------------------------------------------------------
XAS E-mini HUD V2.0 (Sprite class version)
(no lag, unless using the name and numbers feature)
special thanks to Mr_Wiggles and Albertfish
- Spoiler:
- Code:
#===============================================================================
# XAS E_mini HUD v2.0 by gameface101, mr_wiggles, albertfish 2/4/2011 ==========
#===============================================================================
module XAS_emini_hud
VISIBLE_DEF = false
RANGE = 5
#DRAW OPTIONS ==================================================================
DRAW_BARS = true # display script drawn gradient bars
DHP_X = 0#horizontal position
DHP_Y = 26#vertical position
DHP_WID = 40#bar width
DHP_HET = 4#bar hieght
DSP_X = 0#horizontal position
DSP_Y = 32#vertical position
DSP_WID = 40#bar width
DSP_HET = 4#bar hieght
#NAME OPTIONS ==================================================================
NAME = false# use name (causes lag)
NAME_SIZE = 12#font size
N_X = -60#horizontal position
N_Y = 24#vertical position
#NUMBER OPTIONS ================================================================
NUMBERS = false #use numbers for enemy HP, SP on/off (causes lag)
NUM_SIZE = 12
NUM_X = 24#
NUM_Y = 15#
end
#===============================================================================
class Enemy_Bars < RPG::Sprite
include XAS_emini_hud
def initialize(enemy, viewport)
super(viewport)
@enemy = enemy
@battler = @enemy.battler
@old_hp = 0
@old_sp = 0
@old_vis = false
self.bitmap = Bitmap.new(100, 100)
self.visible = (VISIBLE_DEF)#false
self.z = 100
update
end
#-------------------------------------------------------------------------------
def refresh
return if @old_hp == @battler.hp and @old_vis != self.visible
self.bitmap.clear
@old_vis = self.visible
@old_sp = @battler.sp
@old_hp = @battler.hp
#=====================================================================[DRAW BARS
if DRAW_BARS == true
draw_hmini_hud_bar(DHP_X, DHP_Y, @battler.hp, @battler.maxhp,
width = DHP_WID, height = DHP_HET, bar_color = Color.new(255,0,0,255) ,
end_color = Color.new(100,0,0,255))
draw_hmini_hud_bar(DSP_X, DSP_Y, @battler.sp, @battler.maxsp,
width = DSP_WID, height = DSP_HET, bar_color = Color.new(100,0,255,255),
end_color = Color.new(50,0,100,255))
#=====================================================================[DRAW NAME
if NAME == true
self.bitmap.font = Font.new("Arial", NAME_SIZE)
self.bitmap.draw_hemming_text(N_X, N_Y, 160, 36, @battler.name, 1)
#=======================================================================[numbers
if NUMBERS == true
self.bitmap.font.size = NUM_SIZE
self.bitmap.font.color = Color.new(0,0,0,255)#black
self.bitmap.draw_hemming_text(NUM_X, NUM_Y , 28, 22, @battler.hp.to_s, 2)
lowhp = @battler.maxhp * 20 / 100
avhp = @battler.maxhp * 50 / 100
if @battler.hp <= lowhp
self.bitmap.font.color = Color.new(232,8,0,255)#red
elsif @battler.hp <= avhp
self.bitmap.font.color = Color.new(253,241,7,255)#yellow
else
self.bitmap.font.color = Color.new(96,224,82,255)#green
end
self.bitmap.draw_hemming_text(NUM_X, NUM_Y , 29, 23,@battler.hp.to_s, 2)
self.bitmap.font.size = 12
if @battler.maxsp > 0
self.bitmap.font.name = "Arial"
self.bitmap.font.color = Color.new(0,0,0,255)#black
self.bitmap.draw_hemming_text(NUM_X, NUM_Y , 28, 42, @battler.sp.to_s, 2)
lowsp = @battler.maxsp * 20 / 100
avsp = @battler.maxsp * 50 / 100
if @battler.sp <= lowsp
self.bitmap.font.color = Color.new(194,210,255,255)#light blue
elsif @battler.sp <= avsp
self.bitmap.font.color = Color.new(92,130,255,255)#medium blue
else
self.bitmap.font.color = Color.new(223,204,178,255)#pale
end
self.bitmap.draw_hemming_text(NUM_X , NUM_Y , 29, 43,@battler.sp.to_s, 2)
end
end
end#name
end#draw
#===============================================================================
end#end refresh method
#-------------------------------------------------------------------------------
def update
@battler = @enemy.battler
return dispose if @enemy.dead? or $game_map.events.values[@enemy.id].nil?
if self.visible
refresh
else
self.bitmap.clear
end
end
#-------------------------------------------------------------------------------
def draw_hmini_hud_bar(x, y, min, max, width = 152, height = 6,
bar_color = Color.new(150, 0, 0, 255),
end_color = Color.new(255, 255, 60, 255))
for i in 0..height
self.bitmap.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
end
#-------------------------------------------------------------------------------
for i in 1..(height - 1)
r = 100 * (height - i) / height + 0 * i / height
g = 100 * (height - i) / height + 0 * i / height
b = 100 * (height - i) / height + 0 * i / height
a = 255 * (height - i) / height + 255 * i / height
self.bitmap.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
end
#-------------------------------------------------------------------------------
for i in 1..( (min / max.to_f) * width - 1)
for j in 1..(height - 1)
r = bar_color.red * (width - i) / width + end_color.red * i / width
g = bar_color.green * (width - i) / width + end_color.green * i / width
b = bar_color.blue * (width - i) / width + end_color.blue * i / width
a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
self.bitmap.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
end
end
end
end
#===============================================================================
class Sprite_Character < RPG::Sprite
#-------------------------------------------------------------------------------
alias :xas_emini_hud_init :initialize
include XAS_emini_hud
def initialize(viewport, character)
xas_emini_hud_init(viewport, character)
@viewport = viewport
return if @character.battler.nil?
return if XAS_BA_ENEMY::ENEMY_OBJECT.include?(@character.battler.id)
return if XAS_BA_ENEMY::ITEM_ENEMY.include?(@character.battler.id)
return if @character.battler.is_a?(Game_Actor)
@bars = Enemy_Bars.new(@character, @viewport)
end
#-------------------------------------------------------------------------------
alias :xas_emini_hud_up :update
def update
xas_emini_hud_up
return if @bars.nil?
return if @bars.disposed?
dis = ($game_player.x - @character.x).abs + ($game_player.y - @character.y).abs
@bars.visible = (dis <= RANGE)
if @bars.visible
@bars.x = @character.screen_x - @cw / 4
@bars.y = @character.screen_y - @ch / 4
end
@bars.update
end
#-------------------------------------------------------------------------------
def dispose
super
@bars.dispose if !@bars.nil?
end
end
-----------------------------------------
XAS 3.91 version
- Spoiler:
- Code:
#===============================================================================
# XAS E_mini HUD v2.2 for XAS 3.91 by gameface101 4/29/2011
# special thanks to mr_wiggles, albertfish, LiTTleDRAgo for RGSS support
#===============================================================================
module XAS_emini_hud
VISIBLE_DEF = false
RANGE = 5
#================================ DRAW OPTIONS =================================
DRAW_BARS = true # display script drawn gradient bars
DHP_X = 0 # horizontal position
DHP_Y = 26 # vertical position
DHP_WID = 40 # bar width
DHP_HET = 4 # bar hieght
DSP_X = 0 # horizontal position
DSP_Y = 32 # vertical position
DSP_WID = 40 # bar width
DSP_HET = 4 # bar hieght
#================================ NAME OPTIONS =================================
NAME = true # use name (won't lagg)
NAME_SIZE = 12 # font size
N_X = -60 # horizontal position
N_Y = 24 # vertical position
#================================NUMBER OPTIONS ================================
NUMBERS = true # use numbers for enemy HP, SP on/off (won't lagg)
NUM_SIZE = 12
NUM_X = 24 #
NUM_Y = 15 #
XAS_39 = true # Set to true if XAS 3.9.x
end
#===============================================================================
class Enemy_Bars < RPG::Sprite
def initialize(enemy)
super(Viewport.new(0, 0, 640, 480))
@enemy = enemy
@battler = @enemy.battler
@old_vis = false
self.bitmap = Bitmap.new(100, 100)
self.visible = (XAS_emini_hud::VISIBLE_DEF)
self.z = 1
@name_sprite, @hp_sprite, @sp_sprite, @hp_bar,
@sp_bar = Sprite.new, Sprite.new, Sprite.new, Sprite.new, Sprite.new
@name_sprite.bitmap = Bitmap.new(100,280)
@hp_sprite.bitmap = Bitmap.new(100,280)
@sp_sprite.bitmap = Bitmap.new(100,280)
@hp_bar.bitmap = Bitmap.new(100,280)
@sp_bar.bitmap = Bitmap.new(100,280)
[@name_sprite, @hp_sprite, @sp_sprite, @hp_bar,
@sp_bar].each {|i| i.visible = self.visible}
[@name_sprite].each {|i| i.z = self.z+2}
[@hp_sprite, @sp_sprite].each {|i| i.z = self.z+1}
[@hp_bar, @sp_bar].each {|i| i.z = self.z}
refresh
update
end
def refresh
return if @old_hp == @battler.hp and @old_sp == @battler.sp
if @old_hp != @battler.hp
@old_hp = @battler.hp
@hp_bar.bitmap.clear
draw_hp_hud_bar(DHP_X, DHP_Y, @battler.hp, @battler.maxhp,
DHP_WID, DHP_HET, Color.new(255,0,0,255),
Color.new(100,0,0,255)) if XAS_emini_hud::DRAW_BARS
if XAS_emini_hud::NUMBERS
@hp_sprite.bitmap.clear
@hp_sprite.bitmap.font.size = XAS_emini_hud::NUM_SIZE
@hp_sprite.bitmap.font.color = Color.new(0,0,0,255)#black
if @battler.hp <= (@battler.maxhp * 20 / 100)
@hp_sprite.bitmap.font.color = Color.new(232,8,0,255)#red
elsif @battler.hp <= (@battler.maxhp * 50 / 100)
@hp_sprite.bitmap.font.color = Color.new(253,241,7,255)#yellow
else
@hp_sprite.bitmap.font.color = Color.new(96,224,82,255)#green
end
@hp_sprite.bitmap.draw_hemming_text(NUM_X, NUM_Y , 29, 23,
@battler.hp.to_s, 2)
@hp_sprite.bitmap.font.size = 12
end
end
if @battler.maxsp > 0 && @old_sp != @battler.sp
@old_sp = @battler.sp
@sp_bar.bitmap.clear
draw_sp_hud_bar(DSP_X, DSP_Y, @battler.sp, @battler.maxsp,
DSP_WID,DSP_HET, Color.new(100,0,255,255),
Color.new(50,0,100,255)) if XAS_emini_hud::DRAW_BARS
if XAS_emini_hud::NUMBERS
@sp_sprite.bitmap.clear
@sp_sprite.bitmap.font.size = XAS_emini_hud::NUM_SIZE
@sp_sprite.bitmap.font.color = Color.new(0,0,0,255)#black
if @battler.sp <= (@battler.maxsp * 20 / 100)
@sp_sprite.bitmap.font.color = Color.new(194,210,255,255)#light blue
elsif @battler.sp <= (@battler.maxsp * 50 / 100)
@sp_sprite.bitmap.font.color = Color.new(92,130,255,255)#medium blue
else
@sp_sprite.bitmap.font.color = Color.new(223,204,178,255)#pale
end
@sp_sprite.bitmap.draw_hemming_text(NUM_X, NUM_Y, 29, 43,
@battler.sp.to_s, 2)
end
end
if @old_name != @battler.name && XAS_emini_hud::NAME
@old_name = @battler.name
@name_sprite.bitmap.clear
@name_sprite.bitmap.font = Font.new("Arial", XAS_emini_hud::NAME_SIZE)
@name_sprite.bitmap.draw_hemming_text(N_X, N_Y, 160, 36, @battler.name, 1)
end
@old_vis = self.visible
[@name_sprite, @hp_sprite, @sp_sprite, @hp_bar,
@sp_bar].each {|i| i.visible = self.visible}
end
def update
@battler = @enemy.battler
if @enemy.dead? or @enemy.erased or $game_map.events.values[@enemy.id].nil?
dispose
return
end
refresh if self.visible
[@name_sprite, @hp_sprite, @sp_sprite, @hp_bar,
@sp_bar].each {|i| i.x = self.x}
[@name_sprite, @hp_sprite, @sp_sprite, @hp_bar,
@sp_bar].each {|i| i.y = self.y}
end
def draw_hp_hud_bar(x, y, min, max, width = 152, height = 6,
bar_color = Color.new(150, 0, 0, 255),
end_color = Color.new(255, 255, 60, 255))
for i in 0..height
@hp_bar.bitmap.fill_rect(x+i,y+height-i,width+1, 1, Color.new(50, 50, 50, 255))
end
for i in 1..(height - 1)
r = 100 * (height - i) / height + 0 * i / height
g = 100 * (height - i) / height + 0 * i / height
b = 100 * (height - i) / height + 0 * i / height
a = 255 * (height - i) / height + 255 * i / height
@hp_bar.bitmap.fill_rect(x+i,y+height-i, width, 1, Color.new(r, b, g, a))
end
for i in 1..( (min / max.to_f) * width - 1)
for j in 1..(height - 1)
r = bar_color.red * (width - i) / width + end_color.red * i / width
g = bar_color.green * (width - i) / width + end_color.green * i / width
b = bar_color.blue * (width - i) / width + end_color.blue * i / width
a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
@hp_bar.bitmap.fill_rect(x+i+j, y+height-j, 1, 1, Color.new(r, g, b, a))
end
end
end
def draw_sp_hud_bar(x, y, min, max, width = 152, height = 6,
bar_color = Color.new(150, 0, 0, 255),
end_color = Color.new(255, 255, 60, 255))
for i in 0..height
@sp_bar.bitmap.fill_rect(x+i,y+height-i,width+1, 1, Color.new(50, 50, 50, 255))
end
for i in 1..(height - 1)
r = 100 * (height - i) / height + 0 * i / height
g = 100 * (height - i) / height + 0 * i / height
b = 100 * (height - i) / height + 0 * i / height
a = 255 * (height - i) / height + 255 * i / height
@sp_bar.bitmap.fill_rect(x+i,y+height-i, width, 1, Color.new(r, b, g, a))
end
for i in 1..( (min / max.to_f) * width - 1)
for j in 1..(height - 1)
r = bar_color.red * (width - i) / width + end_color.red * i / width
g = bar_color.green * (width - i) / width + end_color.green * i / width
b = bar_color.blue * (width - i) / width + end_color.blue * i / width
a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
@sp_bar.bitmap.fill_rect(x+i+j, y+height-j, 1, 1, Color.new(r, g, b, a))
end
end
end
def dispose
super
[@name_sprite, @hp_sprite, @sp_sprite, @hp_bar,
@sp_bar].each {|i| i.dispose if i != nil && !i.disposed?}
[@name_sprite, @hp_sprite, @sp_sprite, @hp_bar,
@sp_bar].each {|i| i.bitmap.dispose if i.bitmap != nil && !i.bitmap.disposed?}
end
def opac=(x)
[@name_sprite, @hp_sprite, @sp_sprite, @hp_bar,
@sp_bar].each {|i| i.opacity = x}
end
def vis=(val)
[@name_sprite, @hp_sprite, @sp_sprite, @hp_bar,
@sp_bar].each {|i| i.visible = val}
end
DHP_X = XAS_emini_hud::DHP_X
DHP_Y = XAS_emini_hud::DHP_Y
DHP_WID = XAS_emini_hud::DHP_WID
DHP_HET = XAS_emini_hud::DHP_HET
DSP_X = XAS_emini_hud::DSP_X
DSP_Y = XAS_emini_hud::DSP_Y
DSP_WID = XAS_emini_hud::DSP_WID
DSP_HET = XAS_emini_hud::DSP_HET
N_X = XAS_emini_hud::N_X
N_Y = XAS_emini_hud::N_Y
NUM_X = XAS_emini_hud::NUM_X
NUM_Y = XAS_emini_hud::NUM_Y
end
#===============================================================================
class Sprite_Character < RPG::Sprite
#-------------------------------------------------------------------------------
alias :xas_emini_hud_init :initialize
alias :xas_emini_hud_up :update
def initialize(viewport, character)
xas_emini_hud_init(viewport, character)
return if @character.battler.nil?
if XAS_emini_hud::XAS_39
if @character.battler.is_a?(Game_Enemy)
return if (@character.dead? or @character.erased or
@character.battler.e_object or @character.battler.e_item)
end
else
return if ENEMY_ELEMENT::ENEMY_OBJECT.include?(@character.battler.id)
return if ENEMY_ELEMENT::ENEMY_ITEM.include?(@character.battler.id)
end
return if @character.battler.is_a?(Game_Actor)
@bars = Enemy_Bars.new(@character)
@meong = 0
end
def update
xas_emini_hud_up
return if @bars.nil? or @bars.disposed?
dis = ($game_player.x - @character.x).abs +
($game_player.y - @character.y).abs
@bars.visible = (dis <= XAS_emini_hud::RANGE)
@bars.vis = @bars.visible
@bars.x = @character.screen_x - @cw / 4
@bars.y = @character.screen_y - @ch / 4
if ((dis <= 1) or !@bars.visible) and (@meong > 120)
@meong -= 10
[@bars].each {|s| s.opac = @meong}
elsif @bars.visible and @meong < 255
@meong += 10
[@bars].each {|s| s.opac = @meong}
end
@bars.update
end
def dispose
super
@bars.dispose if !@bars.nil?
end
end
Administrator
Show Signature
Morderator
Morderator
Morderator
profile
albertfish
profile
Good, keep it up! Hopefully in December I can make a script or two in my spare time.
Morderator
Show Signature
Morderator
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
@albertfish - thanks man...
I'm still trying to work out the lag in this one,
since it constantly updates.
I'm very excitedfor future versions on this
as i plan to make bar versions and icons that fill/drain.
just like our Hearts and Stars script...
by the way that post on RMRK just broke over a 1000 views!
can't wait to see what you got cookin! ^,^
EDIT: HACKEL made time out of his busy schedule and offered to
update this script to have the option for
bars or numbers or both!
He's mentioned works of a new ally system with his own version
of XAS~ excited!
here's the latest version of the script with a screenshot in action ^,^
I'm still trying to work out the lag in this one,
since it constantly updates.
I'm very excited
as i plan to make bar versions and icons that fill/drain.
just like our Hearts and Stars script...
by the way that post on RMRK just broke over a 1000 views!
can't wait to see what you got cookin! ^,^
EDIT: HACKEL made time out of his busy schedule and offered to
update this script to have the option for
bars or numbers or both!
He's mentioned works of a new ally system with his own version
of XAS~ excited!
here's the latest version of the script with a screenshot in action ^,^
- Spoiler:
- Code:
################################################################################
# XAS Enemy HP Counter V.1
# by Hackel 11-21-09
# script outline
#
# XAS Enemy HP Counter V.2
# by gameface101 11-21-09
# added SP definition
#
# XAS Enemy HP Counter V.3
# by Hackel 12-29-09
# added bars
#
# XAS Enemy HP Counter V.4
# by Hackel 12-29-09
# fixed no SP error
################################################################################
module XAS_HUD
ENEMY_HUD = true
# range of the mini HUD
RANGE = 4
BAR = true
NUMBERS = true
end
###############
# Window_Base #
###############
class Window_Base < Window #class Window_Base is child to parent window
def mini_hud # define monster_hud
for event in $game_map.events.values #for?
if event.battler != nil #if event
unless XAS_BA_ENEMY::ENEMY_OBJECT.include?(event.battler.id) or XAS_BA_ENEMY::ITEM_ENEMY.include?(event.battler.id)
dis = ($game_player.x - event.x).abs + ($game_player.y - event.y).abs
if dis <= XAS_HUD::RANGE
#########Bars#######
if XAS_HUD::BAR == true
back = RPG::Cache.picture("minibar")
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(event.real_x / 4, event.real_y / 4 - 4, back, src_rect)
meter = RPG::Cache.picture("minihp")
cw = meter.width * event.battler.hp / event.battler.maxhp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(event.real_x / 4, event.real_y / 4 - 4, meter, src_rect)
if event.battler.maxsp > 0
back2 = RPG::Cache.picture("minibar")
cw = back2.width
ch = back2.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(event.real_x / 4, event.real_y / 4, back2, src_rect)
meter = RPG::Cache.picture("minisp")
cw = meter.width * event.battler.sp / event.battler.maxsp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(event.real_x / 4, event.real_y / 4 , meter, src_rect)
end
end
#########/Bars##########
if XAS_HUD::NUMBERS == true
self.contents.font.size = 14
self.contents.font.name = "AddElectricCity"
self.contents.font.color = Color.new(0,0,0,255)#black
self.contents.draw_text(event.real_x / 4, event.real_y / 4, 28, 22, event.battler.hp.to_s, 2)
lowhp = event.battler.maxhp * 20 / 100
avhp = event.battler.maxhp * 50 / 100
if event.battler.hp <= lowhp
self.contents.font.color = Color.new(232,8,0,255)#red
elsif event.battler.hp <= avhp
self.contents.font.color = Color.new(253,241,7,255)#yellow
else
self.contents.font.color = Color.new(96,224,82,255)#green
end
self.contents.draw_text(event.real_x / 4, event.real_y / 4, 29, 23,event.battler.hp.to_s, 2)
self.contents.font.size = 12
if event.battler.maxsp > 0
self.contents.font.name = "AddElectricCity"
self.contents.font.color = Color.new(0,0,0,255)#black
self.contents.draw_text(event.real_x / 4, event.real_y / 4, 28, 42, event.battler.sp.to_s, 2)
lowsp = event.battler.maxsp * 20 / 100
avsp = event.battler.maxsp * 50 / 100
if event.battler.sp <= lowsp
self.contents.font.color = Color.new(194,210,255,255)#light blue
elsif event.battler.sp <= avsp
self.contents.font.color = Color.new(92,130,255,255)#medium blue
else
self.contents.font.color = Color.new(223,204,178,255)#pale
end
self.contents.draw_text(event.real_x / 4, event.real_y / 4, 29, 43,event.battler.sp.to_s, 2)
end
end
end
end
end
end
end
end
#####################
# Window_Status_Map #
#####################
class Window_EHP < Window_Base
def initialize
super(0, 0, 680, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.windowskin = RPG::Cache.windowskin("")
self.contents.font.bold = true
self.contents.font.name = "Calibri"
self.opacity = 0
refresh
end
def refresh
self.contents.clear
if XAS_HUD::ENEMY_HUD == true
mini_hud
end
end
def update
refresh
end
end
#############
# Scene_Map #
#############
class Scene_Map
alias mohud_main main
def main
@hpenemy = Window_EHP.new
if $game_switches[XAS_HUD::DISABLE_STATUS_HUD_SWITCH] == false
@hpenemy.visible = true
else
@hpenemy.visible = false
end
mohud_main
@hpenemy.dispose
end
alias mohud_update update
def update
if $game_switches[XAS_HUD::DISABLE_STATUS_HUD_SWITCH] == false
@hpenemy.visible = true
else
@hpenemy.visible = false
end
@hpenemy.update
mohud_update
end
end
Administrator
Show Signature
ACTIVATED
ACTIVATED
ACTIVATED
profile
Ragnai
profile
Ui, looks really good.
And a real usefull script too.
Thanks a lot for it and keep up the good work (:
~Ragnai
And a real usefull script too.
Thanks a lot for it and keep up the good work (:
~Ragnai
ACTIVATED
Show Signature
ACTIVATED
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
thanks Ragnai, Hackel really helped me bring this to life.
and it's good to see you here
let me know if you need help with anything ^,^
I'm currently working on repositioning
the bars and numbers so that you can
have them centered above or below the enemy.
Hopefully there will be a newer version soon.
EDIT: Hackle you are the man!
new XAS E-mini HUD V.5 in original post.
*includes easy options for bars and numbers position
in the top module.
and it's good to see you here
let me know if you need help with anything ^,^
I'm currently working on repositioning
the bars and numbers so that you can
have them centered above or below the enemy.
Hopefully there will be a newer version soon.
EDIT: Hackle you are the man!
new XAS E-mini HUD V.5 in original post.
*includes easy options for bars and numbers position
in the top module.
Administrator
Show Signature
||||||||||
||||||||||
||||||||||
profile
supercow
profile
it cool but when the enemy jump or move fast the hp bar cant catch up is there gonna be an update?
||||||||||
Show Signature
||||||||||
WORDSMITH
WORDSMITH
WORDSMITH
profile
Cardboard Square
profile
Awesome Gameface! I remember some time back when you were working on the heart system (unless my memory is faulty). Looks like you followed through with the idea and then some!
-CS
-CS
WORDSMITH
Show Signature
WORDSMITH
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
@cs- yup the heart script was my very first, I had so much time last year since work was slow, but this year I've been so busy ~ work has been really riding me :-/
@supercow - I do plan on touching up this one for the newer versions of XAS (when I get that time)
It would be cool to also have the option to show the enemy's name, level, rank, ect...
@supercow - I do plan on touching up this one for the newer versions of XAS (when I get that time)
It would be cool to also have the option to show the enemy's name, level, rank, ect...
Administrator
Show Signature
EVENTALIST
EVENTALIST
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
@supercow - this script is getting a make over for certain...
I'm studying some other scripts that have better alignment and no need for graphics to make this one even better!
I'm studying some other scripts that have better alignment and no need for graphics to make this one even better!
Administrator
Show Signature
Go to page : 1, 2, 3
GAMEFACE101 » MEDIA » PLAY with CODE! » PLAY with CODE (scripts and software) » RGSS (RMXP SCRIPTS) »RMXP + XAS = "ENEmini" HUD
Similar topics