ich benutze dein script was du mir gegeben hattest :P
version 1.5 RC
da gibt es nichts mit switch id, auch nicht im ganzen restlichen forum.
weil das script refresch map verändert wurde und es nicht möglich ist einfach mal so schnell nen bild auf den screen löschen oder zu aktivieren.
für scripte wie ilumino müsste man aus ner map rausgehen und wieder reingehen kommplet damit dieses dann aktiv ist,
#Korrekturwerte für die Beschriftung (Positiv und Negativ)
HP_X = 15
HP_Y = 2
MP_X = 15
MP_Y = 2
EXP_X = 15
EXP_Y = 2
#Farben für die Beschriftung
HP_COLOR = Color.new(0,0,0,255)
MP_COLOR = Color.new(0,0,0,255)
EXP_COLOR = Color.new(0,0,0,255)
#==============================================================================
# Vampyr Hud
#==============================================================================
if Vampyr_Kernel.enabled?("Vampyr Net ABS")
#------------------------------------------------------------------------------
Vampyr_Kernel.register("Vampyr HUD", 1.1, "12/06/2009")
#------------------------------------------------------------------------------
class Sprite
def in_area?(args=[0, 0, self.bitmap.width, self.bitmap.height])
if $mouse.x.between?(self.x+args[0], self.x+args[0]+args[2]) and
$mouse.y.between?(self.y+args[1], self.y+args[1]+args[3])
return true
end
return false
end
def draw_icon(icon, x, y)
rect = Rect.new(icon%16*24, icon/16*24, 24, 24)
self.bitmap.blt(x, y, Cache.system("Iconset"), rect)
end
end
#------------------------------------------------------------------------------
class Vampyr_HUD1 < Sprite
def initialize(viewport)
super(viewport)
self.x, self.y = 1, 1
@base = Cache.system("Actor Base")
@hpbar = Cache.system("Actor HP Bar")
@mpbar = Cache.system("Actor MP Bar")
@expbar = Cache.system("Actor Exp Bar")
self.bitmap = Bitmap.new(156, 64)
self.bitmap.font.size = 16
$windows << self
refresh
end
def update
super
refresh if something_changed?
end
def refresh
return if $actor == nil
@old_hp = $actor.hp
@old_maxhp = $actor.maxhp
@old_mp = $actor.mp
@old_maxmp = $actor.maxmp
@old_exp = $actor.exp
self.bitmap.clear
draw_hpbar($actor, 0, 0)
draw_mpbar($actor, 0, 20)
draw_expbar($actor, 0, 40) if $actor.next_exp > 0
end
def draw_hpbar(actor, x, y)
self.bitmap.draw_outlined_text(x, y, 24, 16, Vocab::hp_a, 0, Color.new(255,255,255))
rect = Rect.new(0, 0, @hpbar.width*actor.hp/actor.maxhp, @hpbar.height)
self.bitmap.blt(x+24, y, @base, @base.rect)
self.bitmap.blt(x+24, y, @hpbar, rect)
self.bitmap.font.color = HP_COLOR
self.bitmap.draw_text(x + HP_X, y + HP_Y, 44, 16, actor.hp, 2)
self.bitmap.draw_text(x + 54 + HP_X, y + HP_Y, 44, 16, actor.maxhp, 2)
self.bitmap.font.color = Font.default_color
self.bitmap.draw_text(x + 44 + HP_X, y + HP_Y, 11, 16, "/", 2)
end
def draw_mpbar(actor, x, y)
self.bitmap.draw_outlined_text(x, y, 24, 16, Vocab::mp_a, 0, Color.new(255,255,255))
rect = Rect.new(0, 0, @mpbar.width*actor.mp/actor.maxmp, @mpbar.height)
self.bitmap.blt(x+24, y, @base, @base.rect)
self.bitmap.blt(x+24, y, @mpbar, rect)
self.bitmap.font.color = MP_COLOR
self.bitmap.draw_text(x+ MP_X, y + MP_Y, 44, 16, actor.mp, 2)
self.bitmap.draw_text(x+ MP_X + 54, y + MP_Y, 44, 16, actor.maxmp, 2)
self.bitmap.font.color = Font.default_color
self.bitmap.draw_text(x+ MP_X + 44, y + MP_Y, 11, 16, "/", 2)
end
def draw_expbar(actor, x, y)
self.bitmap.draw_outlined_text(x, y, 24, 16, "Exp", 0, Color.new(255,255,255))
rect = Rect.new(0, 0, @expbar.width*actor.current_exp/actor.next_exp, @expbar.height)
self.bitmap.blt(x+24, y, @base, @base.rect)
self.bitmap.blt(x+24, y, @expbar, rect)
exp = (actor.current_exp*100) / actor.next_exp
self.bitmap.font.color = EXP_COLOR
self.bitmap.draw_text(x + EXP_X, y + EXP_Y, 44, 16, exp, 2)
self.bitmap.font.color = Font.default_color
self.bitmap.draw_text(x + 44 + EXP_X, y + EXP_Y, 11, 16, "%", 2)
end
def something_changed?
return false if $actor == nil
return true if @old_hp != $actor.hp
return true if @old_maxhp != $actor.maxhp
return true if @old_mp != $actor.mp
return true if @old_maxmp != $actor.maxmp
return true if @old_exp != $actor.exp
return false
end
def dispose
self.bitmap.dispose
super
end
end
#------------------------------------------------------------------------------
class Vampyr_HUD2 < Sprite
def initialize(viewport)
super(viewport)
@bg = Cache.system("Skills Base")
self.y = Graphics.height-@bg.height
self.bitmap = Bitmap.new(@bg.width, @bg.height)
self.bitmap.font.size = 16
@skills = {}
$windows << self
refresh
end
def update
super
update_drag
update_drop
update_hotkeys
refresh if something_changed?
end
def refresh
return if $actor == nil
@hotkeys = {}
$actor.skill_hotkeys.each { |k, v| @hotkeys[k] = v }
self.bitmap.clear
self.bitmap.blt(0, 0, @bg, @bg.rect)
draw_skills
end
def draw_skills
return if $actor == nil
count = 0
$actor.skill_hotkeys.each { |key, value|
@skills[count] = [32*count, 0]
if value != nil
skill = $data_skills[value]
if skill != nil
draw_icon(skill.icon_index, 32*count+4, 4)
self.bitmap.draw_outlined_text(32*count, self.bitmap.height-16, 32, 16, Keys.name(key), 1, Color.new(255,255,255))
end
end
count += 1
}
end
def update_hotkeys
return if $actor == nil
for i in 0...$actor.skill_hotkeys.size
next unless Input.trigger?(Keys::Mouse_Right)
next unless $mouse.in_area?(self.x+@skills[i][0], self.y+@skills[i][1])
$actor.skill_hotkeys[$actor.skill_hotkeys.keys[i]] = 0
refresh
end
end
def update_drag
return if $actor == nil
return unless Input.trigger?(Keys::Mouse_Left)
return unless in_area?
return if $mouse.object != nil
for i in 0...$actor.skill_hotkeys.size
next unless $mouse.in_area?(self.x+@skills[i][0], self.y+@skills[i][1])
$mouse.object = $data_skills[$actor.skill_hotkeys.values[i]]
end
$mouse.parent = self
end
def update_drop
return if $actor == nil
return if Input.press?(Keys::Mouse_Left)
return unless in_area?
return if $mouse.object == nil
return if $mouse.parent == nil
return if $mouse.parent == self
return unless $mouse.object.is_a?(RPG::Skill)
for i in 0...$actor.skill_hotkeys.size
next unless $mouse.in_area?(self.x+@skills[i][0], self.y+@skills[i][1])
$actor.skill_hotkeys[$actor.skill_hotkeys.keys[i]] = $mouse.object.id
end
refresh
end
def something_changed?
return false if $actor == nil
return true if @hotkeys != $actor.skill_hotkeys
return false
end
def dispose
self.bitmap.dispose
super
end
end
#------------------------------------------------------------------------------
class Vampyr_HUD3 < Sprite
def initialize(viewport)
super(viewport)
@bg = Cache.system("Items Base")
self.x = 162
self.y = Graphics.height-@bg.height
self.bitmap = Bitmap.new(@bg.width, @bg.height)
self.bitmap.font.size = 16
@items = {}
$windows << self
refresh
end
def update
super
update_drag
update_drop
update_hotkeys
refresh if something_changed?
end
def refresh
return if $actor == nil
@hotkeys = {}
$actor.item_hotkeys.each { |k, v| @hotkeys[k] = v }
self.bitmap.clear
self.bitmap.blt(0, 0, @bg, @bg.rect)
draw_skills
end
def draw_skills
return if $actor == nil
count = 0
$actor.item_hotkeys.each { |key, value|
@items[count] = [32*count, 0]
if value != nil
item = $data_items[value]
if item != nil
draw_icon(item.icon_index, 32*count+4, 4)
self.bitmap.draw_outlined_text(32*count, self.bitmap.height-16, 32, 16, Keys.name(key), 1, Color.new(255,255,255))
end
end
count += 1
}
end
def update_hotkeys
return if $actor == nil
for i in 0...$actor.item_hotkeys.size
next unless Input.trigger?(Keys::Mouse_Right)
next unless $mouse.in_area?(self.x+@items[i][0], self.y+@items[i][1])
$actor.item_hotkeys[$actor.item_hotkeys.keys[i]] = 0
refresh
end
end
def update_drag
return if $actor == nil
return unless Input.trigger?(Keys::Mouse_Left)
return unless in_area?
return if $mouse.object != nil
for i in 0...$actor.item_hotkeys.size
next unless $mouse.in_area?(self.x+@items[i][0], self.y+@items[i][1])
$mouse.object = $data_items[$actor.item_hotkeys.values[i]]
end
$mouse.parent = self
end
def update_drop
return if $actor == nil
return if Input.press?(Keys::Mouse_Left)
return unless in_area?
return if $mouse.object == nil
return if $mouse.parent == nil
return if $mouse.parent == self
return unless $mouse.object.is_a?(RPG::Item)
for i in 0...$actor.item_hotkeys.size
next unless $mouse.in_area?(self.x+@items[i][0], self.y+@items[i][1])
$actor.item_hotkeys[$actor.item_hotkeys.keys[i]] = $mouse.object.id
end
refresh
end
def something_changed?
return false if $actor == nil
return true if @hotkeys != $actor.item_hotkeys
return false
end
def dispose
self.bitmap.dispose
super
end
end
#------------------------------------------------------------------------------
class Vampyr_HUD4 < Sprite
def initialize(viewport)
super(viewport)
@bg = Cache.system("Shortcuts Base")
self.x = 262
self.y = Graphics.height-@bg.height
self.bitmap = Bitmap.new(@bg.width, @bg.height)
$windows << self
create_buttons
refresh
end
def create_buttons
return if $actor == nil
@buttons = []
@buttons[0] = Icon.new(nil, self.x, self.y, "System Icons", 4) { $window["inventory"].trigger; $window["equips"].trigger }
@buttons[1] = Icon.new(nil, self.x+32, self.y, "System Icons", 5) { call_status }
@buttons[2] = Icon.new(nil, self.x+64, self.y, "System Icons", 6) { call_skill }
@buttons[3] = Icon.new(nil, self.x+96, self.y, "System Icons", 7) { call_quest }
@buttons[4] = Icon.new(nil, self.x+128, self.y, "System Icons", 11) { $window["chat"].trigger }
@buttons[0].always = true
@buttons[1].always = true
@buttons[2].always = true
@buttons[3].always = true
@buttons[4].always = true
@buttons[0].tip_text = ["#{Vocab.item} (I)"]
@buttons[1].tip_text = ["#{Vocab.status} (C)"]
@buttons[2].tip_text = ["#{Vocab.skill} (K)"]
@buttons[3].tip_text = ["#{Vocab::Quests} (P)"]
@buttons[4].tip_text = ["Chat (F5)"]
end
def call_status
$window["character"].trigger
$window["skills"].on_close
$window["guild"].on_close
$window["friends"].on_close
$window["quests"].on_close
$window["quest infos"].on_close
end
def call_skill
$window["skills"].trigger
$window["guild"].on_close
$window["friends"].on_close
$window["character"].on_close
$window["quests"].on_close
$window["quest infos"].on_close
end
def call_quest
$window["quests"].trigger
$window["skills"].on_close
$window["guild"].on_close
$window["friends"].on_close
$window["character"].on_close
$window["quest infos"].on_close unless $window["quests"].visible
end
def refresh
return if $actor == nil
self.bitmap.clear
self.bitmap.blt(0, 0, @bg, @bg.rect)
end
def update
super
return if $actor == nil
for i in @buttons
i.update
end
end
def dispose
if @buttons != nil
for i in @buttons
i.dispose
end
end
super
end
end
#------------------------------------------------------------------------------
class Vampyr_HUD5 < Sprite
def initialize(viewport)
super(viewport)
@bg = Cache.system("Options Base")
self.x = Graphics.width-@bg.width
self.y = 1
self.bitmap = Bitmap.new(@bg.width, @bg.height)
$windows << self
create_buttons
refresh
end
def create_buttons
return if $actor == nil
@buttons = []
@buttons[0] = Icon.new(nil, self.x, self.y, "System Icons", 1) { call_guild }
@buttons[1] = Icon.new(nil, self.x+32, self.y, "System Icons", 2)
@buttons[2] = Icon.new(nil, self.x+64, self.y, "System Icons", 3) { call_friend }
@buttons[3] = Icon.new(nil, self.x+96, self.y, "System Icons", 8) { $window["options"].trigger }
@buttons[0].always = true
@buttons[1].always = true
@buttons[2].always = true
@buttons[3].always = true
@buttons[0].tip_text = ["#{Vocab::Guild} (P)"]
@buttons[1].tip_text = ["#{Vocab::Party}"]
@buttons[2].tip_text = ["#{Vocab::Friends} (F)"]
@buttons[3].tip_text = [Vocab::Options]
end
def call_guild
$window["guild"].trigger
$window["skills"].on_close
$window["friends"].on_close
$window["character"].on_close
$window["quests"].on_close
$window["quest infos"].on_close
end
def call_friend
$window["friends"].trigger
$window["skills"].on_close
$window["guild"].on_close
$window["character"].on_close
$window["quests"].on_close
$window["quest infos"].on_close
end
def refresh
return if $actor == nil
self.bitmap.clear
self.bitmap.blt(0, 0, @bg, @bg.rect)
end
def update
super
return if $actor == nil
for i in @buttons
i.update
end
end
def dispose
if @buttons != nil
for i in @buttons
i.dispose
end
end
super
end
end
#------------------------------------------------------------------------------
class Vampyr_HUD6 < Sprite
def initialize(viewport)
super(viewport)
@bg = Cache.system("Ammo Base")
self.x = Graphics.width-@bg.width
self.y = Graphics.height-@bg.height
self.bitmap = Bitmap.new(@bg.width, @bg.height)
$windows << self
refresh
end
def refresh
return if $actor == nil
@ammos = {}
@weapon = $actor.weapons[0]
$actor.ammos.each { |k, v| @ammos[k] = v }
self.bitmap.clear
self.bitmap.blt(0, 0, @bg, @bg.rect)
draw_ammo
end
def update
super
update_drop
return if $actor == nil
refresh if something_changed?
end
def draw_ammo
return if $actor == nil
$actor.ammos.each { |key, value|
next if $actor.weapons[0] == nil
next if $actor.weapons[0].id != key
next if value == nil
@ammo = value
@quantity = $game_party.item_number(@ammo)
draw_icon(value.icon_index, 4, 4)
self.bitmap.draw_outlined_text(0, self.bitmap.height-16, 32, 16, sprintf("%2d", @quantity), 1, Color.new(255,255,255))
}
end
def update_drop
return if $actor == nil
return if Input.press?(Keys::Mouse_Left)
return unless in_area?
return if $mouse.object == nil
return if $mouse.parent == nil
return if $mouse.parent == self
return unless $mouse.object.is_a?(RPG::Item)
$actor.ammos[$actor.weapons[0].id] = $mouse.object
refresh
end
def something_changed?
return false if $actor == nil
return true if @weapon != $actor.weapons[0]
return true if @ammos != $actor.ammos
return true if @ammo != nil and $game_party.item_number(@ammo) != @quantity
return false
end
end
#------------------------------------------------------------------------------
class Spriteset_Map
alias vampyr_hud_create_viewports create_viewports
alias vampyr_hud_update update
alias vampyr_hud_dispose dispose
def create_viewports
vampyr_hud_create_viewports
create_hud
end
def update
vampyr_hud_update
update_hud
end
def dispose
vampyr_hud_dispose
dispose_hud
end
def create_hud
@vampyr_hud1 = Vampyr_HUD1.new(@viewport3)
@vampyr_hud2 = Vampyr_HUD2.new(@viewport3)
@vampyr_hud3 = Vampyr_HUD3.new(@viewport3)
@vampyr_hud4 = Vampyr_HUD4.new(@viewport3)
@vampyr_hud5 = Vampyr_HUD5.new(@viewport3)
@vampyr_hud6 = Vampyr_HUD6.new(@viewport3)
end
def update_hud
@vampyr_hud1.update
@vampyr_hud2.update
@vampyr_hud3.update
@vampyr_hud4.update
@vampyr_hud5.update
@vampyr_hud6.update
end
def dispose_hud
@vampyr_hud1.dispose
@vampyr_hud2.dispose
@vampyr_hud3.dispose
@vampyr_hud4.dispose
@vampyr_hud5.dispose
@vampyr_hud6.dispose
end
end
#------------------------------------------------------------------------------
end