Z-HUD for Blizz-ABS
Authors: Blizzard
Version: 1.2b
Type: Blizz-ABS plugin
Key Term: Blizz-ABS Plugin
IntroductionThis script will add will add a completely new HUD system for Blizz-ABS.
This script is to be distributed under the same terms and conditions like the script it was created for: Blizz-ABS.
Features
- use SP display images as bars or tiles
- use HP display images as bars or tiles
- background images for assigned hotkeys
- background images all hotkeys
- background image for minimap
- allows a Zelda style HUD by simply configuring the script properly and using the proper images
Screenshots(http://img38.imageshack.us/img38/6383/snap916.th.png) (http://img38.imageshack.us/img38/6383/snap916.png) (http://img129.imageshack.us/img129/6411/newhud.th.png) (http://img129.imageshack.us/img129/6411/newhud.png) (http://img5.imageshack.us/img5/1031/33ngp6x.th.png) (http://img5.imageshack.us/img5/1031/33ngp6x.png) (http://img690.imageshack.us/img690/4734/povzhudunfull.th.png) (http://img690.imageshack.us/img690/4734/povzhudunfull.png) (http://img199.imageshack.us/img199/5795/69199189.th.png) (http://img199.imageshack.us/img199/5795/69199189.png)
DemoN/A
ScriptJust make a new script above main and paste this code into it.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Z-HUD for Blizz-ABS by Blizzard
# Version: 1.2b
# Type: Blizz-ABS Add-on
# Date: 29.7.2009
# Date v1.0b: 30.7.2009
# Date v1.01b: 17.12.2009
# Date v1.02b: 23.2.2010
# Date v1.2b: 18.2.2012
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This script is to be distributed under the same terms and conditions like
# the script it was created for: Blizz-ABS.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Information:
#
# This script must be placed below Blizz-ABS and requires Blizz-ABS v2.7 or
# higher to work properly. It will add a completely new HUD system for
# Blizz-ABS.
#
# Notes:
#
# Images are placed in the Graphics/Pictures folder. Be sure to set up the
# HUD height properly. Usually it is enough if it is the sum of the heights
# of the HP and the SP image. If you use tiling, you need to calculate the
# maximum possible height the HUD can be and then use that value. It is not
# recommended to use extremely high values as your HUD will cover too much of
# the screen and increase lag.
#
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
if !$BlizzABS || BlizzABS::VERSION < 2.7
raise 'ERROR: The "Z-HUD" requires Blizz-ABS 2.7 or higher.'
end
#==============================================================================
# module BlizzCFG
#==============================================================================
module BlizzCFG
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# maximum height of the HUD
Z_HUD_HEIGHT = 96
# background image for whole HUD (leave empty for none)
Z_HUD_BACKGROUND = ''
# tiling HP images
Z_HP_TILING = true
# displays as if the images are filled up (only when tiling)
Z_HP_FILL_UP = true
# how many columns are used for the tile in one row (only when tiling)
Z_HP_TILE_COLUMNS = 10
# how many HP per column (only when tiling)
Z_HP_PER_TILE = 100
# full image file
Z_HP_FILE = 'hud_HP'
# empty image file
Z_HP_FILE_EMPTY = 'hud_HP_empty'
# tiling SP images
Z_SP_TILING = false
# displays as if the images are filled up (only when tiling)
Z_SP_FILL_UP = false
# how many columns are used for the tile in one row (only when tiling)
Z_SP_TILE_COLUMNS = 10
# how many SP per column (only when tiling)
Z_SP_PER_TILE = 10
# full image file
Z_SP_FILE = 'hud_SP'
# empty image file
Z_SP_FILE_EMPTY = 'hud_SP_empty'
# item hotkey background
Z_ITEM_BACK = 'item'
# skill hotkey background
Z_SKILL_BACK = 'skill'
# hotkeys display background
Z_HOTKEYS_BACK = 'hotkey'
# minimap background
Z_MINIMAP_BACK = 'minimap'
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
$blizzabs_z_hud = 1.2
end
#==============================================================================
# Hud
#==============================================================================
class Hud
attr_reader :hotkey_sprite
alias init_zhud_later initialize
def initialize(viewport = nil)
init_hotkey_sprite(viewport)
init_zhud_later(viewport)
self.x, self.y = 4, 4
@hotkey_sprite.z = self.z
if BlizzCFG::Z_HUD_BACKGROUND != ''
@zhud_back = Sprite.new
@zhud_back.bitmap = RPG::Cache.picture(BlizzCFG::Z_HUD_BACKGROUND)
@zhud_back.z = self.z - 1
end
end
alias create_positions_zhud_later create_positions
def create_positions
create_positions_zhud_later
b1 = RPG::Cache.picture(BlizzCFG::Z_HP_FILE)
b2 = RPG::Cache.picture(BlizzCFG::Z_SP_FILE)
if BlizzCFG::Z_HP_TILING
w = b1.width * BlizzCFG::Z_HP_TILE_COLUMNS
else
w = b1.width
end
@hud_width = w if @hud_width < w
if BlizzCFG::Z_SP_TILING
w = b2.width * BlizzCFG::Z_SP_TILE_COLUMNS
else
w = b2.width
end
@hud_width = w if @hud_width < w
@hud_height = BlizzCFG::Z_HUD_HEIGHT
@hp_x, @hp_y, @sp_x, @sp_y = 0, 0, 0, b1.height + 4
update_sp_y
b = RPG::Cache.picture(BlizzCFG::Z_ITEM_BACK)
@left_x = b.width
@left_y = b.height
@hot_x = b.width
end
def draw_basic
end
def draw_empty
end
def draw_name
end
def draw_level
end
def draw_hp
@hp, @maxhp = actor.hp, actor.maxhp
rate = (@maxhp > 0 ? @hp.to_f / @maxhp : 0)
b1 = RPG::Cache.picture(BlizzCFG::Z_HP_FILE)
b2 = RPG::Cache.picture(BlizzCFG::Z_HP_FILE_EMPTY)
if BlizzCFG::Z_HP_TILING
tiles = @maxhp / BlizzCFG::Z_HP_PER_TILE
rows = (tiles.to_f / BlizzCFG::Z_HP_TILE_COLUMNS).ceil
w, h = b1.width, b1.height
self.bitmap.fill_rect(@hp_x, @hp_y, w * BlizzCFG::Z_HP_TILE_COLUMNS,
h * rows, Color.new(0, 0, 0, 0))
full_tiles = (rate * tiles).to_i
semi_full = ((rate * tiles != full_tiles) ? 1 : 0)
(0...full_tiles).each {|i|
x = @hp_x + (i % BlizzCFG::Z_HP_TILE_COLUMNS) * w
y = @hp_y + (i / BlizzCFG::Z_HP_TILE_COLUMNS) * h
self.bitmap.blt(x, y, b1, Rect.new(0, 0, w, h))}
if semi_full > 0
x = @hp_x + (full_tiles % BlizzCFG::Z_HP_TILE_COLUMNS) * w
y = @hp_y + (full_tiles / BlizzCFG::Z_HP_TILE_COLUMNS) * h
if BlizzCFG::Z_HP_FILL_UP
h2 = ((1 - rate * tiles + full_tiles) * h).to_i
self.bitmap.blt(x, y, b2, Rect.new(0, 0, w, h2))
self.bitmap.blt(x, y + h2, b1, Rect.new(0, h2, w, h - h2))
else
w2 = ((rate * tiles - full_tiles) * w).to_i
self.bitmap.blt(x, y, b1, Rect.new(0, 0, w2, h))
self.bitmap.blt(x + w2, y, b2, Rect.new(w2, 0, w - w2, h))
end
end
((full_tiles + semi_full)...tiles).each {|i|
x = @hp_x + (i % BlizzCFG::Z_HP_TILE_COLUMNS) * w
y = @hp_y + (i / BlizzCFG::Z_HP_TILE_COLUMNS) * h
self.bitmap.blt(x, y, b2, Rect.new(0, 0, w, h))}
else
w1 = (b1.width * rate).to_i
w2 = b2.width - w1
self.bitmap.fill_rect(@hp_x, @hp_y, b1.width, b1.height, Color.new(0, 0, 0, 0))
self.bitmap.blt(@hp_x, @hp_y, b1, Rect.new(0, 0, w1, b1.height))
self.bitmap.blt(@hp_x + w1, @hp_y, b2, Rect.new(w1, 0, w2, b2.height))
end
draw_sp
end
def draw_sp
@sp, @maxsp = actor.sp, actor.maxsp
rate = (@maxsp > 0 ? @sp.to_f / @maxsp : 0)
b1 = RPG::Cache.picture(BlizzCFG::Z_SP_FILE)
b2 = RPG::Cache.picture(BlizzCFG::Z_SP_FILE_EMPTY)
if BlizzCFG::Z_SP_TILING
tiles = @maxsp / BlizzCFG::Z_SP_PER_TILE
rows = (tiles.to_f / BlizzCFG::Z_SP_TILE_COLUMNS).ceil
w, h = b1.width, b1.height
self.bitmap.fill_rect(@sp_x, @sp_y, w * BlizzCFG::Z_SP_TILE_COLUMNS,
h * rows, Color.new(0, 0, 0, 0))
full_tiles = (rate * tiles).to_i
semi_full = ((rate * tiles != full_tiles) ? 1 : 0)
(0...full_tiles).each {|i|
x = @sp_x + (i % BlizzCFG::Z_SP_TILE_COLUMNS) * w
y = @sp_y + (i / BlizzCFG::Z_SP_TILE_COLUMNS) * h
self.bitmap.blt(x, y, b1, Rect.new(0, 0, w, h))}
if semi_full > 0
x = @sp_x + (full_tiles % BlizzCFG::Z_SP_TILE_COLUMNS) * w
y = @sp_y + (full_tiles / BlizzCFG::Z_SP_TILE_COLUMNS) * h
if BlizzCFG::Z_SP_FILL_UP
h2 = ((1 - rate * tiles + full_tiles) * h).to_i
self.bitmap.blt(x, y, b2, Rect.new(0, 0, w, h2))
self.bitmap.blt(x, y + h2, b1, Rect.new(0, h2, w, h - h2))
else
w2 = ((rate * tiles - full_tiles) * w).to_i
self.bitmap.blt(x, y, b1, Rect.new(0, 0, w2, h))
self.bitmap.blt(x + w2, y, b2, Rect.new(w2, 0, w - w2, h))
end
end
((full_tiles + semi_full)...tiles).each {|i|
x = @sp_x + (i % BlizzCFG::Z_SP_TILE_COLUMNS) * w
y = @sp_y + (i / BlizzCFG::Z_SP_TILE_COLUMNS) * h
self.bitmap.blt(x, y, b2, Rect.new(0, 0, w, h))}
else
w1 = (b1.width * rate).to_i
w2 = b2.width - w1
self.bitmap.fill_rect(@sp_x, @sp_y, b1.width, b1.height, Color.new(0, 0, 0, 0))
self.bitmap.blt(@sp_x, @sp_y, b1, Rect.new(0, 0, w1, b1.height))
self.bitmap.blt(@sp_x + w1, @sp_y, b2, Rect.new(w1, 0, w2, b2.height))
end
end
def draw_hskill
@skill = actor.skill
b1 = RPG::Cache.picture(BlizzCFG::Z_SKILL_BACK)
@hotkey_sprite.bitmap.fill_rect(0, 0, b1.width, b1.height, Color.new(0, 0, 0, 0))
@hotkey_sprite.bitmap.blt(0, 0, b1, Rect.new(0, 0, b1.width, b1.height))
if @skill != 0
bitmap = RPG::Cache.icon($data_skills[@skill].icon_name)
x, y = (b1.width - 24) / 2, (b1.height - 24) / 2
@hotkey_sprite.bitmap.blt(x, y, bitmap, Rect.new(0, 0, 24, 24))
end
draw_lskill
end
def draw_lskill
@hotkey_sprite.bitmap.fill_rect(0, @left_y + 4, @left_x, 16, Color.new(0, 0, 0, 0))
@skills_left = get_skills_left
if @skill != nil && @skill > 0
if @skills_left >= 0
if @skills_left == 0
@hotkey_sprite.bitmap.font.color = Color.new(255, 0, 0)
elsif @skills_left <= 5
@hotkey_sprite.bitmap.font.color = Color.new(255, 255, 0)
else
@hotkey_sprite.bitmap.font.color = normal_color
end
@hotkey_sprite.bitmap.font.size -= 2
@hotkey_sprite.bitmap.draw_text_full(0, @left_y, @left_x, 20, @skills_left.to_s, 1)
@hotkey_sprite.bitmap.font.size += 2
elsif @skills_left == -1
@hotkey_sprite.bitmap.font.color = Color.new(0, 255, 0)
@hotkey_sprite.bitmap.font.size += 4
@hotkey_sprite.bitmap.draw_text_full(0, @left_y, @left_x, 20, '∞', 1)
@hotkey_sprite.bitmap.font.size -= 4
end
end
end
def draw_hitem
@item = actor.item
b1 = RPG::Cache.picture(BlizzCFG::Z_SKILL_BACK)
b2 = RPG::Cache.picture(BlizzCFG::Z_ITEM_BACK)
x = b1.width + 4
@hotkey_sprite.bitmap.fill_rect(x, 0, b2.width, b2.height, Color.new(0, 0, 0, 0))
@hotkey_sprite.bitmap.blt(x, 0, b2, Rect.new(0, 0, b2.width, b2.height))
if @item != 0
bitmap = RPG::Cache.icon($data_items[@item].icon_name)
x, y = b1.width + 4 + (b2.width - 24) / 2, (b2.height - 24) / 2
@hotkey_sprite.bitmap.blt(x, y, bitmap, Rect.new(0, 0, 24, 24))
end
draw_litem
end
def draw_litem
@items_left = $game_party.item_number(@item)
@hotkey_sprite.bitmap.fill_rect(@left_x + 4, @left_y + 4, @left_x, 16, Color.new(0, 0, 0, 0))
if @item != nil && @item > 0
if $data_items[@item] != nil && !$data_items[@item].consumable
@hotkey_sprite.bitmap.font.color = Color.new(0, 255, 0)
@hotkey_sprite.bitmap.font.size += 4
@hotkey_sprite.bitmap.draw_text_full(@left_x + 4, @left_y, @left_x, 20, '∞', 1)
@hotkey_sprite.bitmap.font.size -= 4
else
if @items_left == 0
@hotkey_sprite.bitmap.font.color = Color.new(255, 0, 0)
elsif @items_left <= 10
@hotkey_sprite.bitmap.font.color = Color.new(255, 255, 0)
else
@hotkey_sprite.bitmap.font.color = normal_color
end
@hotkey_sprite.bitmap.font.size -= 2
@hotkey_sprite.bitmap.draw_text_full(@left_x + 4, @left_y, @left_x, 20, @items_left.to_s, 1)
@hotkey_sprite.bitmap.font.size += 2
end
end
end
alias update_zhud_later update
def update
update_sp_y if actor != nil
update_zhud_later
end
def update_sp_y
return if !BlizzCFG::Z_HP_TILING
b1 = RPG::Cache.picture(BlizzCFG::Z_HP_FILE)
tiles = actor.maxhp / BlizzCFG::Z_HP_PER_TILE
@sp_y = (tiles.to_f / BlizzCFG::Z_HP_TILE_COLUMNS).ceil * b1.height
end
alias dispose_zhud_later dispose
def dispose
@hotkey_sprite.dispose if @hotkey_sprite != nil
@hotkey_sprite = nil
@zhud_back.dispose if @zhud_back != nil
@zhud_back = nil
dispose_zhud_later
end
def init_hotkey_sprite(viewport)
b1 = RPG::Cache.picture(BlizzCFG::Z_ITEM_BACK)
b2 = RPG::Cache.picture(BlizzCFG::Z_SKILL_BACK)
width = b1.width + b2.width
@hotkey_sprite = Sprite.new(viewport)
@hotkey_sprite.x = 632 - width
@hotkey_sprite.y = 4
@hotkey_sprite.bitmap = Bitmap.new(width + 4, b1.height + 24)
@hotkey_sprite.bitmap.font.name = 'Arial'
@hotkey_sprite.bitmap.font.size = 16
@hotkey_sprite.bitmap.font.bold = true
end
end
#==============================================================================
# Hotkey_Assignment
#==============================================================================
class Hotkey_Assignment
def initialize(viewport = nil)
super
self.bitmap = Bitmap.new(32, 320)
self.bitmap.font.bold = true
self.bitmap.font.size -= 8
self.bitmap.font.color = system_color
self.x, self.y, self.z = 0, 160, 1100
@skills = BlizzABS::Cache::EmptyKeys
@items = BlizzABS::Cache::EmptyKeys
update
end
def draw(index = nil)
back = RPG::Cache.picture(BlizzCFG::Z_HOTKEYS_BACK)
w, h = back.width, back.height
ow, oh = (w - 24) / 2, (h - 24) / 2
(index == nil ? BlizzABS::Cache::HotkeyRange : [index]).each {|i|
if $game_player.skill_hotkeys[i%10] != 0
object = $data_skills[$game_player.skill_hotkeys[i%10]]
elsif $game_player.item_hotkeys[i%10] != 0
object = $data_items[$game_player.item_hotkeys[i%10]]
end
if @items[i%10] != $game_player.item_hotkeys[i%10] ||
@skills[i%10] != $game_player.skill_hotkeys[i%10]
self.bitmap.fill_rect(0, h*(i-1), w, h, Color.new(0, 0, 0, 0))
self.bitmap.blt(0, h*(i-1), back, Rect.new(0, 0, w, h))
if object != nil
bitmap = RPG::Cache.icon(object.icon_name)
self.bitmap.blt(ow, h*(i-1)+oh, bitmap, Rect.new(0, 0, 24, 24))
end
self.bitmap.draw_text_full(0, h*(i-1)+10, w-2, 32, (i%10).to_s, 2)
end}
@items = $game_player.item_hotkeys.clone
@skills = $game_player.skill_hotkeys.clone
end
end
#==============================================================================
# Minimap
#==============================================================================
class Minimap
alias update_zhud_later update
def update(override = false)
update_zhud_later(override)
update_minimap_back
end
def update_minimap_back
if $game_system.minimap == 1
if @minimap_back == nil
@minimap_back = Sprite.new
@minimap_back.bitmap = RPG::Cache.picture(BlizzCFG::Z_MINIMAP_BACK)
@minimap_back.x = self.vx - (@minimap_back.bitmap.width - self.vw) / 2
@minimap_back.y = self.vy - (@minimap_back.bitmap.height - self.vh) / 2
@minimap_back.z = self.z + 1
@minimap_back.opacity = self.opacity
end
elsif @minimap_back != nil
@minimap_back.dispose
@minimap_back = nil
end
end
alias opacity_is_zhud_later opacity=
def opacity=(value)
opacity_is_zhud_later(value)
@minimap_back.opacity = value if @minimap_back != nil
end
alias dispose_zhud_later dispose
def dispose
dispose_zhud_later
@minimap_back.dispose if @minimap_back != nil
@minimap_back = nil
end
end
#==============================================================================
# Scene_Map
#==============================================================================
class Scene_Map
alias hud_update_zhud_later hud_update
def hud_update
hud_update_zhud_later
if @hud != nil
s = @hud.hotkey_sprite
s.update
if $game_player.screen_x < s.vx + s.vw + 16 &&
$game_player.screen_y < s.vy + s.vh + 48 &&
$game_player.screen_x > s.vx && $game_player.screen_y > s.vy
s.opacity -= 25 if s.opacity > 80
elsif s.opacity <= 255
s.opacity += 25
end
end
end
end
#==============================================================================
# Window_Skill_Hotkey
#==============================================================================
class Window_Skill_Hotkey < Window_Skill
def initialize(actor)
super
@column_max = 1
self.width, self.height = 288, 480
self.x, self.y, self.z = 64, 64, 21000
self.cursor_rect.empty
self.active = false
refresh
end
def draw_item(i)
if @data[i] == nil
self.contents.font.color = normal_color
self.contents.draw_text(32, i*32, 204, 32, '<Remove>')
else
if @actor.skill_can_use?(@data[i].id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.fill_rect(Rect.new(4, i*32, 256, 32), Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(@data[i].icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(4, 4+i*32, bitmap, Rect.new(0, 0, 24, 24), opacity)
text = @data[i].name
if @actor.skills.include?(@data[i].id) &&
$tons_version != nil && $tons_version >= 3.7 &&
TONS_OF_ADDONS::EQUAP_SKILLS && DISPLAY_AP_REQ
aps = BlizzCFG.maxap(@data[i].id)
text = "#{text} (#{@actor.ap(@data[i].id)}/#{aps})" if aps != 0
end
self.contents.draw_text(32, i*32, 204, 32, text)
sp_cost = @data[i].sp_cost
if $tons_version != nil && $tons_version >= 6.54 &&
$game_system.SP_COST_MOD
sp_cost = BlizzCFG.get_cost_mod(@actor.states, sp_cost)
end
self.contents.draw_text(204, i*32, 48, 32, sp_cost.to_s, 2)
end
end
end
#==============================================================================
# Window_Item_Hotkey
#==============================================================================
class Window_Item_Hotkey < Window_Item
def initialize
super
@column_max = 1
self.width, self.height = 288, 480
self.x, self.y, self.z = 352, 64, 21000
self.cursor_rect.empty
self.active = false
refresh
end
def draw_item(i)
if @data[i] == nil
self.contents.font.color = normal_color
self.contents.draw_text(32, i*32, 212, 32, '<Remove>')
else
number = $game_party.item_number(@data[i].id)
if $game_party.item_can_use?(@data[i].id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.fill_rect(Rect.new(4, i*32, 256, 32), Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(@data[i].icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(4, 4+i*32, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(32, i*32, 212, 32, @data[i].name)
self.contents.draw_text(212, i*32, 16, 32, ':', 1)
self.contents.draw_text(228, i*32, 24, 32, number.to_s, 2)
end
end
end
#==============================================================================
# Scene_Hotkeys
#==============================================================================
class Scene_Hotkeys
def main
@spriteset = Spriteset_Map.new
@view = Viewport.new(0, 0, 640, 480)
@view.tone = @tone.clone
@hud = Hud.new if BlizzABS::Config::HUD_ENABLED && $game_system.hud
if BlizzABS::Config::HOTKEYS
@hotkeys = Hotkey_Assignment.new
@hotkeys.z = 5000
end
if BlizzABS::Config::MINIMAP && $game_system.minimap > 0
@minimap = Minimap.new
end
@choice = Sprite.new
@choice.bitmap = $BlizzABS.cache.image('menu_arrow')
@choice.x, @choice.y, @choice.z, @choice.opacity = 40, 192, 500, 128
@choice.angle = 90
@choice.ox = -8
@active = true
@index = 0
@up_mode = true
@skill_window = Window_Skill_Hotkey.new($game_player.battler)
@item_window = Window_Item_Hotkey.new
@last_active = true
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
@spriteset.dispose
[@hud, @hotkeys, @minimap].each {|s| s.dispose if s != nil}
@choice.dispose
@skill_window.dispose
@item_window.dispose
@view.dispose
while @party_leader != $game_party.actors[0]
$BlizzABS.player.switch_leader
end
end
def update
@choice.update
@skill_window.update
@item_window.update
@hotkeys.update if @hotkeys != nil
@choice.oy += (@up_mode ? (@active ? 2 : 1) : (@active ? -2 : -1))
@up_mode = (@up_mode ? (@choice.oy < 8) : (@choice.oy <= -8))
if $game_system.select_button && Input.trigger?(Input::Select)
$game_system.se_play($data_system.cursor_se)
$BlizzABS.player.switch_leader
@skill_window.switch_actor
@hud.update if @hud != nil
@hotkeys.update if @hotkeys != nil
elsif @active
@choice.oy = @choice.oy / 2 * 2
update_choice
elsif @skill_window.active
update_skill
elsif @item_window.active
update_item
end
end
def update_choice
@choice.y = 192 + @index * 32
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@active = false
@skill_window.active = @last_active
@item_window.active = (!@last_active)
elsif Input.repeat?(Input::DOWN)
if Input.trigger?(Input::DOWN) || @index < 9
$game_system.se_play($data_system.cursor_se)
@index = (@index + 1) % 10
end
elsif Input.repeat?(Input::UP)
if Input.trigger?(Input::UP) || @index >= 1
$game_system.se_play($data_system.cursor_se)
@index = (@index + 9) % 10
end
end
end
end
InstructionsIn the script in the first comment.
CompatibilityRequires Blizz-ABS to work. Not compatible with the SR display from CRLS (with CRLS-Blizz-ABS plugin), EOS and EXP in HUD plugin directly. For this HUD to work with them, they had to be edited in such a way to change the position of the bars that are being drawn.
Credits and Thanks
Author's NotesKeep in mind that this plugin comes UNDER Blizz-ABS. This script was done on request (so people stop asking) and is not fully supported by me as my other scripts are.
Here are template images that have been provided by other people.
Make sure you credit them if you use them!Save them on your hard drive and extract them in the Graphics/Pictures folder. They will work with the default configuration without problems.
Z-HUD template by Taiine (http://downloads.chaos-project.com/Z-HUD_template_by_Taiine.zip)
If you find any bugs, please report them here:
http://forum.chaos-project.com
That's it! N-Joy! =D
*drools*
You messed up on the screenshot though
.png.png XD
nice, nice. I have plans to redesign the Dissipate one to look like an MMO HUD. But that won't be for a while.
Quote from: Aqua on July 29, 2009, 04:36:01 pm
*drools*
You messed up on the screenshot though
.png.png XD
Actually I didn't. The link was fine in the post. :/ After I pressed "save" in the edit window without touching anything it suddenly started working. xD
:o looks awesome!
Quote from: Blizzard on July 29, 2009, 04:34:54 pm
You should NOT use those images in your game! They are here for demonstration purposes only!
Aw, but they look cool :xD:
Nice script Blizzy :)
(http://www.evermoondesigns.com/datas/medialibrary/2/New_HUD.png)
I actually requested this script, this is how it looks in my own game. Blizz added a few extra feature I didn't even ask for, so thank him for those, it is such a wonderful script and works quite smoothly. It's up to you to make your game beautiful.
Awesome Blizzard, Man u know everything about scripting that's neat!
Awesome blizzard! I <3 Blizz (Not to be taken literally ofc..)
There is a bug when you got to the hotkey menu. Screenshot of the bug
(http://i302.photobucket.com/albums/nn86/Juanito125/Other/ZHudHotkeyBug.jpg)
I'll fix it later.
EDIT: Done.
I might actually use this >.> now only to make custom images....Paint! :D
Quote from: Tazero on August 21, 2009, 09:25:01 pm
I might actually use this >.> now only to make custom images....Paint! :D
I make graphic arts for HUD's for commissions, starting at 15$ for the first hour and 10$ every hour after. Professional looking work, just shoot me an email or PM and I'll get back to you, if you wish.
would this be compatible with ur easy od system and with just regular bars for health and mp. and is there exp display?
Quote from: Blizzard on July 29, 2009, 04:34:54 pm
Compatibility
Requires Blizz-ABS to work. Not compatible with the SR display from CRLS (with CRLS-Blizz-ABS plugin), EOS and EXP in HUD plugin directly. For this HUD to work with them, they had to be edited in such a way to change the position of the bars that are being drawn.
My custom bars are on the top of the screen Full length!!! :evil:
Red n green ;D
Its a Great HUD, Its like plug n play!!!
(http://img22.imageshack.us/img22/2443/15483401.png)
Better bars coming
Aqua Edit:
Gosh... Spoiler that thing D:
This is cool. I think i´ll switch to this HUD instead of the regular, or winkios...
Sweet! :D
Wow, this is a really nice hud system. It works really well for what I had planned for changing my own game (I'm redoing a lot of the battle features). Just thought I'd share a screen shot of my hud.
(http://i33.tinypic.com/33ngp6x.png)
icons (except for that nut, I'm not sure who made it) are by aqua. the rest of the hud graphics were done by myself (you may cry out that the scroll looking things on the left are an RTP icon. Well I edited it to be large enough by imitating the shading of the original. I'll say that was enough work to qualify it as an original graphic :P)
Thanks for making this HUD blizz :D
I love how you did the hotkeys! I'd show mine off but all I changed was the HP/SP and never changed the hotkeys/skills/items graphics. I stopped working on my game temporarily (I've gotten into Neverwinter Nights modding lately, my interests are all over the place!).
*puts LB's screenshot as example screenshot* I hope you don't mind. :3
Quote from: Hellfire Dragon on July 29, 2009, 05:16:24 pm
:o looks awesome!
Quote from: Blizzard on July 29, 2009, 04:34:54 pm
You should NOT use those images in your game! They are here for demonstration purposes only!
Aw, but they look cool :xD:
Nice script Blizzy :)
Can we use them anyways blizzy? :3
No.
@Lethal-Yarn, I know how you feel. Trying to come up with skill/item graphics was a pain. But remember,
Quote from: game_guy on October 08, 2009, 12:40:51 pm
Can we use them anyways blizzy? :3
Quote from: Blizzard on October 08, 2009, 01:12:40 pm
No.
You've gotta use your own images before you can release the game.
@Blizz, sweet :D Glad it was good enough to be an example. Just out of curiosity, why don't you want anyone using those images?
I don't want to see half a million games with exactly the same HUD as I used for an example.
Blizz-ABS Z-HUD > Mog's XAS HUD and I'm not going to let the same happen what happened to Mog's HUD. I've seen so many games with the default HUD that I lost count.
Good thinking. It does sorta make a script look overused when EVERYONE has the default graphics in their game (Minkoff's side view, anyone?)
Well, if they still have the same basic layout, it'll still look boring.
(I'm already bored of seeing the hotkeys being on the left with the selected keys on the top right... -___-)
Then change it. It's not like it's hard or anything. :P
I don't use Z-Hud :P
Then don't complain. :P
I wasn't complain.
I was just stating my opinion...
D:
Lol, I know. I'm just messing with you. Switching the minimap and the hotkeys positions is editing 2 lines of code after all.
Umm... This may seem like a dumb thing to ask to you scripting gods, but how can i make it so that instead of having multiple health things, i´d have just one, since i changed it from a ball to a cauge...
Here is how it looks in my game:
(http://img10.imageshack.us/img10/6086/povzhudfull.png)
(http://img690.imageshack.us/img690/4734/povzhudunfull.png)
(http://img194.imageshack.us/img194/3946/povzhudwithminimap.png)
Good work. I love your mana bar.
Thank you, legacyblade. :)
I've run into a problem. In my CMS, I call the hotkeys window in the following manner,
$scene = Scene_Hotkeys.new(actor)
I get the following error.
Script 'Blizz-ABS Z-Hud' line 540: TypeError occured.
can't clone Fixnum
What am I doing wrong when calling the scene?
class Scene_Hotkeys
#----------------------------------------------------------------------------
# Initialization
# tone - screen background tone
#----------------------------------------------------------------------------
def initialize(tone = Tone.new(0, 0, 0, 0))
Scene_Hotkeys is called with a tone, not with an actor. The actor is automatically the player's actor.
how can i add a xp bar ?
do i need to script ? :p (i fail at scripting)
I'm making a plugin for it, it'll be released in about a week or two.
@blizz, I call the hotkeys from the main menu and you're allowed to select which actor you want. How would I modify the hotkeys scene to accept an actor as an argument?
Change "def initialize(tone = Tone.new(0, 0, 0, 0))" to "def initialize(tone = Tone.new(0, 0, 0, 0), index = 0)" and below change "@actor = $game_party.actors[0]" to "@actor = $game_party.actors[index]". I'll add that to the next Blizz-ABS version as well.
calling it from the menu screws up the window positioning of the hotkey menu. Any idea what's causing the problem? (I could make ya a demo if you need it)
Screenshot is enough.
(http://i48.tinypic.com/2dv0tcg.png)
Eh, I can't find any reasonable explanation why this is happening. -_- Demo me then.
Sorry to be asking for help so often, of late. Here's the demo. Pretty much the only thing in the menu that'll work is the hotkeys window (select tools for it) since I only included as much in the demo as needed to replicate the problem.
http://www.sendspace.com/file/w6cp4y
Its anyway for you to change the HP to a Bar, like the MP one?
Read the instructions... >.>
@LB: Fixed and put up a new version.
It's working great, except that all skills are grayed out (like they usually are when you can't use that skill). Also, it displays the SP cost next to the skill, rather than the amount of times you can cast it in the hotkey window.
I'm having a little trouble myself. I made my own graphics for the health bar and sp bar but it seems when I'm attacked that my health bar doesn't drop from side to side, but from up to down. Anyone with a solution?
(http://img41.imageshack.us/img41/6974/hudhp.png)
Quote from: legacyblade on December 18, 2009, 11:26:47 pm
It's working great, except that all skills are grayed out (like they usually are when you can't use that skill). Also, it displays the SP cost next to the skill, rather than the amount of times you can cast it in the hotkey window.
That's because the $game_temp.in_battle variable is set to false somewhere in your CMS. Set it to true (i.e. when you call the hotkeys scene) and it should work fine.
Quote from: KaiserSaix on December 20, 2009, 06:59:32 am
I'm having a little trouble myself. I made my own graphics for the health bar and sp bar but it seems when I'm attacked that my health bar doesn't drop from side to side, but from up to down. Anyone with a solution?(http://img41.imageshack.us/img41/6974/hudhp.png)
There's an option in the configuration for that. -_-
Thanks. It's fixed now :) Sorry for being so much trouble.
Don't worry about. You found a bug after all.
Now I have to ask does this support a background image for the hp bar and mp bar? Y'know just like a box picture or something so you can truly make custom Huds? Sorry if it does. I haven't had time to test and I'm typing this from my phone at the moment. :p thanks in advance.
Are you saying those images don't look like as if they had a background image for HP and SP?
Quote from: Blizzard on July 29, 2009, 04:34:54 pm
Screenshots
(http://img38.imageshack.us/img38/6383/snap916.th.png) (http://img38.imageshack.us/img38/6383/snap916.png) (http://img129.imageshack.us/img129/6411/newhud.th.png) (http://img129.imageshack.us/img129/6411/newhud.png) (http://img5.imageshack.us/img5/1031/33ngp6x.th.png) (http://img5.imageshack.us/img5/1031/33ngp6x.png) (http://img690.imageshack.us/img690/4734/povzhudunfull.th.png) (http://img690.imageshack.us/img690/4734/povzhudunfull.png)
No I mean like this
(http://img51.imageshack.us/img51/4042/sss2.png)
See how the HP and Mp bar has like a background image something along those lines.
I don't mean as flashy of course. But along those lines.
yes. The HUD is fully extensible, so all you need is a half-decent scripter and you can do anything you want with it. That stuff is not included in the default HUD because it is supposed to be generic. I think the purpose of this is to get games that actually look and feel different with Blizz-ABS, instead of all Blizz-ABS games using the same graphics and such.
It's like adding 3 lines of code.
My one weakness scripting. :) It took me forever just to edit BABS default HUD to show the currently equipped icon but I guess I could play around with it and find out. :D
Put this in today, and its giving me the error saying I need a more current version of blizz abs, even though I have 2.7
If you're sure you have the most recent version, just find and remove this bit.
if !$BlizzABS || BlizzABS::VERSION < 2.56
raise 'ERROR: The "Z-HUD" requires Blizz-ABS 2.56 or higher.'
end
I commented that section out and now I get this error
QuoteScript ' Z HUD [ABS 2.7]' line 111: NameError occurred.
undefined method 'create_positions' for class 'Hud'
That means you DON'T have the most updated version of blizzABS. Make sure to update (as in go download all three script parts) and then see if the problem persists. (remember, the demo is a really REALLY outdated version of blizzABS)
But I know for a fact I do, because just the other day Blizzard had to upload a new version of the compiler because it didnt get updated and it was throwing me an error :p
ill go check it out and then edit this post if anything changes
Edit: Yup, have the most current version.
Blizz-ABS 2.7 Package + Blizz-ABS Config 2.7
[ http://downloads.chaos-project.com/scripts/Blizz-ABS%202.7.zip ]
Right order?
http://forum.chaos-project.com/index.php/topic,23.0.html
Ummm, well he doesnt have zhud on there
and im using a different time system of his than whats on that one
but other than that, yeah
(http://i805.photobucket.com/albums/yy334/fthmdg/ScreenHunter_01Jan102132.gif?t=1263180781)
Try putting Z Hud DIRECTLY under blizz ABS. It's a blizzABS addon (and that's where he said to put them, in that chart)
oh did he? :/ i didnt see it on there haha my bad
gimme a sec, ill edit this post when i get it fixed up
Edit: That did the trick! Thanks a ton :D
Edit 2 : Could someone show me in the script where the positioning for the items/skill button are, as well as the height value for the hotkey bar? I cant find em and I need to move some stuff around to get it to look right. :/ Thanks
It says in the script instructions that you should put it below Blizz-ABS. -_-
Sorry blizz >.<
Could someone show me in the script where the positioning for the items/skill button are? I want to make the hud be in a different spot and i can't find the values in the script of how to move it around.
Update to v1.02b.
:^_^':
Please, I am trying to move the Skill and Item selected images to the bottom of the screen. I can't seem to find in the script where the cords are. I am also wondering if you can stand the HP and SP bars, I am not tiling, up right. If I need to explain that better or upload a image let me know. Thanks.
Edit: Someone already asked that and I found it. Never mind
Small update (not in the script but in the first post).
I don't mean to necro post in this, but I really like to know how to add the EXP bar to this so it can be drawn with custom graphics. I've been trying to add it in myself for a while now and so fare no luck. I really like to have it in. I';ve checked other UI scrips that include the exp and gold and try and use them as a base along with how the hp/sp bars are drawn, but it either kills the script or don't show anything.
I've done the same thing with how to draw the gold amount on the screen, but regardless of whats put in it wont show anything, even a 'hello world' draw text don't show squot.
Please, I love how Zhub works and looks, I don't want a whole other UI when this already has just what I want but lacking these two things.
Is there any method for changing the graphics in game?
id like to report a bug...
after toggle minimap on.. after moving into another map(or teleported on any location of that map)
the background disappears.. and also... it still shows up on gameover scene(right after the game over shows up...)
ill be susbcribing this post till further updates :D
thanks
Have you tried only Blizz-ABS and Z-HUD? It's possible that some custom script is messing with you.
i tried it... same case
you can only put the minimap bg back bye toggle-ing it again
im assure that i tried it on a very default gamesystem, no other scripts but that
EDITED:
this idea might help solving this issue=
after transporting to another map, let say.... toggle the minimap off, , just for every map transportation,
their only problem gonna be is..... keeping the minimap on after transporting from one to another location XD
I know what the problem probably is if it happens without any other scripts involved, but I won't be able to fix it until next week (since I won't be online). I hope you can wait until then. Just bump this topic next Monday so I don't forget.
Weird that nobody else noticed this bug so far.
Guess they dont mind bout it?, or maybe they didnt include this minimap featur in their game (and most of the ppl i know uses blizz abs dun use z-hud)
another bug report:
the BG of minimap still remains (just like in the "after scene" of game over scene) when your in the choice of "To Title Screen,End Game,Cancel" (after confirming END GAME on the default main menu)
:)
you might try it to be assure that it is a bug of the script not my system :P...
thanks....
Is it possible to change the hotkeys back into a horizontal display?
I don't honestly like this vertical display.
sorry for nicro post... but dose anyone have some demo pictures i can get? i just need to see how it all looks like.. it dosent matter if they are made in paint and is crappy, it is only for demo! i wont use them for my game..... Thanks in advance :)
I've found an interesting glitch. When you transfer to a new map, the minimap background image disappears. Toggling the minimap off and on again makes it reappear.
Quote from: Boba Fett Link on December 29, 2011, 04:52:51 pm
I've found an interesting glitch. When you transfer to a new map, the minimap background image disappears. Toggling the minimap off and on again makes it reappear.
Adding on to this...if you exit the game, the minimap background image is still there, even when you go back to the title screen and start a new game.
Also, if the minimap background has disappeared because of warping and you go to the menu, it will reappear after you exit the menu.
Sense the original graphics were taken down thanks to a certain someone. I'm offering a new set that may be used it's its place as 'default'. There boring and ugly, and if anyone thinks to truly for real use these, rather then use them as a base to make their own well.. there is something -badly- wrong with them.
ZHUD Template (http://www.mediafire.com/?0i045rg5ssny4hl)
Blizz, you're free to add the images to the first post, though maybe host it somewhere yourself just in case :3
Now onto a little request I've asked a few times before.
Can someone, PLEASE, edit the script to allow an image to be set in the background of the bars, and a level display? I have tried a number of times in the past to to it myself, people saying it's 'easy' well I am no scripter, even peeking at other scrips to try and figure it out only left me with a big mess.
I would really appreciate it if someone could make what should be a simple addiction to this script. I have a hud I made that I would adore to use but it can't unless I can split the bars, from the image 'holding' the bars.
I've mirrored your template at CP's server downloads.chaos-project.com and added a link to the first post.
Alright ;3 That should keep people happy.
I did forget a screen shot for it however.
(http://img37.imageshack.us/img37/111/regionuv.png)
There fix. Yep ugly and boring but that's why it's a template :P
Now, if I can just find someone to do the script edits for me...
btw, the map bg thing does still turn off when you change maps. I noticed that with the script alone when I was testing it out ^^
Edit: Still no one wants to edit this to add a background image behind the bars and level? or fix the mini maps bg so it don't poof with changing maps? ;(
*shakes head in disapproval* Adding a background images into the original code was literally 8 lines of code. And nobody could do that for Taiine? :facepalm: Sure, an extension code with aliasing would have been a few more lines. But 8 lines? Come on. :/
if BlizzCFG::Z_HUD_BACKGROUND != ''
@zhud_back = Sprite.new
@zhud_back.bitmap = RPG::Cache.picture(BlizzCFG::Z_HUD_BACKGROUND)
@zhud_back.z = self.z - 1
end
@zhud_back.dispose if @zhud_back != nil
@zhud_back = nil
Also, I fixed the minimap background problem when switching maps or opening the menu.
Thanks so much bliz. <3
But um.. what about the level display?
and also.. how doyou move the SP bar? I found out how to move the HP bar around by editing line 140
@hp_x, @hp_y, @sp_x, @sp_y = 25, 3, 0, b1.height + 8
But can't find where to edit to shft the sp bar.
(http://img580.imageshack.us/img580/5457/regionej.png)
sp_x/sp_y are the ones. They are actually all in that line.
@hp_x, @hp_y, @sp_x, @sp_y = 25, 3, 0, b1.height + 8
The "0" corresponds to sp_x and the "b1.height + 8" to sp_y. Feel free to change the first and add values to the second such as "b1.height" or "b1.height - 4" or "b1.height + 4".
Thanks again. Though (as seen in last shot) the tip of my hp bars getting cut off... it's not when it's pulled back... am I missing the width somewhere?
and still like a level display ^^;
Is it possible to do this?:
Z-HUD graphics1
Z-HUD graphics2
If a switch is on Z-HUD graphics1 are used, if it is off, Z-HUD graphics2 are used.
If possible, any idea how to?
Can we get a list of "Advanced Script" Commands that can be used for Z-HUD?
eg. Changing the HUD, Shutting off the HUD
Quote from: Blizzard on February 18, 2012, 06:44:47 am
*shakes head in disapproval* Adding a background images into the original code was literally 8 lines of code. And nobody could do that for Taiine? :facepalm: Sure, an extension code with aliasing would have been a few more lines. But 8 lines? Come on. :/
if BlizzCFG::Z_HUD_BACKGROUND != ''
@zhud_back = Sprite.new
@zhud_back.bitmap = RPG::Cache.picture(BlizzCFG::Z_HUD_BACKGROUND)
@zhud_back.z = self.z - 1
end
@zhud_back.dispose if @zhud_back != nil
@zhud_back = nil
Also, I fixed the minimap background problem when switching maps or opening the menu.
Was this added to the actually script of just a plugin? If it is a plugin what lines does it replace or need to be inserted at? I am doing a background with events right now and it is hard to get everything evented right to turn off and don correctly. This would make it much easier. Thanks for any help.
*EDIT* Grammar check :facepalm:
It was added to the script. I was just ranting how simple this edit was and nobody could take the 5 minutes to do it.
Thanks Blizz, I think mind might need updated then. :) :evil:
*EDIT* Nevermind, I found the problem don't have the picture setup right in the script.
Need to add my image name to the '' :facepalm:
if BlizzCFG::Z_HUD_BACKGROUND != ''
I just noticed that nobody answered some questions here while I was in the hospital. >_>
@Futendra: It's technically possible, but the script is configured once and that configuration cannot be changed while the game is running. You would have to get somebody to edit the script for you in order for you to be able to do that.
@AJNR95: Z-HUD has no special script commands. Everything you need is in Blizz-ABS. Z-HUD is basically an upgrade to Blizz-ABS's HUD. So everything that works for the default HUD in Blizz-ABS, works also for Z-HUD as if Z-HUD was the default HUD.
Is there a way to get the hud to disappear during interactions... or to have it gone during the maps where blizz abs is off because there are no enemies?
I don't know if making it invisible has been covered yet, it might be what you're talking about when layers were mentioned a couple pages back but i'm not sure.
Here's a screenshot where a picture is overlapped by the hud:
(http://www.theneonheart.com/images/zhudshow.png)
Thanks for the script.
Quote from: Blizzard on April 24, 2012, 05:44:14 pm
@AJNR95: Z-HUD has no special script commands. Everything you need is in Blizz-ABS. Z-HUD is basically an upgrade to Blizz-ABS's HUD. So everything that works for the default HUD in Blizz-ABS, works also for Z-HUD as if Z-HUD was the default HUD.
So just look up the commands in the manual.
If you want it hidden in maps without enemies, you can make that work using a parallel process common event that hides the HUD and disables the HUD button.
Has someone answered to JellalFerd question? Is it possible to move the hotkeys into a horizontal display?
Technically yes, but you will have to edit the script for that.
Try adding this after Z-HUD. I did it out of my head based on the Z-HUD code, but it should work.
#==============================================================================
# Hotkey_Assignment
#==============================================================================
class Hotkey_Assignment
def initialize(viewport = nil)
super
self.bitmap = Bitmap.new(320, 32)
self.bitmap.font.bold = true
self.bitmap.font.size -= 8
self.bitmap.font.color = system_color
self.x, self.y, self.z = 0, 448, 1100
@skills = BlizzABS::Cache::EmptyKeys
@items = BlizzABS::Cache::EmptyKeys
update
end
def draw(index = nil)
back = RPG::Cache.picture(BlizzCFG::Z_HOTKEYS_BACK)
w, h = back.width, back.height
ow, oh = (w - 24) / 2, (h - 24) / 2
(index == nil ? BlizzABS::Cache::HotkeyRange : [index]).each {|i|
if $game_player.skill_hotkeys[i%10] != 0
object = $data_skills[$game_player.skill_hotkeys[i%10]]
elsif $game_player.item_hotkeys[i%10] != 0
object = $data_items[$game_player.item_hotkeys[i%10]]
end
if @items[i%10] != $game_player.item_hotkeys[i%10] ||
@skills[i%10] != $game_player.skill_hotkeys[i%10]
self.bitmap.fill_rect(w*(i-1), 0, w, h, Color.new(0, 0, 0, 0))
self.bitmap.blt(w*(i-1), 0, back, Rect.new(0, 0, w, h))
if object != nil
bitmap = RPG::Cache.icon(object.icon_name)
self.bitmap.blt(w*(i-1)+ow, oh, bitmap, Rect.new(0, 0, 24, 24))
end
self.bitmap.draw_text_full(w*(i-1)+10, 0, w-2, 32, (i%10).to_s, 2)
end}
@items = $game_player.item_hotkeys.clone
@skills = $game_player.skill_hotkeys.clone
end
end
If it doesn't work, mess around with it a bit.
First thank you for reply. Second...It works but there are two little problems: when assigning the hotkeys I must choose from the original vertical hud...and the hotkeys numbers don't appear...
You'll have to find somebody to do that edit. :P
But...but...all of my dreams... :^_^': You were supposed to be The Chosen One
More like The Lazy One. xD
What should I change? I'm not very familiar with scripting...but I've edited some scripts to adapt them to my game...So where sholud I look? ^^
Hotkey_Assignment and Scene_Hotkeys. And you will need to edit the code in Scene_Map for the HUD to fade when you're at a certain position on the screen.
Thank you very much!
You're lucky that I'm in a good mood today. :P Here you go.
#==============================================================================
# Hotkey_Assignment
#==============================================================================
class Hotkey_Assignment
def initialize(viewport = nil)
super
self.bitmap = Bitmap.new(320, 32)
self.bitmap.font.bold = true
self.bitmap.font.size -= 8
self.bitmap.font.color = system_color
self.x, self.y, self.z = 0, 448, 1100
@skills = BlizzABS::Cache::EmptyKeys
@items = BlizzABS::Cache::EmptyKeys
update
end
def draw(index = nil)
back = RPG::Cache.picture(BlizzCFG::Z_HOTKEYS_BACK)
w, h = back.width, back.height
ow, oh = (w - 24) / 2, (h - 24) / 2
(index == nil ? BlizzABS::Cache::HotkeyRange : [index]).each {|i|
if $game_player.skill_hotkeys[i%10] != 0
object = $data_skills[$game_player.skill_hotkeys[i%10]]
elsif $game_player.item_hotkeys[i%10] != 0
object = $data_items[$game_player.item_hotkeys[i%10]]
end
if @items[i%10] != $game_player.item_hotkeys[i%10] ||
@skills[i%10] != $game_player.skill_hotkeys[i%10]
self.bitmap.fill_rect(32*(i-1), 0, 32, 32, Color.new(0, 0, 0, 0))
self.bitmap.fill_rect(32*(i-1)+4, 4, 24, 24, Color.new(0, 0, 0, 128))
self.bitmap.blt(w*(i-1), 0, back, Rect.new(0, 0, w, h))
if object != nil
bitmap = RPG::Cache.icon(object.icon_name)
self.bitmap.blt(32*(i-1)+4, 4, bitmap, Rect.new(0, 0, 24, 24))
end
self.bitmap.draw_text_full(32*(i-1), 10, 30, 32, (i%10).to_s, 2)
end}
@items = $game_player.item_hotkeys.clone
@skills = $game_player.skill_hotkeys.clone
end
end
#==============================================================================
# Window_Skill_Hotkey
#==============================================================================
class Window_Skill_Hotkey
def initialize(actor)
super
@column_max = 1
self.width, self.height = 320, 352
self.y, self.z = 64, 21000
self.cursor_rect.empty
self.active = false
refresh
end
end
#==============================================================================
# Window_Item_Hotkey
#==============================================================================
class Window_Item_Hotkey
def initialize
super
@column_max = 1
self.width, self.height = 320, 352
self.x, self.y, self.z = 320, 64, 21000
self.cursor_rect.empty
self.active = false
refresh
end
end
#==============================================================================
# Scene_Hotkeys
#==============================================================================
class Scene_Hotkeys
def main
@spriteset = Spriteset_Map.new
@view = Viewport.new(0, 0, 640, 480)
@view.tone = @tone.clone
@hud = Hud.new if BlizzABS::Config::HUD_ENABLED && $game_system.hud
if BlizzABS::Config::HOTKEYS
@hotkeys = Hotkey_Assignment.new
@hotkeys.z = 5000
end
if BlizzABS::Config::MINIMAP && $game_system.minimap > 0
@minimap = Minimap.new
end
@choice = Sprite.new
@choice.bitmap = $BlizzABS.cache.image('menu_arrow')
@choice.x, @choice.y, @choice.z, @choice.opacity = 24, 440, 500, 128
@choice.angle = 180
@choice.oy = -8
@active = true
@index = 0
@up_mode = true
@skill_window = Window_Skill_Hotkey.new($game_player.battler)
@item_window = Window_Item_Hotkey.new
@last_active = true
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
@spriteset.dispose
[@hud, @hotkeys, @minimap].each {|s| s.dispose if s != nil}
@choice.dispose
@skill_window.dispose
@item_window.dispose
@view.dispose
while @party_leader != $game_party.actors[0]
$BlizzABS.player.switch_leader
end
end
alias update_zhud_mod_alias update
def update
update_zhud_mod_alias
@choice.ox = 0
end
def update_choice
@choice.oy = @choice.oy / 2 * 2
@choice.x = 24 + @index * 32
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@active = false
@skill_window.active = @last_active
@item_window.active = (!@last_active)
elsif Input.repeat?(Input::RIGHT)
if Input.trigger?(Input::RIGHT) || @index < 9
$game_system.se_play($data_system.cursor_se)
@index = (@index + 1) % 10
end
elsif Input.repeat?(Input::LEFT)
if Input.trigger?(Input::LEFT) || @index >= 1
$game_system.se_play($data_system.cursor_se)
@index = (@index + 9) % 10
end
end
end
end
Remove the short script that I gave you earlier and put this under the original Z-HUD.
I'm more lucky than you think. I've managed to edit it by myself much earlier...I thanked you because you showed me what should I modify...Anyway...thanks again...I kept some of your code lines :haha:
Well....not so lucky right now :^_^':
(http://img805.imageshack.us/img805/4684/u1ntitledp.png)
How do I change the size of the hud font? It's so tiny...I've tried here
@hotkey_sprite.bitmap.font.size = but no effect...
Within Hotkey_Assignment use self.bitmap.font.size=
Thank you very much!
Is there a way to add an XP bar based on images? (like the hp/sp bar)
Yes, it is possible, just not in the script's current state. It shouldn't be much harder than copy-pasting the configuration and some of the drawing methods and tweaking them to use EXP values.
Can I ask for it? :^_^':
You need to first install this script (http://forum.chaos-project.com/index.php/topic,2254.0.html).
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Z-HUD for Blizz-ABS by Blizzard
# Version: 1.2b
# Type: Blizz-ABS Add-on
# Date: 29.7.2009
# Date v1.0b: 30.7.2009
# Date v1.01b: 17.12.2009
# Date v1.02b: 23.2.2010
# Date v1.2b: 18.2.2012
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This script is to be distributed under the same terms and conditions like
# the script it was created for: Blizz-ABS.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Information:
#
# This script must be placed below Blizz-ABS and requires Blizz-ABS v2.7 or
# higher to work properly. It will add a completely new HUD system for
# Blizz-ABS.
#
# Notes:
#
# Images are placed in the Graphics/Pictures folder. Be sure to set up the
# HUD height properly. Usually it is enough if it is the sum of the heights
# of the HP and the SP image. If you use tiling, you need to calculate the
# maximum possible height the HUD can be and then use that value. It is not
# recommended to use extremely high values as your HUD will cover too much of
# the screen and increase lag.
#
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
if !$BlizzABS || BlizzABS::VERSION < 2.7
raise 'ERROR: The "Z-HUD" requires Blizz-ABS 2.7 or higher.'
end
#==============================================================================
# module BlizzCFG
#==============================================================================
module BlizzCFG
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# maximum height of the HUD
Z_HUD_HEIGHT = 96
# background image for whole HUD (leave empty for none)
Z_HUD_BACKGROUND = ''
# tiling HP images
Z_HP_TILING = false
# displays as if the images are filled up (only when tiling)
Z_HP_FILL_UP = true
# how many columns are used for the tile in one row (only when tiling)
Z_HP_TILE_COLUMNS = 10
# how many HP per column (only when tiling)
Z_HP_PER_TILE = 500
# full image file
Z_HP_FILE = 'hud_SP'
# empty image file
Z_HP_FILE_EMPTY = 'hud_SP_empty'
# tiling SP images
Z_SP_TILING = false
# displays as if the images are filled up (only when tiling)
Z_SP_FILL_UP = true
# how many columns are used for the tile in one row (only when tiling)
Z_SP_TILE_COLUMNS = 10
# how many SP per column (only when tiling)
Z_SP_PER_TILE = 500
# full image file
Z_SP_FILE = 'hud_SP'
# empty image file
Z_SP_FILE_EMPTY = 'hud_SP_empty'
# tiling XP images
Z_XP_TILING = false
# displays as if the images are filled up (only when tiling)
Z_XP_FILL_UP = true
# how many columns are used for the tile in one row (only when tiling)
Z_XP_TILE_COLUMNS = 10
# how many XP per column (only when tiling)
Z_XP_PER_TILE = 100
# full image file
Z_XP_FILE = 'hud_SP'
# empty image file
Z_XP_FILE_EMPTY = 'hud_SP_empty'
# item hotkey background
Z_ITEM_BACK = 'item'
# skill hotkey background
Z_SKILL_BACK = 'skill'
# hotkeys display background
Z_HOTKEYS_BACK = 'hotkey'
# minimap background
Z_MINIMAP_BACK = 'minimap'
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
$blizzabs_z_hud = 1.2
end
#==============================================================================
# Hud
#==============================================================================
class Hud
attr_reader :hotkey_sprite
alias init_zhud_later initialize
def initialize(viewport = nil)
init_hotkey_sprite(viewport)
init_zhud_later(viewport)
self.x, self.y = 4, 4
@hotkey_sprite.z = self.z
if BlizzCFG::Z_HUD_BACKGROUND != ''
@zhud_back = Sprite.new
@zhud_back.bitmap = RPG::Cache.picture(BlizzCFG::Z_HUD_BACKGROUND)
@zhud_back.z = self.z - 1
end
end
alias create_positions_zhud_later create_positions
def create_positions
create_positions_zhud_later
b1 = RPG::Cache.picture(BlizzCFG::Z_HP_FILE)
b2 = RPG::Cache.picture(BlizzCFG::Z_SP_FILE)
if BlizzCFG::Z_HP_TILING
w = b1.width * BlizzCFG::Z_HP_TILE_COLUMNS
else
w = b1.width
end
@hud_width = w if @hud_width < w
if BlizzCFG::Z_SP_TILING
w = b2.width * BlizzCFG::Z_SP_TILE_COLUMNS
else
w = b2.width
end
@hud_width = w if @hud_width < w
@hud_height = BlizzCFG::Z_HUD_HEIGHT
@hp_x, @hp_y, @sp_x, @sp_y = 0, 0, 0, b1.height + 4
@exp_x, @exp_y = 0, @sp_y + b2.height + 4
update_sp_y
update_exp_y
b = RPG::Cache.picture(BlizzCFG::Z_ITEM_BACK)
@left_x = b.width
@left_y = b.height
@hot_x = b.width
end
def draw_basic
end
def draw_empty
end
def draw_name
end
def draw_level
end
def draw_hp
@hp, @maxhp = actor.hp, actor.maxhp
rate = (@maxhp > 0 ? @hp.to_f / @maxhp : 0)
b1 = RPG::Cache.picture(BlizzCFG::Z_HP_FILE)
b2 = RPG::Cache.picture(BlizzCFG::Z_HP_FILE_EMPTY)
if BlizzCFG::Z_HP_TILING
tiles = @maxhp / BlizzCFG::Z_HP_PER_TILE
rows = (tiles.to_f / BlizzCFG::Z_HP_TILE_COLUMNS).ceil
w, h = b1.width, b1.height
self.bitmap.fill_rect(@hp_x, @hp_y, w * BlizzCFG::Z_HP_TILE_COLUMNS,
h * rows, Color.new(0, 0, 0, 0))
full_tiles = (rate * tiles).to_i
semi_full = ((rate * tiles != full_tiles) ? 1 : 0)
(0...full_tiles).each {|i|
x = @hp_x + (i % BlizzCFG::Z_HP_TILE_COLUMNS) * w
y = @hp_y + (i / BlizzCFG::Z_HP_TILE_COLUMNS) * h
self.bitmap.blt(x, y, b1, Rect.new(0, 0, w, h))}
if semi_full > 0
x = @hp_x + (full_tiles % BlizzCFG::Z_HP_TILE_COLUMNS) * w
y = @hp_y + (full_tiles / BlizzCFG::Z_HP_TILE_COLUMNS) * h
if BlizzCFG::Z_HP_FILL_UP
h2 = ((1 - rate * tiles + full_tiles) * h).to_i
self.bitmap.blt(x, y, b2, Rect.new(0, 0, w, h2))
self.bitmap.blt(x, y + h2, b1, Rect.new(0, h2, w, h - h2))
else
w2 = ((rate * tiles - full_tiles) * w).to_i
self.bitmap.blt(x, y, b1, Rect.new(0, 0, w2, h))
self.bitmap.blt(x + w2, y, b2, Rect.new(w2, 0, w - w2, h))
end
end
((full_tiles + semi_full)...tiles).each {|i|
x = @hp_x + (i % BlizzCFG::Z_HP_TILE_COLUMNS) * w
y = @hp_y + (i / BlizzCFG::Z_HP_TILE_COLUMNS) * h
self.bitmap.blt(x, y, b2, Rect.new(0, 0, w, h))}
else
w1 = (b1.width * rate).to_i
w2 = b2.width - w1
self.bitmap.fill_rect(@hp_x, @hp_y, b1.width, b1.height, Color.new(0, 0, 0, 0))
self.bitmap.blt(@hp_x, @hp_y, b1, Rect.new(0, 0, w1, b1.height))
self.bitmap.blt(@hp_x + w1, @hp_y, b2, Rect.new(w1, 0, w2, b2.height))
end
draw_sp
end
def draw_sp
@sp, @maxsp = actor.sp, actor.maxsp
rate = (@maxsp > 0 ? @sp.to_f / @maxsp : 0)
b1 = RPG::Cache.picture(BlizzCFG::Z_SP_FILE)
b2 = RPG::Cache.picture(BlizzCFG::Z_SP_FILE_EMPTY)
if BlizzCFG::Z_SP_TILING
tiles = @maxsp / BlizzCFG::Z_SP_PER_TILE
rows = (tiles.to_f / BlizzCFG::Z_SP_TILE_COLUMNS).ceil
w, h = b1.width, b1.height
self.bitmap.fill_rect(@sp_x, @sp_y, w * BlizzCFG::Z_SP_TILE_COLUMNS,
h * rows, Color.new(0, 0, 0, 0))
full_tiles = (rate * tiles).to_i
semi_full = ((rate * tiles != full_tiles) ? 1 : 0)
(0...full_tiles).each {|i|
x = @sp_x + (i % BlizzCFG::Z_SP_TILE_COLUMNS) * w
y = @sp_y + (i / BlizzCFG::Z_SP_TILE_COLUMNS) * h
self.bitmap.blt(x, y, b1, Rect.new(0, 0, w, h))}
if semi_full > 0
x = @sp_x + (full_tiles % BlizzCFG::Z_SP_TILE_COLUMNS) * w
y = @sp_y + (full_tiles / BlizzCFG::Z_SP_TILE_COLUMNS) * h
if BlizzCFG::Z_SP_FILL_UP
h2 = ((1 - rate * tiles + full_tiles) * h).to_i
self.bitmap.blt(x, y, b2, Rect.new(0, 0, w, h2))
self.bitmap.blt(x, y + h2, b1, Rect.new(0, h2, w, h - h2))
else
w2 = ((rate * tiles - full_tiles) * w).to_i
self.bitmap.blt(x, y, b1, Rect.new(0, 0, w2, h))
self.bitmap.blt(x + w2, y, b2, Rect.new(w2, 0, w - w2, h))
end
end
((full_tiles + semi_full)...tiles).each {|i|
x = @sp_x + (i % BlizzCFG::Z_SP_TILE_COLUMNS) * w
y = @sp_y + (i / BlizzCFG::Z_SP_TILE_COLUMNS) * h
self.bitmap.blt(x, y, b2, Rect.new(0, 0, w, h))}
else
w1 = (b1.width * rate).to_i
w2 = b2.width - w1
self.bitmap.fill_rect(@sp_x, @sp_y, b1.width, b1.height, Color.new(0, 0, 0, 0))
self.bitmap.blt(@sp_x, @sp_y, b1, Rect.new(0, 0, w1, b1.height))
self.bitmap.blt(@sp_x + w1, @sp_y, b2, Rect.new(w1, 0, w2, b2.height))
end
end
#============================================================================
def draw_exp
rate = (actor.next_exp != 0 ? actor.now_exp.to_f / actor.next_exp : 1)
b1 = RPG::Cache.picture(BlizzCFG::Z_XP_FILE)
b2 = RPG::Cache.picture(BlizzCFG::Z_XP_FILE_EMPTY)
if BlizzCFG::Z_XP_TILING
tiles = actor.next_exp / BlizzCFG::Z_XP_PER_TILE
rows = (tiles.to_f / BlizzCFG::Z_XP_TILE_COLUMNS).ceil
w, h = b1.width, b1.height
self.bitmap.fill_rect(@exp_x, @exp_y, w * BlizzCFG::Z_XP_TILE_COLUMNS,
h * rows, Color.new(0, 0, 0, 0))
full_tiles = (rate * tiles).to_i
semi_full = ((rate * tiles != full_tiles) ? 1 : 0)
(0...full_tiles).each {|i|
x = @exp_x + (i % BlizzCFG::Z_XP_TILE_COLUMNS) * w
y = @exp_y + (i / BlizzCFG::Z_XP_TILE_COLUMNS) * h
self.bitmap.blt(x, y, b1, Rect.new(0, 0, w, h))}
if semi_full > 0
x = @exp_x + (full_tiles % BlizzCFG::Z_XP_TILE_COLUMNS) * w
y = @exp_y + (full_tiles / BlizzCFG::Z_XP_TILE_COLUMNS) * h
if BlizzCFG::Z_XP_FILL_UP
h2 = ((1 - rate * tiles + full_tiles) * h).to_i
self.bitmap.blt(x, y, b2, Rect.new(0, 0, w, h2))
self.bitmap.blt(x, y + h2, b1, Rect.new(0, h2, w, h - h2))
else
w2 = ((rate * tiles - full_tiles) * w).to_i
self.bitmap.blt(x, y, b1, Rect.new(0, 0, w2, h))
self.bitmap.blt(x + w2, y, b2, Rect.new(w2, 0, w - w2, h))
end
end
((full_tiles + semi_full)...tiles).each {|i|
x = @exp_x + (i % BlizzCFG::Z_XP_TILE_COLUMNS) * w
y = @exp_y + (i / BlizzCFG::Z_XP_TILE_COLUMNS) * h
self.bitmap.blt(x, y, b2, Rect.new(0, 0, w, h))}
else
w1 = (b1.width * rate).to_i
w2 = b2.width - w1
self.bitmap.fill_rect(@exp_x, @exp_y, b1.width, b1.height, Color.new(0, 0, 0, 0))
self.bitmap.blt(@exp_x, @exp_y, b1, Rect.new(0, 0, w1, b1.height))
self.bitmap.blt(@exp_x + w1, @exp_y, b2, Rect.new(w1, 0, w2, b2.height))
end
end
#============================================================================
def draw_hskill
@skill = actor.skill
b1 = RPG::Cache.picture(BlizzCFG::Z_SKILL_BACK)
@hotkey_sprite.bitmap.fill_rect(0, 0, b1.width, b1.height, Color.new(0, 0, 0, 0))
@hotkey_sprite.bitmap.blt(0, 0, b1, Rect.new(0, 0, b1.width, b1.height))
if @skill != 0
bitmap = RPG::Cache.icon($data_skills[@skill].icon_name)
x, y = (b1.width - 24) / 2, (b1.height - 24) / 2
@hotkey_sprite.bitmap.blt(x, y, bitmap, Rect.new(0, 0, 24, 24))
end
draw_lskill
end
def draw_lskill
@hotkey_sprite.bitmap.fill_rect(0, @left_y + 4, @left_x, 16, Color.new(0, 0, 0, 0))
@skills_left = get_skills_left
if @skill != nil && @skill > 0
if @skills_left >= 0
if @skills_left == 0
@hotkey_sprite.bitmap.font.color = Color.new(255, 0, 0)
elsif @skills_left <= 5
@hotkey_sprite.bitmap.font.color = Color.new(255, 255, 0)
else
@hotkey_sprite.bitmap.font.color = normal_color
end
@hotkey_sprite.bitmap.font.size -= 2
@hotkey_sprite.bitmap.draw_text_full(0, @left_y, @left_x, 20, @skills_left.to_s, 1)
@hotkey_sprite.bitmap.font.size += 2
elsif @skills_left == -1
@hotkey_sprite.bitmap.font.color = Color.new(0, 255, 0)
@hotkey_sprite.bitmap.font.size += 4
@hotkey_sprite.bitmap.draw_text_full(0, @left_y, @left_x, 20, '∞', 1)
@hotkey_sprite.bitmap.font.size -= 4
end
end
end
def draw_hitem
@item = actor.item
b1 = RPG::Cache.picture(BlizzCFG::Z_SKILL_BACK)
b2 = RPG::Cache.picture(BlizzCFG::Z_ITEM_BACK)
x = b1.width + 4
@hotkey_sprite.bitmap.fill_rect(x, 0, b2.width, b2.height, Color.new(0, 0, 0, 0))
@hotkey_sprite.bitmap.blt(x, 0, b2, Rect.new(0, 0, b2.width, b2.height))
if @item != 0
bitmap = RPG::Cache.icon($data_items[@item].icon_name)
x, y = b1.width + 4 + (b2.width - 24) / 2, (b2.height - 24) / 2
@hotkey_sprite.bitmap.blt(x, y, bitmap, Rect.new(0, 0, 24, 24))
end
draw_litem
end
def draw_litem
@items_left = $game_party.item_number(@item)
@hotkey_sprite.bitmap.fill_rect(@left_x + 4, @left_y + 4, @left_x, 16, Color.new(0, 0, 0, 0))
if @item != nil && @item > 0
if $data_items[@item] != nil && !$data_items[@item].consumable
@hotkey_sprite.bitmap.font.color = Color.new(0, 255, 0)
@hotkey_sprite.bitmap.font.size += 4
@hotkey_sprite.bitmap.draw_text_full(@left_x + 4, @left_y, @left_x, 20, '∞', 1)
@hotkey_sprite.bitmap.font.size -= 4
else
if @items_left == 0
@hotkey_sprite.bitmap.font.color = Color.new(255, 0, 0)
elsif @items_left <= 10
@hotkey_sprite.bitmap.font.color = Color.new(255, 255, 0)
else
@hotkey_sprite.bitmap.font.color = normal_color
end
@hotkey_sprite.bitmap.font.size -= 2
@hotkey_sprite.bitmap.draw_text_full(@left_x + 4, @left_y, @left_x, 20, @items_left.to_s, 1)
@hotkey_sprite.bitmap.font.size += 2
end
end
end
alias update_zhud_later update
def update
if actor != nil
update_sp_y
update_exp_y
end
update_zhud_later
end
def update_sp_y
return if !BlizzCFG::Z_HP_TILING
b1 = RPG::Cache.picture(BlizzCFG::Z_HP_FILE)
tiles = actor.maxhp / BlizzCFG::Z_HP_PER_TILE
@sp_y = (tiles.to_f / BlizzCFG::Z_HP_TILE_COLUMNS).ceil * b1.height
end
def update_exp_y
b1 = RPG::Cache.picture(BlizzCFG::Z_SP_FILE)
if BlizzCFG::Z_SP_TILING
tiles = actor.maxsp / BlizzCFG::Z_SP_PER_TILE
@exp_y = (tiles.to_f / BlizzCFG::Z_SP_TILE_COLUMNS).ceil * b1.height + @sp_y
else
@exp_y = @sp_y + b1.height + 4
end
end
alias dispose_zhud_later dispose
def dispose
@hotkey_sprite.dispose if @hotkey_sprite != nil
@hotkey_sprite = nil
@zhud_back.dispose if @zhud_back != nil
@zhud_back = nil
dispose_zhud_later
end
def init_hotkey_sprite(viewport)
b1 = RPG::Cache.picture(BlizzCFG::Z_ITEM_BACK)
b2 = RPG::Cache.picture(BlizzCFG::Z_SKILL_BACK)
width = b1.width + b2.width
@hotkey_sprite = Sprite.new(viewport)
@hotkey_sprite.x = 632 - width
@hotkey_sprite.y = 4
@hotkey_sprite.bitmap = Bitmap.new(width + 4, b1.height + 24)
@hotkey_sprite.bitmap.font.name = 'Arial'
@hotkey_sprite.bitmap.font.size = 16
@hotkey_sprite.bitmap.font.bold = true
end
end
#==============================================================================
# Hotkey_Assignment
#==============================================================================
class Hotkey_Assignment
def initialize(viewport = nil)
super
self.bitmap = Bitmap.new(32, 320)
self.bitmap.font.bold = true
self.bitmap.font.size -= 8
self.bitmap.font.color = system_color
self.x, self.y, self.z = 0, 160, 1100
@skills = BlizzABS::Cache::EmptyKeys
@items = BlizzABS::Cache::EmptyKeys
update
end
def draw(index = nil)
back = RPG::Cache.picture(BlizzCFG::Z_HOTKEYS_BACK)
w, h = back.width, back.height
ow, oh = (w - 24) / 2, (h - 24) / 2
(index == nil ? BlizzABS::Cache::HotkeyRange : [index]).each {|i|
if $game_player.skill_hotkeys[i%10] != 0
object = $data_skills[$game_player.skill_hotkeys[i%10]]
elsif $game_player.item_hotkeys[i%10] != 0
object = $data_items[$game_player.item_hotkeys[i%10]]
end
if @items[i%10] != $game_player.item_hotkeys[i%10] ||
@skills[i%10] != $game_player.skill_hotkeys[i%10]
self.bitmap.fill_rect(0, h*(i-1), w, h, Color.new(0, 0, 0, 0))
self.bitmap.blt(0, h*(i-1), back, Rect.new(0, 0, w, h))
if object != nil
bitmap = RPG::Cache.icon(object.icon_name)
self.bitmap.blt(ow, h*(i-1)+oh, bitmap, Rect.new(0, 0, 24, 24))
end
self.bitmap.draw_text_full(0, h*(i-1)+10, w-2, 32, (i%10).to_s, 2)
end}
@items = $game_player.item_hotkeys.clone
@skills = $game_player.skill_hotkeys.clone
end
end
#==============================================================================
# Minimap
#==============================================================================
class Minimap
alias update_zhud_later update
def update(override = false)
update_zhud_later(override)
update_minimap_back
end
def update_minimap_back
if $game_system.minimap == 1
if @minimap_back == nil
@minimap_back = Sprite.new
@minimap_back.bitmap = RPG::Cache.picture(BlizzCFG::Z_MINIMAP_BACK)
@minimap_back.x = self.vx - (@minimap_back.bitmap.width - self.vw) / 2
@minimap_back.y = self.vy - (@minimap_back.bitmap.height - self.vh) / 2
@minimap_back.z = self.z + 1
@minimap_back.opacity = self.opacity
end
elsif @minimap_back != nil
@minimap_back.dispose
@minimap_back = nil
end
end
alias opacity_is_zhud_later opacity=
def opacity=(value)
opacity_is_zhud_later(value)
@minimap_back.opacity = value if @minimap_back != nil
end
alias dispose_zhud_later dispose
def dispose
dispose_zhud_later
@minimap_back.dispose if @minimap_back != nil
@minimap_back = nil
end
end
#==============================================================================
# Scene_Map
#==============================================================================
class Scene_Map
alias hud_update_zhud_later hud_update
def hud_update
hud_update_zhud_later
if @hud != nil
s = @hud.hotkey_sprite
s.update
if $game_player.screen_x < s.vx + s.vw + 16 &&
$game_player.screen_y < s.vy + s.vh + 48 &&
$game_player.screen_x > s.vx && $game_player.screen_y > s.vy
s.opacity -= 25 if s.opacity > 80
elsif s.opacity <= 255
s.opacity += 25
end
end
end
end
#==============================================================================
# Window_Skill_Hotkey
#==============================================================================
class Window_Skill_Hotkey < Window_Skill
def initialize(actor)
super
@column_max = 1
self.width, self.height = 288, 480
self.x, self.y, self.z = 64, 64, 21000
self.cursor_rect.empty
self.active = false
refresh
end
def draw_item(i)
if @data[i] == nil
self.contents.font.color = normal_color
self.contents.draw_text(32, i*32, 204, 32, '<Remove>')
else
if @actor.skill_can_use?(@data[i].id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.fill_rect(Rect.new(4, i*32, 256, 32), Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(@data[i].icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(4, 4+i*32, bitmap, Rect.new(0, 0, 24, 24), opacity)
text = @data[i].name
if @actor.skills.include?(@data[i].id) &&
$tons_version != nil && $tons_version >= 3.7 &&
TONS_OF_ADDONS::EQUAP_SKILLS && DISPLAY_AP_REQ
aps = BlizzCFG.maxap(@data[i].id)
text = "#{text} (#{@actor.ap(@data[i].id)}/#{aps})" if aps != 0
end
self.contents.draw_text(32, i*32, 204, 32, text)
sp_cost = @data[i].sp_cost
if $tons_version != nil && $tons_version >= 6.54 &&
$game_system.SP_COST_MOD
sp_cost = BlizzCFG.get_cost_mod(@actor.states, sp_cost)
end
self.contents.draw_text(204, i*32, 48, 32, sp_cost.to_s, 2)
end
end
end
#==============================================================================
# Window_Item_Hotkey
#==============================================================================
class Window_Item_Hotkey < Window_Item
def initialize
super
@column_max = 1
self.width, self.height = 288, 480
self.x, self.y, self.z = 352, 64, 21000
self.cursor_rect.empty
self.active = false
refresh
end
def draw_item(i)
if @data[i] == nil
self.contents.font.color = normal_color
self.contents.draw_text(32, i*32, 212, 32, '<Remove>')
else
number = $game_party.item_number(@data[i].id)
if $game_party.item_can_use?(@data[i].id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.fill_rect(Rect.new(4, i*32, 256, 32), Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(@data[i].icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(4, 4+i*32, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(32, i*32, 212, 32, @data[i].name)
self.contents.draw_text(212, i*32, 16, 32, ':', 1)
self.contents.draw_text(228, i*32, 24, 32, number.to_s, 2)
end
end
end
#==============================================================================
# Scene_Hotkeys
#==============================================================================
class Scene_Hotkeys
def main
@spriteset = Spriteset_Map.new
@view = Viewport.new(0, 0, 640, 480)
@view.tone = @tone.clone
@hud = Hud.new if BlizzABS::Config::HUD_ENABLED && $game_system.hud
if BlizzABS::Config::HOTKEYS
@hotkeys = Hotkey_Assignment.new
@hotkeys.z = 5000
end
if BlizzABS::Config::MINIMAP && $game_system.minimap > 0
@minimap = Minimap.new
end
@choice = Sprite.new
@choice.bitmap = $BlizzABS.cache.image('menu_arrow')
@choice.x, @choice.y, @choice.z, @choice.opacity = 40, 192, 500, 128
@choice.angle = 90
@choice.ox = -8
@active = true
@index = 0
@up_mode = true
@skill_window = Window_Skill_Hotkey.new($game_player.battler)
@item_window = Window_Item_Hotkey.new
@last_active = true
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
@spriteset.dispose
[@hud, @hotkeys, @minimap].each {|s| s.dispose if s != nil}
@choice.dispose
@skill_window.dispose
@item_window.dispose
@view.dispose
while @party_leader != $game_party.actors[0]
$BlizzABS.player.switch_leader
end
end
def update
@choice.update
@skill_window.update
@item_window.update
@hotkeys.update if @hotkeys != nil
@choice.oy += (@up_mode ? (@active ? 2 : 1) : (@active ? -2 : -1))
@up_mode = (@up_mode ? (@choice.oy < 8) : (@choice.oy <= -8))
if $game_system.select_button && Input.trigger?(Input::Select)
$game_system.se_play($data_system.cursor_se)
$BlizzABS.player.switch_leader
@skill_window.switch_actor
@hud.update if @hud != nil
@hotkeys.update if @hotkeys != nil
elsif @active
@choice.oy = @choice.oy / 2 * 2
update_choice
elsif @skill_window.active
update_skill
elsif @item_window.active
update_item
end
end
def update_choice
@choice.y = 192 + @index * 32
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@active = false
@skill_window.active = @last_active
@item_window.active = (!@last_active)
elsif Input.repeat?(Input::DOWN)
if Input.trigger?(Input::DOWN) || @index < 9
$game_system.se_play($data_system.cursor_se)
@index = (@index + 1) % 10
end
elsif Input.repeat?(Input::UP)
if Input.trigger?(Input::UP) || @index >= 1
$game_system.se_play($data_system.cursor_se)
@index = (@index + 9) % 10
end
end
end
end
Paste this below the 'EXP in HUD' script. Looked functioning on my end.
Thanks for helping me! But...I have some problems...the script gives me a error.
(http://img197.imageshack.us/img197/7985/85229451.png)
The order of scripts is right.
Z-Hud
Exp Bar
And this script
BlizzABS
EXP in HUD
My edit
Thank you very much!
Now...I have another issue (sorry for bothering you guys :^_^':). I can't understand why modifying @exp_y still dosen't affect the exp bar position. It only works if I modify @exp_x. Any ideas?
That's handled in the method update_exp_y. If you're trying to change @exp_y in create_positions it's not going to work.
Thank you again! You're the best!!! 8)
Sorry again for asking stupid questions on inactive topics...but is there a way to disable that fade effect when walking under the hud?
EDIT: Also I'm trying to make one of the hp/sp bar to fill in the opposite direction of the other one. Is it possible? I think my problem can be solved somewhere here:
else
w1 = (b1.width * rate).to_i
w2 = b2.width - w1
self.bitmap.fill_rect(@sp_x, @sp_y, b1.width, b1.height, Color.new(0, 0, 0, 0))
self.bitmap.blt(@sp_x, @sp_y, b1, Rect.new(0, 0, w1, b1.height))
self.bitmap.blt(@sp_x + w1, @sp_y, b2, Rect.new(w1, 0, w2, b2.height))
end
end
EDIT #2 :
Now I've found another issue...If i use a Z_HUD_BACKGROUND my hotkey bar is behind the background. Can I bring it in front of it? Also can I make the space between hotkeys bigger?
Thanks in advance!
Place below BlizzABS
class Scene_Map
#----------------------------------------------------------------------------
# hud_update
# Contains a couple of routine calls to handle with the HUD.
#----------------------------------------------------------------------------
def hud_update
# check activation of HUD parts
check_huds
# update minimap
update_minimap
# update hotkey assignment display
update_hotkeys
# iterate through all the HUD sprites
[@hud, @minimap, @hotkeys].each {|s|
# if sprite exists
if s != nil
# update sprite
s.update
end
}
end
end
Yes, you are correct. It's merely the opposite of what you see.
w1 = (b1.width * rate).to_i
w2 = b2.width - w1
self.bitmap.fill_rect(@hp_x, @hp_y, b1.width, b1.height, Color.new(0, 0, 0, 0))
self.bitmap.blt(@hp_x + w2, @hp_y, b1, Rect.new(w2, 0, w1, b1.height))
self.bitmap.blt(@hp_x, @hp_y, b2, Rect.new(0, 0, w2, b2.height))
You'll need to explain your HUD background more. I can see my hotkeys perfectly fine (as well as the image held in Z_HOTKEYS_BACK ). I'm also pretty sure I have explained to you before about how to change the spacing between the hotkeys.
Firstly, thank you very very much for helping me...again. I do not know what I would have done without you.
Secondly, the opacity thing works, but the hp/sp bar code is not working. I've edited the hp_x,hp_y etc. for the sp bar but it's not even working for neither of them (with proper modification for hp/sp).
Lastly, regarding the spacing between the hotkeys, I forgot to inform you that I've tried what you first showed me:
Quote from: KK20 on September 05, 2011, 02:46:29 pm
Interesting, because mine didn't do that. Your edit looks like this, right?: #----------------------------------------------------------------------------
# draw
# Draws the recharge sectors over the hotkey display.
#----------------------------------------------------------------------------
def draw(index = nil)
# iterate through all skills that need to be recharged
(@skillrecharge).each {|i|
# temporary var
object = $data_skills[$game_player.skill_hotkeys[i%10]]
ind = $game_player.skill_hotkeys[i%10]+1
if $game_player.recharging?(ind)
# remove old image
self.bitmap.fill_rect(32*(i-1), 0, 32, 32, Color.new(0, 0, 0, 0))
# draw recharge indicator
len = (24*$game_player.rech_rate(ind)).to_i
self.bitmap.fill_rect(32*(i-1)+4, 0, len, 4, Color.new(255, 255, 0))
self.bitmap.fill_rect(32*(i-1)+4, 4, 24, 24, Color.new(0, 0, 0, 127))
self.bitmap.draw_text_full(32*(i-1)+4, 4, 24, 24, (($game_player.rechcounter[ind]/40).to_i+1).to_s, 1)
else
if object != nil
# remove old image
self.bitmap.fill_rect(32*(i-1), 0, 32, 32, Color.new(0, 0, 0, 0))
end
@skillrecharge.delete(i)
end}
# iterate through all items that need to be recharged
(@itemrecharge).each {|i|
# temporary var
object = $data_items[$game_player.item_hotkeys[i%10]]
ind = $game_player.item_hotkeys[i%10]+1
if $game_player.recharging?(ind)
# remove old image
self.bitmap.fill_rect(32*(i-1), 0, 32, 32, Color.new(0, 0, 0, 0))
# draw recharge indicator
len = (24*$game_player.rech_rate(ind)).to_i
self.bitmap.fill_rect(32*(i-1)+4, 0, len, 4, Color.new(255, 255, 0))
self.bitmap.draw_text_full(32*(i-1)+4, 4, 24, 24, (($game_player.rechcounter[ind]/40).to_i+1).to_s, 1)
else
if object != nil
# remove old image
self.bitmap.fill_rect(32*(i-1), 0, 32, 32, Color.new(0, 0, 0, 0))
end
@itemrecharge.delete(i)
end}
end
Your hotkeys look customized. If so, the spacing between the hotkeys could be different than the default ones. In that case, you will have to change the four in 32*(i-1)+4 into something smaller I think.
And this time, changing 32*(i-1)+4 does nothing. I think it's because of the Z-Hud that rewrites the way of displaying the hotkeys (just my guess)
I've sent you a message with a link to download an example of my project. Maybe you can easily understand what I want if you see it.
Thanks again! I can't wait to hear from you!
HP/SP Graphic:
Your empty graphics should be the same dimensions as the full graphics. Also, your edit to the drawing coordinates didn't look anything like what I posted.
w1 = (b1.width * rate).to_i
w2 = b1.width - w1
self.bitmap.fill_rect(@sp_x, @sp_y, b1.width, b1.height, Color.new(0, 0, 0, 0))
self.bitmap.blt(@sp_x + w2, @sp_y, b1, Rect.new(w2, 0, w1, b1.height))
self.bitmap.blt(@sp_x, @sp_y, b2, Rect.new(0, 0, w2, b2.height))
Spacing:
You're referencing the skill cooldown script by winkio. That code only moves the cooldown-related graphics (rectangle timer, black overlay, etc.). It doesn't modify the hotkeys' coordinates themselves. You will want to edit this under Hotkey_Assignment:
def draw(index = nil)
back = RPG::Cache.picture(BlizzCFG::Z_HOTKEYS_BACK)
w, h = back.width, back.height
ow, oh = (w - 24) / 2, (h - 24) / 2
(index == nil ? BlizzABS::Cache::HotkeyRange : [index]).each {|i|
if $game_player.skill_hotkeys[i%10] != 0
object = $data_skills[$game_player.skill_hotkeys[i%10]]
elsif $game_player.item_hotkeys[i%10] != 0
object = $data_items[$game_player.item_hotkeys[i%10]]
end
if @items[i%10] != $game_player.item_hotkeys[i%10] ||
@skills[i%10] != $game_player.skill_hotkeys[i%10]
self.bitmap.fill_rect(w*(i-1)+4, 0, w, h, Color.new(0, 0, 0, 0)) #<==== These lines
self.bitmap.blt(w*(i-1)+4, 0, back, Rect.new(0, 0, w, h)) #<====
if object != nil
bitmap = RPG::Cache.icon(object.icon_name)
self.bitmap.blt(w*(i-1)+ow+4, oh+1, bitmap, Rect.new(0, 0, 24, 24)) #<====
end
self.bitmap.draw_text_full(w*(i-1)+4, 0, w-2, 65, (i%10).to_s, 1) #<====
end}
@items = $game_player.item_hotkeys.clone
@skills = $game_player.skill_hotkeys.clone
end
As for the background drawing over the hotkeys, it was a matter of z-values.
class Hotkey_Assignment
def initialize(viewport = nil)
super
self.bitmap = Bitmap.new(438, 55)
self.bitmap.font.bold = true
self.bitmap.font.size -= 4
self.bitmap.font.color = system_color
self.x, self.y, self.z = 292, 491, 110 #<======= This should be 1100. No idea how this was changed.
@skills = BlizzABS::Cache::EmptyKeys
@items = BlizzABS::Cache::EmptyKeys
update
end
Tons of thanks, my dear scripter! :-*
Everything works...except the spacing between hotkeys. I'm trying to change this values : w*(i-1)+4 in all that 4 lines but it's not working. It just moves all the hotkeys to right or to left. It does not increase the space between them. I can't really understand how might work, because I've also try to test the lines one by one but I cant get the desired effect. It's really annoying...am I modyifing the right value?
Also the hp/sp works now but strangely the empty bar should be named like the normal one and viceversa. But works for me...no issue!
:roll: Oh yeah, forgot that I changed the bitmaps.
w1 = (b1.width * rate).to_i
w2 = b2.width - w1
self.bitmap.fill_rect(@sp_x, @sp_y, b1.width, b1.height, Color.new(0, 0, 0, 0))
self.bitmap.blt(@sp_x + w2, @sp_y, b1, Rect.new(w2, 0, w1, b1.height))
self.bitmap.blt(@sp_x, @sp_y, b2, Rect.new(0, 0, w2, b2.height))
And I guess you should modify this line for the hotkeys
w, h = back.width, back.height
to something like
w, h = back.width + 5, back.height + 5
( Me trying to imitate a lady voice singing for KK20: "You're simply the beeeest!" )
Yep. That line was the pain...Thank you again! If I can do something for you just PM me! I'll try to make it up to you.
Sorry to necro, I seem to be having a problem with the copy/paste breaking the script..
http://forum.chaos-project.com/index.php/topic,14599.0.html