Ayene - Czw 28 Sty, 2010 12:07 Temat postu: Paski HP podczas walki
~ Paski HP podczas walki XP ~
Krótki opis
Skrypt dodaje nowe paski HP bohaterom i przeciwnikom podczas walki.
Autor skryptu
SephirothSpawn
Kompatybilność
Tylko XP
Skrypt
Spoiler:
Kod:
#======================================================
# Paski HP podczas walki
# Autor: SephirothSpawn
#======================================================
class Window_Base < Window
def draw_slant_bar(x, y, min, max, width = 152, height = 6,
bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
for i in 0..height
self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
end
for i in 1..(height - 1)
r = 100 * (height - i) / height + 0 * i / height
g = 100 * (height - i) / height + 0 * i / height
b = 100 * (height - i) / height + 0 * i / height
a = 255 * (height - i) / height + 255 * i / height
self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
end
for i in 1..( (min / max.to_f) * width - 1)
for j in 1..(height - 1)
r = bar_color.red * (width - i) / width + end_color.red * i / width
g = bar_color.green * (width - i) / width + end_color.green * i / width
b = bar_color.blue * (width - i) / width + end_color.blue * i / width
a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
end
end
end
end
alias raz_update update
alias raz_update_phase5 update_phase5
alias raz_update_phase4_step1 update_phase4_step1
alias raz_update_phase4_step5 update_phase4_step5
alias raz_enemy_hp_main main
def main
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
@enemy_window = Window_EnemyHP.new
@enemy_window.z = 95
raz_enemy_hp_main
@enemy_window.dispose
end
def update
@enemy_window.update
raz_update
end
def update_phase5
if @phase5_wait_count > 0
@phase5_wait_count -= 1
if @phase5_wait_count == 0
@enemy_window.visible = false
@result_window.visible = true
$game_temp.battle_main_phase = false
@status_window.refresh
@enemy_window.refresh
end
return
end
raz_update_phase5
end
def update_phase4_step1
raz_update_phase4_step1
@enemy_window.refresh
end
def update_phase4_step5
@help_window.visible = false
@status_window.refresh
@enemy_window.refresh
raz_update_phase4_step5
end
end
class Window_BattleStatus < Window_Base
def initialize
super(0, 320, 640, 160)
self.contents = Bitmap.new(width - 32, height - 32)
@level_up_flags = [false, false, false, false]
refresh
end
def dispose
super
end
def level_up(actor_index)
@level_up_flags[actor_index] = true
end
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
actor_x = i * 160 + 4
draw_slant_bar(actor_x, 55, actor.hp, actor.maxhp, 120)
draw_slant_bar(actor_x, 88, actor.sp, actor.maxsp, 120, 6, bar_color = Color.new(150, 0, 150, 255), end_color = Color.new(0, 0, 255, 255))
draw_actor_name(actor, actor_x, 0)
draw_actor_hp(actor, actor_x, 32, 120)
draw_actor_sp(actor, actor_x, 64, 120)
if @level_up_flags[i]
self.contents.font.color = normal_color
self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
else
draw_actor_state(actor, actor_x, 96)
end
end
end
def update
super
if $game_temp.battle_main_phase
self.contents_opacity -= 4 if self.contents_opacity > 191
else
self.contents_opacity += 4 if self.contents_opacity < 255
end
end
end
Demo
niepotrzebne
Screenshot
Spoiler:
Instrukcja
1. Wklej skrypt nad "Main" w Edytorze Skryptu.
2. Reszta instrukcji znajduje się w treści skryptu.
Piszcie w razie problemów.spino333 - Sro 03 Lut, 2010 18:15 Skrypt bardzo przydatny.
Ayene może ja tylko tak mam ale nie widzę Screenshot RtaMag2 - Pon 15 Lut, 2010 17:12 Ja mam taki problem że są paski ale niema napisów żadnych niema imienia nie pisze normal ilość hp sp itd Ayene - Pon 15 Lut, 2010 17:20 Ale oczywiście masz polską wersję mejkera tak? Jeżeli odpowiedź brzmi 'tak', to nic na to nie poradzę.kamcio22 - Nie 21 Mar, 2010 15:35 Dobre, mi się podoba.Dase - Nie 21 Mar, 2010 20:02 Wkleiłem wszystko poprawnie, nic się nie zepsuło.. ale nie widzę pasków. W poście nie załączono żadnych grafik więc żadnych nie dodałem.Melvin - Nie 21 Mar, 2010 20:06 A jaką masz wersję RMXP?Ayene - Nie 21 Mar, 2010 21:13 Dase, może podnieś nieco grafiki potworów w zakładce Troops/Grupy potworów. Niezależnie od wersji mejkera, wszystko powinno działać.MomoMarcin3 - Sro 31 Mar, 2010 19:53 Można zmienić styl czcionki?? bo mam zmienioną w grze, a w skrypcie jest inna Ayene - Czw 01 Kwi, 2010 12:55 Znajdź linijkę z:
Zamiast 'Times New Roman' wpisz nazwę wybranej czcionki.Valdali - Sob 24 Kwi, 2010 10:39 a mógłby ktoś zrobić, żeby były widoczne tylko paski przeciwników?Ayene - Sob 24 Kwi, 2010 11:30 Zamień na poniższy:
Spoiler:
Kod:
#======================================================
# Paski HP podczas walki
# Autor: SephirothSpawn
#======================================================
class Window_Base < Window
def draw_slant_bar(x, y, min, max, width = 152, height = 6,
bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
for i in 0..height
self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
end
for i in 1..(height - 1)
r = 100 * (height - i) / height + 0 * i / height
g = 100 * (height - i) / height + 0 * i / height
b = 100 * (height - i) / height + 0 * i / height
a = 255 * (height - i) / height + 255 * i / height
self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
end
for i in 1..( (min / max.to_f) * width - 1)
for j in 1..(height - 1)
r = bar_color.red * (width - i) / width + end_color.red * i / width
g = bar_color.green * (width - i) / width + end_color.green * i / width
b = bar_color.blue * (width - i) / width + end_color.blue * i / width
a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
end
end
end
end
alias raz_update update
alias raz_update_phase5 update_phase5
alias raz_update_phase4_step1 update_phase4_step1
alias raz_update_phase4_step5 update_phase4_step5
alias raz_enemy_hp_main main
def main
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
@enemy_window = Window_EnemyHP.new
@enemy_window.z = 95
raz_enemy_hp_main
@enemy_window.dispose
end
def update
@enemy_window.update
raz_update
end
def update_phase5
if @phase5_wait_count > 0
@phase5_wait_count -= 1
if @phase5_wait_count == 0
@enemy_window.visible = false
@result_window.visible = true
$game_temp.battle_main_phase = false
@status_window.refresh
@enemy_window.refresh
end
return
end
raz_update_phase5
end
def update_phase4_step1
raz_update_phase4_step1
@enemy_window.refresh
end
def update_phase4_step5
@help_window.visible = false
@status_window.refresh
@enemy_window.refresh
raz_update_phase4_step5
end
end
Valdali - Sob 24 Kwi, 2010 11:38 dzięki teraz mi wszystko działa! Itaki - Wto 02 Lis, 2010 19:57 dlaczego % mi nie pokazuje paski są ale np. 100% nie pokazujekamillo112 - Wto 02 Lis, 2010 20:06 To wina polskiego Maker'aPaKiTos - Sro 03 Lis, 2010 14:52 Co ci się stało? Nie wrzuciłeś bibliotek do folderu z grą lub nie masz odpowiedniej czcionkiDav - Pią 12 Lis, 2010 19:18 A działa to na TBS lub na ABS?PaKiTos - Sob 13 Lis, 2010 08:44 Oczywiście że nie.mial54 - Pią 18 Mar, 2011 13:13 Hej a można np. wstawiać własny obrazek z życiem? np: http://img703.imageshack....73/advhpbar.png a jak tak to jak?