Hello!
I´m creating a game and I´m using UCoders NeoABS. The script is great and fun to use, and the built in HUD is nice and minimalistic, just the way I want it! But... earlier I used Mr.Mo´s old ABS and I think that the NeoABS HUD is better, but there is one thing about the old HUD that I miss. The thing I miss in the new NeoABS HUD is the possibility to show States on-screen!
In my game I use alot of magic and abilities that involves States. Basically, what I need is the States to be displayed as Icons and State Name to the left on the screen, just below the items. Like so:
This is the actual script:
And this is a link to Mr.Mo´s topic:
http://www.rmxp.org/forums/index.php?topic=36268.0
I would be really thankful if anyone could find the time to help me out!
Cheers
I´m creating a game and I´m using UCoders NeoABS. The script is great and fun to use, and the built in HUD is nice and minimalistic, just the way I want it! But... earlier I used Mr.Mo´s old ABS and I think that the NeoABS HUD is better, but there is one thing about the old HUD that I miss. The thing I miss in the new NeoABS HUD is the possibility to show States on-screen!
In my game I use alot of magic and abilities that involves States. Basically, what I need is the States to be displayed as Icons and State Name to the left on the screen, just below the items. Like so:
This is the actual script:
#===============================================================================
# ** NeoABS HUD - www.unknowncoders.com
#-------------------------------------------------------------------------------
# Author Mr.Mo "Muhammet Sivri"
# Version 1.0
# Date 11/25/07 (m/d/y)
#===============================================================================
# Credit to Trickster for his gradient bars!
#===============================================================================
module UCoders
class NeoABS_HUD < Window_Base
UCoders.include('NeoABS_HUD', ['Mr.Mo','1.0'])
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(on=false)
super(0, 0, 640, 480)
# Set old stuff
@items = @skills = {}
@hp = @sp = @sneak = @dash = @weapon_id = @ammo = 0
@actor = $game_party.actors[0]
@run_timer = 0
@run_displaying = @defending = false
# Create Bitmap
self.contents = Bitmap.new(width - 32, height - 32)
# Hide Window
self.opacity = 0
self.visible = on
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.size = 18
@actor = $game_party.actors[0]
@items = $game_player.item_keys
@skills = @actor.skill_keys
@hp = @actor.hp
@sp = @actor.sp
@sneak = $game_player.sneak_min
@dash = $game_player.dash_min
@actor = $game_party.actors[0]
@weapon_id = @actor.weapon_id
@defending = (Input.press?(DEFEND_KEY))
@ammo = $game_party.item_number(Range_Weapons[@actor.weapon_id][3]) if Range_Weapons.has_key?(@actor.weapon_id)
# Show the HP
self.contents.draw_text(0, -9, 100, 32, "Hälsa")
draw_gradient_bar(50, 0, @actor.hp, @actor.maxhp, HP_BAR, 100, 8)
# Show the SP
self.contents.draw_text(0, 11, 100, 32, "Mana")
draw_gradient_bar(50, 24, @actor.sp, @actor.maxsp, SP_BAR, 100,8)
# Display Hotkeys
xp = 0
@actor.skill_keys.each { |key, value|
# Skill
skill = $data_skills[value.to_i]; next if skill.nil?
# Icon
bitmap = RPG::Cache.icon(skill.icon_name)
self.contents.blt(160+(xp*48), 0, bitmap, Rect.new(0, 0, 24, 24))
# Write Key
self.contents.draw_text(192+(xp*48)-48/2, 24, 100, 32, Keys.name?(key))
xp+=1
}
yp = 0
# Display Items
$game_player.item_keys.each { |key, value|
# Item
item = $data_items[value.to_i]; next if item.nil?
# Icon
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(0, 50 + (yp*32), bitmap, Rect.new(0, 0, 24, 24))
# Write Key
self.contents.draw_text(26, 50 + (yp*32) - 8, 100, 32, Keys.name?(key))
yp+=1
}
# Display if using
if @run_displaying
# Display Dash
draw_gradient_bar(510, 425-28, $game_player.dash_min, $NeoABS.dash_lenght*10, "025-SoftBlue01", 100,8)
contents.draw_text(446, 416-32, 100, 32, "Springa")
# Display Sneak
draw_gradient_bar(510, 449-32, $game_player.sneak_min, $NeoABS.sneak_lenght*10, "029-SoftGreens01", 100,8)
contents.draw_text(446, 436-32, 100, 32, "Smyga")
@run_timer = 0
end
# Item
item = $data_weapons[@actor.weapon_id]
# Icon
bitmap = RPG::Cache.icon(item.icon_name) unless item.nil?
self.contents.blt(64, 36, bitmap, Rect.new(0, 0, 24, 24)) unless item.nil?
# Display Ammo if weapon is a Ranged Weapon
if Range_Weapons.has_key?(@actor.weapon_id)
self.contents.font.size = 20
contents.draw_text(90, 36, 100, 32, "#{@ammo}")
end
# Display Shield if defending
if @defending && CAN_DEFEND
# Icon
bitmap = RPG::Cache.icon("009-Shield01")
self.contents.blt(125, 36, bitmap, Rect.new(0, 0, 24, 24))
end
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
refresh if something_changed?
@run_timer < 50 ? @run_timer += 1 : @run_timer += 0
# Sneak And Dash Display
if @run_timer >= 100 and @run_displaying
@run_timer -= 1
@run_timer = 0 if @dash == $game_player.dash_min && @sneak == $game_player.sneak_min
@run_timer <= 0 ? @run_displaying = false : @run_displaying = true
refresh if !@run_displaying
end
end
#--------------------------------------------------------------------------
# * Something Changed?
#--------------------------------------------------------------------------
def something_changed?
return true if @actor != $game_party.actors[0]
return true if @hp != @actor.hp or @sp != @actor.sp
return true if $game_player.item_keys.to_s != @items.to_s or @actor.skill_keys.to_s != @skills.to_s
return true if @weapon_id != @actor.weapon_id || (Range_Weapons.has_key?(@actor.weapon_id) && $game_party.item_number(Range_Weapons[@actor.weapon_id][3]) != @ammo)
return @run_displaying = true if @dash != $game_player.dash_min or @sneak != $game_player.sneak_min
return true if @defending != Input.press?(DEFEND_KEY)
return false
end
end
end
#===============================================================================
# * Scene_Map
#=============================================================================
class Scene_Map
#--------------------------------------------------------------------------
alias mrmo_hud_main main
alias mrmo_keyhud_update update
#--------------------------------------------------------------------------
# * Main Draw
#--------------------------------------------------------------------------
def main
UCoders::Object["NeoABS_HUD"] = UCoders::NeoABS_HUD.new($NeoABS.hud_showing)
mrmo_hud_main
$NeoABS.hud_showing = UCoders::Object["NeoABS_HUD"].visible
UCoders::Object["NeoABS_HUD"].dispose
end
#--------------------------------------------------------------------------
# * Turn HUD Show
#--------------------------------------------------------------------------
def hud_show
$NeoABS.hud_showing = UCoders::Object["NeoABS_HUD"].visible = true
end
#--------------------------------------------------------------------------
# * Turn HUD Hide
#--------------------------------------------------------------------------
def hud_hide
$NeoABS.hud_showing = UCoders::Object["NeoABS_HUD"].visible = false
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
mrmo_keyhud_update
UCoders::Object["NeoABS_HUD"].update
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.exp
max = actor.level == 99 ? 1 : actor.next_exp_s.to_i
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
=begin
#===============================================================================
# ** NeoABS HUD - www.unknowncoders.com
#-------------------------------------------------------------------------------
# Author Mr.Mo "Muhammet Sivri"
# Version 1.2
# 10.16.06
#===============================================================================
# Credit to Trickster for his gradient bars!
#==============================================================================
UCoders.include("Enemy Bars",["1.2"])
class Enemy_Bars < Sprite
#--------------------------------------------------------------------------
# * Constants Bar Types and Hues for parameters and parameter names
#--------------------------------------------------------------------------
HP_BAR = "014-Reds01"
# leave this alone if you don't know what you are doing
OUTLINE = 1
BORDER = 1
HP_WIDTH = 30 # WIDTH of the HP Bar
HP_HEIGHT = 5 # Height of the HP Bar
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(enemy, v)
super(v)
@enemy = enemy
@old_hp = 0
@old_x = 0
@old_y = 0
self.bitmap = Bitmap.new(HP_WIDTH, HP_HEIGHT)
update
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
#First move it
@old_x = @enemy.event.screen_x-10
@old_y = @enemy.event.screen_y
self.x = @old_x
self.y = @old_y
#HP Bar Check
return if @old_hp == @enemy.hp
self.bitmap.clear
@old_hp = @enemy.hp
#Show the bar
draw_gradient_bar(0,0,@enemy.hp,@enemy.maxhp,HP_BAR,HP_WIDTH,HP_HEIGHT)
end
#--------------------------------------------------------------------------
# * Something Changed?
#--------------------------------------------------------------------------
def something_changed?
return dispose if @enemy.dead? or $NeoABS.enemies[@enemy.event_id].nil?
return true if @old_hp != @enemy.hp
return true if @old_x != @enemy.event.screen_x-10
return true if @old_y != @enemy.event.screen_y
return false
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
refresh if something_changed?
end
#--------------------------------------------------------------------------
# * 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.bitmap.stretch_blt(back_dest_rect, back, back_source_rect)
self.bitmap.stretch_blt(back2_dest_rect, back2, back2_source_rect)
self.bitmap.stretch_blt(bar_dest_rect, bar, bar_source_rect)
end
end
#============================================================================
# * Scene Map
#============================================================================
class Scene_Map
#--------------------------------------------------------------------------
alias mrmo_hpeny_scene_map_update update
alias mrmo_hpeny_scene_map_main main
#--------------------------------------------------------------------------
# * Main Draw
#--------------------------------------------------------------------------
def main
@enemys_hp = {}
#Get Enemies
$NeoABS.enemies.each_value { |e| e.bar_showing = false }
mrmo_hpeny_scene_map_main
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
#Get Enemies
$NeoABS.enemies.each_value { |e| next if e.nil?
#if in screen
if e.in_range?($game_player, 5) && !e.bar_showing && e.attacking_id > -1
@enemys_hp[e.event.id] = Enemy_Bars.new(e,@spriteset.viewport3)
e.bar_showing = true
elsif e.bar_showing && !@enemys_hp[e.event.id].nil? && !(e.in_range?($game_player, 5) or e.attacking_id > -1)
@enemys_hp[e.event.id].dispose unless @enemys_hp[e.event.id].disposed?
@enemys_hp[e.event.id] = nil
e.bar_showing = false
end
}
#Update HP BARS
@enemys_hp.each_value { |bar| bar.update if !bar.nil? && !bar.disposed? }
mrmo_hpeny_scene_map_update
end
end
#============================================================================
# * ABS Enemy
#============================================================================
class ABS_Enemy < Game_Battler
#--------------------------------------------------------------------------
attr_accessor :bar_showing
#--------------------------------------------------------------------------
alias mrmo_hpeny_abs_enemy_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(enemy_id,e)
mrmo_hpeny_abs_enemy_initialize(enemy_id,e)
@bar_showing = false
end
end
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
# This class brings together map screen sprites, tilemaps, etc.
# It's used within the Scene_Map class.
#==============================================================================
class Spriteset_Map
attr_accessor :viewport3
end
=end
# ** NeoABS HUD - www.unknowncoders.com
#-------------------------------------------------------------------------------
# Author Mr.Mo "Muhammet Sivri"
# Version 1.0
# Date 11/25/07 (m/d/y)
#===============================================================================
# Credit to Trickster for his gradient bars!
#===============================================================================
module UCoders
class NeoABS_HUD < Window_Base
UCoders.include('NeoABS_HUD', ['Mr.Mo','1.0'])
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(on=false)
super(0, 0, 640, 480)
# Set old stuff
@items = @skills = {}
@hp = @sp = @sneak = @dash = @weapon_id = @ammo = 0
@actor = $game_party.actors[0]
@run_timer = 0
@run_displaying = @defending = false
# Create Bitmap
self.contents = Bitmap.new(width - 32, height - 32)
# Hide Window
self.opacity = 0
self.visible = on
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.size = 18
@actor = $game_party.actors[0]
@items = $game_player.item_keys
@skills = @actor.skill_keys
@hp = @actor.hp
@sp = @actor.sp
@sneak = $game_player.sneak_min
@dash = $game_player.dash_min
@actor = $game_party.actors[0]
@weapon_id = @actor.weapon_id
@defending = (Input.press?(DEFEND_KEY))
@ammo = $game_party.item_number(Range_Weapons[@actor.weapon_id][3]) if Range_Weapons.has_key?(@actor.weapon_id)
# Show the HP
self.contents.draw_text(0, -9, 100, 32, "Hälsa")
draw_gradient_bar(50, 0, @actor.hp, @actor.maxhp, HP_BAR, 100, 8)
# Show the SP
self.contents.draw_text(0, 11, 100, 32, "Mana")
draw_gradient_bar(50, 24, @actor.sp, @actor.maxsp, SP_BAR, 100,8)
# Display Hotkeys
xp = 0
@actor.skill_keys.each { |key, value|
# Skill
skill = $data_skills[value.to_i]; next if skill.nil?
# Icon
bitmap = RPG::Cache.icon(skill.icon_name)
self.contents.blt(160+(xp*48), 0, bitmap, Rect.new(0, 0, 24, 24))
# Write Key
self.contents.draw_text(192+(xp*48)-48/2, 24, 100, 32, Keys.name?(key))
xp+=1
}
yp = 0
# Display Items
$game_player.item_keys.each { |key, value|
# Item
item = $data_items[value.to_i]; next if item.nil?
# Icon
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(0, 50 + (yp*32), bitmap, Rect.new(0, 0, 24, 24))
# Write Key
self.contents.draw_text(26, 50 + (yp*32) - 8, 100, 32, Keys.name?(key))
yp+=1
}
# Display if using
if @run_displaying
# Display Dash
draw_gradient_bar(510, 425-28, $game_player.dash_min, $NeoABS.dash_lenght*10, "025-SoftBlue01", 100,8)
contents.draw_text(446, 416-32, 100, 32, "Springa")
# Display Sneak
draw_gradient_bar(510, 449-32, $game_player.sneak_min, $NeoABS.sneak_lenght*10, "029-SoftGreens01", 100,8)
contents.draw_text(446, 436-32, 100, 32, "Smyga")
@run_timer = 0
end
# Item
item = $data_weapons[@actor.weapon_id]
# Icon
bitmap = RPG::Cache.icon(item.icon_name) unless item.nil?
self.contents.blt(64, 36, bitmap, Rect.new(0, 0, 24, 24)) unless item.nil?
# Display Ammo if weapon is a Ranged Weapon
if Range_Weapons.has_key?(@actor.weapon_id)
self.contents.font.size = 20
contents.draw_text(90, 36, 100, 32, "#{@ammo}")
end
# Display Shield if defending
if @defending && CAN_DEFEND
# Icon
bitmap = RPG::Cache.icon("009-Shield01")
self.contents.blt(125, 36, bitmap, Rect.new(0, 0, 24, 24))
end
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
refresh if something_changed?
@run_timer < 50 ? @run_timer += 1 : @run_timer += 0
# Sneak And Dash Display
if @run_timer >= 100 and @run_displaying
@run_timer -= 1
@run_timer = 0 if @dash == $game_player.dash_min && @sneak == $game_player.sneak_min
@run_timer <= 0 ? @run_displaying = false : @run_displaying = true
refresh if !@run_displaying
end
end
#--------------------------------------------------------------------------
# * Something Changed?
#--------------------------------------------------------------------------
def something_changed?
return true if @actor != $game_party.actors[0]
return true if @hp != @actor.hp or @sp != @actor.sp
return true if $game_player.item_keys.to_s != @items.to_s or @actor.skill_keys.to_s != @skills.to_s
return true if @weapon_id != @actor.weapon_id || (Range_Weapons.has_key?(@actor.weapon_id) && $game_party.item_number(Range_Weapons[@actor.weapon_id][3]) != @ammo)
return @run_displaying = true if @dash != $game_player.dash_min or @sneak != $game_player.sneak_min
return true if @defending != Input.press?(DEFEND_KEY)
return false
end
end
end
#===============================================================================
# * Scene_Map
#=============================================================================
class Scene_Map
#--------------------------------------------------------------------------
alias mrmo_hud_main main
alias mrmo_keyhud_update update
#--------------------------------------------------------------------------
# * Main Draw
#--------------------------------------------------------------------------
def main
UCoders::Object["NeoABS_HUD"] = UCoders::NeoABS_HUD.new($NeoABS.hud_showing)
mrmo_hud_main
$NeoABS.hud_showing = UCoders::Object["NeoABS_HUD"].visible
UCoders::Object["NeoABS_HUD"].dispose
end
#--------------------------------------------------------------------------
# * Turn HUD Show
#--------------------------------------------------------------------------
def hud_show
$NeoABS.hud_showing = UCoders::Object["NeoABS_HUD"].visible = true
end
#--------------------------------------------------------------------------
# * Turn HUD Hide
#--------------------------------------------------------------------------
def hud_hide
$NeoABS.hud_showing = UCoders::Object["NeoABS_HUD"].visible = false
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
mrmo_keyhud_update
UCoders::Object["NeoABS_HUD"].update
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.exp
max = actor.level == 99 ? 1 : actor.next_exp_s.to_i
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
=begin
#===============================================================================
# ** NeoABS HUD - www.unknowncoders.com
#-------------------------------------------------------------------------------
# Author Mr.Mo "Muhammet Sivri"
# Version 1.2
# 10.16.06
#===============================================================================
# Credit to Trickster for his gradient bars!
#==============================================================================
UCoders.include("Enemy Bars",["1.2"])
class Enemy_Bars < Sprite
#--------------------------------------------------------------------------
# * Constants Bar Types and Hues for parameters and parameter names
#--------------------------------------------------------------------------
HP_BAR = "014-Reds01"
# leave this alone if you don't know what you are doing
OUTLINE = 1
BORDER = 1
HP_WIDTH = 30 # WIDTH of the HP Bar
HP_HEIGHT = 5 # Height of the HP Bar
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(enemy, v)
super(v)
@enemy = enemy
@old_hp = 0
@old_x = 0
@old_y = 0
self.bitmap = Bitmap.new(HP_WIDTH, HP_HEIGHT)
update
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
#First move it
@old_x = @enemy.event.screen_x-10
@old_y = @enemy.event.screen_y
self.x = @old_x
self.y = @old_y
#HP Bar Check
return if @old_hp == @enemy.hp
self.bitmap.clear
@old_hp = @enemy.hp
#Show the bar
draw_gradient_bar(0,0,@enemy.hp,@enemy.maxhp,HP_BAR,HP_WIDTH,HP_HEIGHT)
end
#--------------------------------------------------------------------------
# * Something Changed?
#--------------------------------------------------------------------------
def something_changed?
return dispose if @enemy.dead? or $NeoABS.enemies[@enemy.event_id].nil?
return true if @old_hp != @enemy.hp
return true if @old_x != @enemy.event.screen_x-10
return true if @old_y != @enemy.event.screen_y
return false
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
refresh if something_changed?
end
#--------------------------------------------------------------------------
# * 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.bitmap.stretch_blt(back_dest_rect, back, back_source_rect)
self.bitmap.stretch_blt(back2_dest_rect, back2, back2_source_rect)
self.bitmap.stretch_blt(bar_dest_rect, bar, bar_source_rect)
end
end
#============================================================================
# * Scene Map
#============================================================================
class Scene_Map
#--------------------------------------------------------------------------
alias mrmo_hpeny_scene_map_update update
alias mrmo_hpeny_scene_map_main main
#--------------------------------------------------------------------------
# * Main Draw
#--------------------------------------------------------------------------
def main
@enemys_hp = {}
#Get Enemies
$NeoABS.enemies.each_value { |e| e.bar_showing = false }
mrmo_hpeny_scene_map_main
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
#Get Enemies
$NeoABS.enemies.each_value { |e| next if e.nil?
#if in screen
if e.in_range?($game_player, 5) && !e.bar_showing && e.attacking_id > -1
@enemys_hp[e.event.id] = Enemy_Bars.new(e,@spriteset.viewport3)
e.bar_showing = true
elsif e.bar_showing && !@enemys_hp[e.event.id].nil? && !(e.in_range?($game_player, 5) or e.attacking_id > -1)
@enemys_hp[e.event.id].dispose unless @enemys_hp[e.event.id].disposed?
@enemys_hp[e.event.id] = nil
e.bar_showing = false
end
}
#Update HP BARS
@enemys_hp.each_value { |bar| bar.update if !bar.nil? && !bar.disposed? }
mrmo_hpeny_scene_map_update
end
end
#============================================================================
# * ABS Enemy
#============================================================================
class ABS_Enemy < Game_Battler
#--------------------------------------------------------------------------
attr_accessor :bar_showing
#--------------------------------------------------------------------------
alias mrmo_hpeny_abs_enemy_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(enemy_id,e)
mrmo_hpeny_abs_enemy_initialize(enemy_id,e)
@bar_showing = false
end
end
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
# This class brings together map screen sprites, tilemaps, etc.
# It's used within the Scene_Map class.
#==============================================================================
class Spriteset_Map
attr_accessor :viewport3
end
=end
And this is a link to Mr.Mo´s topic:
http://www.rmxp.org/forums/index.php?topic=36268.0
I would be really thankful if anyone could find the time to help me out!
Cheers