Pomoc z HUD'em RTH ABS - maksmmilian - 09-07-14 23:38
Witam. Muszę pozbyć się tego czarnego paska z pasków stanu (najlepiej żeby był przeźroczysty ale jeśli to konieczne to może być niedynamiczy lub zastąpiony plikiem "hud_r.png") odwrócenie lustrzane paska hp (żeby zmniejszał się w drugą stronę nie wiem jak to opisać wystarczy zobaczyć) i żeby napisy na siebie nie nachodziły, pozbycie się obrazków "A" "S" "D" także mile widziane :)
RE: Pomoc z HUD'em RTH ABS - Ayene - 10-07-14 09:24
Chcesz się pozbyć czarnego tła, czyli pliku "hud_bg"?
RE: Pomoc z HUD'em RTH ABS - maksmmilian - 10-07-14 13:38
nie, sam dokonałem edycji części hud'a zrobiłem min. plik hud_bg sam go stworzyłem. To co chcę usunąć jest przy pasku exp'a na przykład. Ten czarny pasek który robi efekt dynamiczności hud'a. Chodzi mi o to żeby go usunąć nawet kosztem tej dynamiczności. I odwrócić pasek hp tak żeby "zmniejszał się w drugą stronę" mam nadzieję, że wiesz o co chodzi. :)
RE: Pomoc z HUD'em RTH ABS - Ayene - 11-07-14 13:38
Podmień skrypt '!!!RTHABS - Sprite_Hud_Basic' na poniższy:
Kod:
#===============================================================================
# RTHABS - Sprite_Hud_Basic
#-------------------------------------------------------------------------------
# Criador: RTH
#===============================================================================
class Sprite_Hud_Basic < Sprite
#--------------------------------------------------------------------------
# - Inicialização
#--------------------------------------------------------------------------
def initialize(viewport)
super(viewport)
@back_hud = Sprite.new(viewport)
@back_hud.bitmap = RPG::Cache.picture("hud_bg")
self.z = @back_hud.z + 1
@bars = Sprite.new(viewport)
@bars.bitmap = Bitmap.new(@back_hud.bitmap.width, @back_hud.bitmap.height)
@hud_rect = RPG::Cache.picture("hud_r")
@hp_gauge = RPG::Cache.picture("hp_bar")
@sp_gauge = RPG::Cache.picture("mp_bar")
@exp_gauge = RPG::Cache.picture("exp_bar")
@hp_critcal_gauge = RPG::Cache.picture("HP_Critical")
self.bitmap = Bitmap.new(@back_hud.bitmap.width, @back_hud.bitmap.height)
self.bitmap.font.size = 15
self.bitmap.font.name = "Nyala"
@hp_speed = 8
@sp_speed = 8
@exp_speed = 2
@speed_min = 1
@acopacity = 250
self.x = 1
self.y = 411
@back_hud.opacity = @acopacity
refresh
self.visible = $game_switches[RTHABS::CUSTOM::HUD_SWITCH_ID]
end
#--------------------------------------------------------------------------
# - Visível?
#--------------------------------------------------------------------------
def visible=(valor)
super
@back_hud.visible = valor
@bars.visible = valor
end
#--------------------------------------------------------------------------
# - Y=
#--------------------------------------------------------------------------
def x=(valor)
@back_hud.x = valor
@bars.x = valor
super
end
#--------------------------------------------------------------------------
# - X=
#--------------------------------------------------------------------------
def y=(valor)
@back_hud.y = valor
@bars.y = valor
super
end
#--------------------------------------------------------------------------
# - Dispose
#--------------------------------------------------------------------------
def dispose
@back_hud.dispose
@bars.dispose
if self.bitmap != nil
self.bitmap.dispose
self.bitmap = nil
end
super
end
#--------------------------------------------------------------------------
# - Atualiza
#--------------------------------------------------------------------------
def refresh
actor = ($game_player.battler.nil? ? $game_actors[1] : $game_player.battler)
@actor = actor
@hp = actor.hp
@sp = actor.sp
@maxhp = actor.maxhp
@maxsp = actor.maxsp
@name = actor.name
@class_name = actor.class_name
@level = actor.level
@arma_id = actor.weapon_id
@exp = actor.exp
draw_hp_gauged
draw_sp_gauged
draw_exp_gauged
draw_slots
end
#--------------------------------------------------------------------------
# - Cria a Barra e o Scroll
#--------------------------------------------------------------------------
def draw_hp_gauged
x = 1 + 139
y = 1 + 44
actor = ($game_player.battler.nil? ? $game_actors[1] : $game_player.battler)
gauge = @hp_gauge
self.bitmap.fill_rect(x - 1, y - 1, gauge.width + 2, 13, Color.new(0, 0, 0, 0))
filled = (@hp.to_f * gauge.width.to_f / @maxhp.to_f).to_i
text = $data_system.words.hp
rect = self.bitmap.text_size(text)
self.bitmap.font.color = Color.new(255, 255, 255)
self.draw_gauge(x, y + rect.height - gauge.height, gauge, filled)
self.bitmap.draw_text(x, y, gauge.width, rect.height, text)
text2 = "#{@hp} / #{@maxhp}"
rect = self.bitmap.text_size(text2)
if @hp <= @maxhp / 4
self.bitmap.font.color = Color.new(255, 64, 0)
end
ar = self.bitmap.text_size(@hp.to_s)
ar2 = self.bitmap.text_size(" / #{@maxhp}")
self.bitmap.draw_text(x + gauge.width - ar2.width - ar.width, y, gauge.width, rect.height, @hp.to_s)
self.bitmap.font.color = Color.new(255, 255, 255)
self.bitmap.draw_text(x + gauge.width - ar2.width, y, gauge.width, rect.height, " / #{@maxhp}")
end
#--------------------------------------------------------------------------
# - Cria a Barra e o Scroll
#--------------------------------------------------------------------------
def draw_sp_gauged
x = 1 + 373
y = 1 + 44
actor = ($game_player.battler.nil? ? $game_actors[1] : $game_player.battler)
gauge = @sp_gauge
self.bitmap.fill_rect(x - 1, y - 1, gauge.width + 2, 13, Color.new(0, 0, 0, 0))
filled = (@sp.to_f * gauge.width.to_f / @maxsp.to_f).to_i
text = $data_system.words.sp
text2 = "#{@sp} / #{@maxsp}"
rect = self.bitmap.text_size(text)
self.draw_gauge(x, y + rect.height - gauge.height, gauge, filled)
self.bitmap.draw_text(x, y, gauge.width, rect.height, text)
rect = self.bitmap.text_size(text2)
self.bitmap.draw_text(x, y, gauge.width, rect.height, text2, 2)
end
#--------------------------------------------------------------------------
# - Cria a Barra e o Scroll
#--------------------------------------------------------------------------
def draw_exp_gauged
x = 1 + 127
y = 1 + 52
actor = ($game_player.battler.nil? ? $game_actors[1] : $game_player.battler)
actor_exp_need = actor.get_level_exp(@exp)
actor_exp_rest = actor.next_exp_rest_i_exp(@exp)
bar_actor_exp_need = actor.get_level_exp2(@exp)
bar_actor_exp_rest = actor_exp_rest
gauge = @exp_gauge
if actor_exp_need == 0
bar_percent = gauge.width
percentagem = 100
else
bar_percent = gauge.width - (bar_actor_exp_rest * gauge.width / [bar_actor_exp_need, 1].max.to_f).round
percentagem = [[(bar_percent * 100.0 / gauge.width.to_f).round, 0].max, 100].min
end
self.bitmap.fill_rect(x - 1, y + 4, gauge.width + 2, 15, Color.new(0, 0, 0, 0))
text = "EXP"
text2 = "#{actor_exp_need-actor_exp_rest} / #{actor_exp_need}"
rect = self.bitmap.text_size(text)
self.draw_gauge(x, y + rect.height - gauge.height, gauge, bar_percent)
#@exp = ($game_player.battler.nil? ? $game_actors[1] : $game_player.battler).exp
self.bitmap.draw_text(x, y, gauge.width, rect.height, text)
rect = self.bitmap.text_size(text2)
self.bitmap.draw_text(x, y, gauge.width, rect.height, text2, 2)
end
#--------------------------------------------------------------------------
# - Cria a Barra e o Scroll
#--------------------------------------------------------------------------
def draw_gauge(x, y, gauge, filled, opacity=255)
filled = [[filled, gauge.width].min, 0].max
@bars.bitmap.fill_rect(x - 1, y - 1, gauge.width + 2, gauge.height + 2, Color.new(0, 0, 0, 0))
@bars.bitmap.blt(x, y, gauge, Rect.new(0, 0, filled, gauge.height), 255)
end
#--------------------------------------------------------------------------
# - Os Sltos
#--------------------------------------------------------------------------
def draw_slots
x = 266
y = 30
@slots = $game_player.equiped_teclas.dup
for i in 0..2
if @slots[i].type == 2
if $game_party.item_number(@slots[i].id) <= 0
@slots[i].clear
else
@slots[i].number = $game_party.item_number(@slots[i].id)
end
end
if @slots[i].type == 3
if $game_party.armor_number(@slots[i].id) <= 0
@slots[i].clear
else
@slots[i].number = $game_party.armor_number(@slots[i].id)
end
end
if @slots[i].type == 4
if $game_party.weapon_number(@slots[i].id) <= 0
@slots[i].clear
else
@slots[i].number = $game_party.weapon_number(@slots[i].id)
end
end
icon = RPG::Cache.icon(@slots[i].icon_name)
self.bitmap.blt(x + 2 + i * 38, y + 2, icon, Rect.new(0, 0, 24, 24))
if @slots[i].type >= 2
size = self.bitmap.text_size(@slots[i].number.to_s)
self.bitmap.draw_text(x + i * 38 + 28 - size.width, y + 2 + 28 - size.height, size.width, size.height, @slots[i].number.to_s, 2)
end
end
end
#--------------------------------------------------------------------------
# - Cria a Barra e o Scroll
#--------------------------------------------------------------------------
def update
self.visible = $game_switches[RTHABS::CUSTOM::HUD_SWITCH_ID]
lag_level = [[RTHABS::AntiLag.effect_level, 0].max, 2].min
if $game_temp.need_hud_refresh
refresh
$game_temp.need_hud_refresh = false
return
end
actor = ($game_player.battler.nil? ? $game_actors[1] : $game_player.battler)
if @actor != actor
refresh
return
end
if @name != actor.name or @class_name != actor.class_name
draw_actor_name_class
end
if $game_temp.need_hud_icons
draw_slots
$game_temp.need_hud_icons = false
end
if @level != actor.level or @arma_id != actor.weapon_id
end
unless self.visible
if @exp != actor.exp
@exp = actor.exp
draw_exp_gauged
end
if @hp != actor.hp
@hp = actor.hp
@maxhp = actor.maxhp
draw_hp_gauged
elsif @maxhp != actor.maxhp
@maxhp = actor.maxhp
draw_hp_gauged
end
if @sp != actor.sp
@sp = actor.sp
@maxsp = actor.maxsp
draw_sp_gauged
elsif @maxsp != actor.maxsp
@maxsp = actor.maxsp
draw_sp_gauged
end
return
end
case lag_level
when 0
if @exp != actor.exp
@exp = actor.exp
draw_exp_gauged
end
else
if @exp != actor.exp
if @exp > actor.exp
aexp = [((@exp.to_f - actor.exp.to_f).abs / @exp_speed).to_i, @speed_min].max
@exp = [@exp - aexp, actor.exp, 0].max
elsif @exp < actor.exp
aexp = [((@exp.to_f - actor.exp.to_f).abs / @exp_speed).to_i, @speed_min].max
@exp = [[@exp + aexp, actor.exp].min , 0].max
end
draw_exp_gauged
end
end
case lag_level
when 0
if @hp != actor.hp
@hp = actor.hp
@maxhp = actor.maxhp
draw_hp_gauged
elsif @maxhp != actor.maxhp
@maxhp = actor.maxhp
draw_hp_gauged
end
if @sp != actor.sp
@sp = actor.sp
@maxsp = actor.maxsp
draw_sp_gauged
elsif @maxsp != actor.maxsp
@maxsp = actor.maxsp
draw_sp_gauged
end
else
if @hp != actor.hp
if @maxhp != actor.maxhp
if @maxhp > actor.maxhp
ahp = [((@maxhp.to_f - actor.maxhp.to_f) / @hp_speed).to_i, @speed_min].max
@maxhp = [[@maxhp - ahp, actor.maxhp].min , 0].max
elsif @maxhp < actor.maxhp
ahp = [((actor.maxhp.to_f - @maxhp.to_f) / @hp_speed).to_i, @speed_min].max
@maxhp = [@maxhp + ahp, actor.maxhp].min
end
end
if @hp > actor.hp
ahp = [((@hp.to_f - actor.hp.to_f) / @hp_speed).to_i, @speed_min].max
@hp = [@hp - ahp, actor.hp, 0].max
elsif @hp < actor.hp
ahp = [((actor.hp.to_f - @hp.to_f) / @hp_speed).to_i, @speed_min].max
@hp = [@hp + ahp, actor.hp, actor.maxhp].min
end
draw_hp_gauged
elsif @maxhp != actor.maxhp
if @maxhp > actor.maxhp
ahp = [((@maxhp.to_f - actor.maxhp.to_f) / @hp_speed).to_i, 1].max
@maxhp = [[@maxhp - ahp, actor.maxhp].min , 0].max
elsif @maxhp < actor.maxhp
ahp = [((actor.maxhp.to_f - @maxhp.to_f) / @hp_speed).to_i, 1].max
@maxhp = [@maxhp + ahp, actor.maxhp].min
end
draw_hp_gauged
end
if @sp != actor.sp
if @maxsp != actor.maxsp
if @maxsp > actor.maxsp
asp = [((@maxsp.to_f - actor.maxsp.to_f) / @sp_speed).to_i, 1].max
@maxsp = [[@maxsp - asp, actor.maxsp].min , 0].max
elsif @maxsp < actor.maxsp
asp = [((actor.maxsp.to_f - @maxsp.to_f) / @sp_speed).to_i, 1].max
@maxsp = [@maxsp + asp, actor.maxsp].min
end
end
if @sp > actor.sp
asp = [((@sp.to_f - actor.sp.to_f) / @sp_speed).to_i, 1].max
@sp = [@sp - asp, actor.sp, 0].max
elsif @sp < actor.sp
asp = [((actor.sp.to_f - @sp.to_f) / @sp_speed).to_i, 1].max
@sp = [@sp + asp, actor.sp, actor.maxsp].min
end
draw_sp_gauged
elsif @maxsp != actor.maxsp
if @maxsp > actor.maxsp
asp = [((@maxsp.to_f - actor.maxsp.to_f) / @sp_speed).to_i, 1].max
@maxsp = [[@maxsp - asp, actor.maxsp].min , 0].max
elsif @maxsp < actor.maxsp
asp = [((actor.maxsp.to_f - @maxsp.to_f) / @sp_speed).to_i, 1].max
@maxsp = [@maxsp + asp, actor.maxsp].min
end
draw_sp_gauged
end
end
end
end
class Game_Actor < Game_Battler
def next_exp_i
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] : 0
end
def next_exp_rest_i
return (@exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp : 0)
end
def this_level_exp_i
return (@exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0)
end
def get_level_by_exp(aexp)
aexp ||= 0
for i in 1..99
next if @exp_list[i].nil?
nl = (@exp_list[i])
pl = (@exp_list[i-1].nil? ? 0 : @exp_list[i-1])
if nl > aexp and pl <= aexp
return i-1
end
end
return 0
end
def get_level_exp(aexp)
aexp ||= 0
for i in 1..99
next if @exp_list[i].nil?
nl = (@exp_list[i])
pl = (@exp_list[i-1].nil? ? 0 : @exp_list[i-1])
if nl > aexp and pl <= aexp
return nl
end
end
return 0
end
def get_level_exp2(aexp)
aexp ||= 0
for i in 1..99
next if @exp_list[i].nil?
nl = (@exp_list[i])
pl = (@exp_list[i-1].nil? ? 0 : @exp_list[i-1])
if nl > aexp and pl <= aexp
return nl - pl
end
end
return 0
end
def next_exp_rest_i_exp(aexp)
aexp ||= 0
return (get_level_exp(aexp) - aexp)
end
end
RE: Pomoc z HUD'em RTH ABS - maksmmilian - 11-07-14 20:49
Ayene! Dziękuje za pomoc, kurde przesyłam tysiąc buziaków! ;*
Jest jeszcze jeden problem, liczba stackowanych itemów się nie odświeża. ;/
RE: Pomoc z HUD'em RTH ABS - Ayene - 11-07-14 21:27
Znajdź w skrypcie linijkę (ok. 180)
Kod:
@slots = $game_player.equiped_teclas.dup
pod nią dodaj:
Kod:
self.bitmap.fill_rect(x, y + 20, 110, 8, Color.new(0, 0, 0, 0))
RE: Pomoc z HUD'em RTH ABS - maksmmilian - 11-07-14 22:40
Dzięki :) a dałoby radę zrobić żeby po wejściu pod hud'a on stawał się pół przeźroczysty?
EDIT;
w sumie to nie trzeba, wystarczyło trochę zmniejszyć wartość opacity backgrounda i jest git ;)
I żeby nie było potem, NIKT nie może używać HUD'a bo jest on do mojego projektu.
RE: Pomoc z HUD'em RTH ABS - Ayene - 12-07-14 08:36
Nie ma sprawy. W takim razie usunęłam projekt z pierwszego posta.
|