Belxebu Posted January 7, 2008 Share Posted January 7, 2008 (edited) Ecco lo script per avere delle barre ho, sp in battaglia NON solo per l' eroe...ma anche x i mostri Ecco lo script.. create un nuova classe sopra main e metteteci questo: Lo script è di SephirothSpawn e non mio!!! class Window_Base < Window #-------------------------------------------------------------------------- # * Draw Slant Bar(by SephirothSpawn) #-------------------------------------------------------------------------- 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)) # Draw Border for i in 0..height self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255)) end # Draw Background 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 # Draws Bar 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 class Window_EnemyHP < Window_Base def initialize super(0, 0, 640, 480) self.contents = Bitmap.new(width - 32, height - 32) self.opacity = 0 refresh end def refresh self.contents.clear for i in 0...$game_troop.enemies.size @enemy = $game_troop.enemies[i] @percent = (@enemy.hp * 100) / @enemy.maxhp unless @enemy.hp == 0 draw_slant_bar(@enemy.screen_x - 55, @enemy.screen_y - 10, @enemy.hp, @enemy.maxhp, width = 75, height = 6, bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255)) self.contents.draw_text(@enemy.screen_x - 39, @enemy.screen_y - 22, 100, 32, "#{@percent}" + "%") end end end end class Scene_Battle 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 wait count is larger than 0 if @phase5_wait_count > 0 # Decrease wait count @phase5_wait_count -= 1 # If wait count reaches 0 if @phase5_wait_count == 0 @enemy_window.visible = false # Show result window @result_window.visible = true # Clear main phase flag $game_temp.battle_main_phase = false # Refresh status window @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 # Hide help window @help_window.visible = false # Refresh status window @status_window.refresh @enemy_window.refresh raz_update_phase4_step5 end end class Window_BattleStatus < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 320, 640, 160) self.contents = Bitmap.new(width - 32, height - 32) @level_up_flags = [false, false, false, false] refresh end #-------------------------------------------------------------------------- # * Dispose #-------------------------------------------------------------------------- def dispose super end #-------------------------------------------------------------------------- # * Set Level Up Flag # actor_index : actor index #-------------------------------------------------------------------------- def level_up(actor_index) @level_up_flags[actor_index] = true end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super # Slightly lower opacity level during main phase 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 <b> Se volete che si vedano solo le barre dei nemici invece che quelle dell' eroe </b> Metteteci questo class Window_Base < Window #-------------------------------------------------------------------------- # * Draw Slant Bar(by SephirothSpawn) #-------------------------------------------------------------------------- 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)) # Draw Border for i in 0..height self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255)) end # Draw Background 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 # Draws Bar 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 class Window_EnemyHP < Window_Base def initialize super(0, 0, 640, 480) self.contents = Bitmap.new(width - 32, height - 32) self.opacity = 0 refresh end def refresh self.contents.clear for i in 0...$game_troop.enemies.size @enemy = $game_troop.enemies[i] @percent = (@enemy.hp * 100) / @enemy.maxhp unless @enemy.hp == 0 draw_slant_bar(@enemy.screen_x - 55, @enemy.screen_y - 10, @enemy.hp, @enemy.maxhp, width = 75, height = 6, bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255)) self.contents.draw_text(@enemy.screen_x - 39, @enemy.screen_y - 22, 100, 32, "#{@percent}" + "%") end end end end class Scene_Battle 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 wait count is larger than 0 if @phase5_wait_count > 0 # Decrease wait count @phase5_wait_count -= 1 # If wait count reaches 0 if @phase5_wait_count == 0 @enemy_window.visible = false # Show result window @result_window.visible = true # Clear main phase flag $game_temp.battle_main_phase = false # Refresh status window @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 # Hide help window @help_window.visible = false # Refresh status window @status_window.refresh @enemy_window.refresh raz_update_phase4_step5 end end class Window_BattleStatus < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 320, 640, 160) self.contents = Bitmap.new(width - 32, height - 32) @level_up_flags = [false, false, false, false] refresh end #-------------------------------------------------------------------------- # * Dispose #-------------------------------------------------------------------------- def dispose super end #-------------------------------------------------------------------------- # * Set Level Up Flag # actor_index : actor index #-------------------------------------------------------------------------- def level_up(actor_index) @level_up_flags[actor_index] = true end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- 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 #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super # Slightly lower opacity level during main phase 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 <b>Per vedere soloquelle degli eroi metteteci questo</b> class Window_Base < Window #-------------------------------------------------------------------------- # * Draw Slant Bar(by SephirothSpawn) #-------------------------------------------------------------------------- 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)) # Draw Border for i in 0..height self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255)) end # Draw Background 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 # Draws Bar 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 class Window_BattleStatus < Window_Base 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 end Ecco uno screen di esempiohttp://img145.imageshack.us/img145/448/name3hh.png A me da errore nella linea 20.Sapete perchè???? Edited January 7, 2008 by Belxebu Link to comment Share on other sites More sharing options...
Megaman Posted October 18, 2008 Share Posted October 18, 2008 (edited) Complimenti veramente per il codice, funziona che è una meraviglia. C'è solo un piccolo problema ... Non spuntano le indicazioni del giocatore, tipo:HP. SP, Nome e stato di salute. come posso correggere questo errore?Premetto ke ho preso il primo codice.Ciao PS. Ecco come mi spunta il combattimento.http://img362.imageshack.us/img362/4568/screenshotdm7.th.pnghttp://img362.imageshack.us/images/thpix.gif Edited October 18, 2008 by Megaman Che c'è?? Mi piace adottare e per questo sono favorevole!!!!Spoiler http://img508.imageshack.us/img508/7690/kyuubicp8.gifhttp://img212.imageshack.us/img212/1453/narutofe1.gifhttp://img114.imageshack.us/img114/9343/chijisz1.gifhttp://img205.imageshack.us/img205/451/jirayadc8.gifhttp://img230.imageshack.us/img230/6766/gokuia2.gifhttp://img412.imageshack.us/img412/9338/gotenel3.gifhttp://img262.imageshack.us/img262/6382/gohanssj2ky4.gifhttp://i32.tinypic.com/1j2tm1.gifhttp://img231.imageshack.us/img231/791/zorosn7.gifhttp://img215.imageshack.us/img215/6690/sanjiqw0.gifhttp://img228.imageshack.us/img228/8339/sanjirotantebr6.gifhttp://img522.imageshack.us/img522/1112/rufyafrokx4.gifhttp://img228.imageshack.us/img228/9480/rufyfn6.gifhttp://img525.imageshack.us/img525/6821/chopperfg2.gifhttp://img510.imageshack.us/img510/4945/rufygearks5.gifhttp://img132.imageshack.us/img132/8950/gonfl4.gifhttp://img174.imageshack.us/img174/3047/killuall4.gifhttp://img161.imageshack.us/img161/5866/kurapicamc5.gif Link to comment Share on other sites More sharing options...
makgyver Posted October 18, 2008 Share Posted October 18, 2008 E' solo un problema di font niente di preoccupante. Devi aggiungere dopo le righe def refresh self.contents.clearquesta rigaself.contents.font.name = "Arial" prova e dimmi se ti funzia. "A tre settimane da oggi io mieterò il mio raccolto, immaginate dove vorrete essere perchè così sarà. Serrate i ranghi! Seguitemi! E se vi ritroverete soli a cavalcare su verdi praterie col sole sulla faccia non preoccupatevi troppo perchè sarete nei campi elisi e sarete già morti! Fratelli, ciò che facciamo in vita riecheggia nell'eternità!" "C'era un sogno che era roma sarà realizzato. Questo era il desiderio di Marco Aurelio!" Link to comment Share on other sites More sharing options...
Megaman Posted October 19, 2008 Share Posted October 19, 2008 Grazie makgyver, sei un vero amico ora funziona alla perfezione. Ecco come spunta con il codice inserito:http://img509.imageshack.us/img509/9760/screen01vm3.th.pnghttp://img509.imageshack.us/images/thpix.gif Che c'è?? Mi piace adottare e per questo sono favorevole!!!!Spoiler http://img508.imageshack.us/img508/7690/kyuubicp8.gifhttp://img212.imageshack.us/img212/1453/narutofe1.gifhttp://img114.imageshack.us/img114/9343/chijisz1.gifhttp://img205.imageshack.us/img205/451/jirayadc8.gifhttp://img230.imageshack.us/img230/6766/gokuia2.gifhttp://img412.imageshack.us/img412/9338/gotenel3.gifhttp://img262.imageshack.us/img262/6382/gohanssj2ky4.gifhttp://i32.tinypic.com/1j2tm1.gifhttp://img231.imageshack.us/img231/791/zorosn7.gifhttp://img215.imageshack.us/img215/6690/sanjiqw0.gifhttp://img228.imageshack.us/img228/8339/sanjirotantebr6.gifhttp://img522.imageshack.us/img522/1112/rufyafrokx4.gifhttp://img228.imageshack.us/img228/9480/rufyfn6.gifhttp://img525.imageshack.us/img525/6821/chopperfg2.gifhttp://img510.imageshack.us/img510/4945/rufygearks5.gifhttp://img132.imageshack.us/img132/8950/gonfl4.gifhttp://img174.imageshack.us/img174/3047/killuall4.gifhttp://img161.imageshack.us/img161/5866/kurapicamc5.gif Link to comment Share on other sites More sharing options...
Mattone Posted October 19, 2008 Share Posted October 19, 2008 (edited) ora lo provo, mi sembra ottimo, poi edito e dico se ho problemi o altro. edit: ecco, per l'appunto, uso il minkoff e non mi vengono fuori le barre nemiche... ho usato il primo script. Edited October 19, 2008 by Mattone http://img171.imageshack.us/img171/8702/mattone2pm6.jpghttp://img171.imageshack.us/img171/8702/mattone2pm6.fde157aac7.jpgSpoiler http://img393.imageshack.us/img393/9920/legenrpgmaniamu3.gifForum:The legend of makingMSN....Ahiai!![c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: :hail:Mattone scrive: hail weiss[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Cumlava?Mattone scrive: spermosamente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Orgasmamente bene.Mattone scrive: cicciosamente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Robustamente bene.Mattone scrive: Lollosamente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Iccsdamente bene.Mattone scrive: Iccstramente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Rotflamente bene.Mattone scrive: Fooddosamente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Bannatamente bene.Mattone scrive: Caiossamente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Allora male[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Mattonamente bene.Mattone scrive: Sephirottamente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Kremente bene.Mattone scrive: settismente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Clorosamente bene.Mattone scrive: morganosamente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Cikcosamente bene.Mattone scrive: PyrosHellReavenosamente bene.[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Solatralenuvolosamente bene.Mattone scrive: Dexmente bene.[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Dandaramente bene.Mattone scrive: Frankamente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Trooperamente bene.Mattone scrive: Tiosamente bene[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Metalshikamente bene.Mattone scrive: Devoandareamangiaremente bene. Adopomente bene.[c=0][a=#074E78]SephirBlackmore[/a=46][/c] scrive: Ciaosamente bene.Già... ma ora passiamo ad altro...Se fai parte della Mattone Pictures, incolla questo nella tua firma:[/color][/size]Mattone Pictures: Progetti in corso: The Last Dragon. Io sono uno [il tuo ruolo]. Io faccio parte della Mattone Pictures!Il Sito di Mattone, per info sulla vita, i progetti, i contatti e i numeri di cel di Mattone!!http://img702.mytextgraphics.com/graffititextlive/2008/04/06/7cfbdd0f5cddf6d1f8a9d1f2b08c5541.gifhttp://www.dvdbeaver.com/film2/DVDReviews32/a%20lol/ttile%20lol.jpghttp://team.ffonline.it/imgpersonaggio/ward_it.jpg E tu in che personaggio ti identifichi?http://team.ffonline.it/imgpersonaggio/cloud_it.jpg E tu in che personaggio ti identifichi?http://team.ffonline.it/imgpersonaggio/auron_it.jpg E tu in che personaggio ti identifichi?http://team.ffonline.it/imgpersonaggio/cyan_it.jpg E tu in che personaggio ti identifichi?http://team.ffonline.it/imgpersonaggio/cecil_it.jpg E tu in che personaggio ti identifichi?http://team.ffonline.it/imgpersonaggio/galuf_it.jpg E tu in che personaggio ti identifichi?http://team.ffonline.it/imgpersonaggio/gus_it.jpg E tu in che personaggio ti identifichi?http://team.ffonline.it/imgpersonaggio/steiner_it.jpg E tu in che personaggio ti identifichi? Link to comment Share on other sites More sharing options...
elle92 Posted May 11, 2009 Share Posted May 11, 2009 skusate io ho un piccolo problema a me serve sl il codice ke mostra gli hp dei nemici xk x quelli degli eroi uso un altro script sl che se inserisco lo script appaiono le barre degli mp e hp anke ai miei pg anke se prendo il codice ke dovrebbe visualizzare sl gli hp dei mostri >_< Progetti in Corso: [spoiler] The Devil's SonataIl mio primo progetto con l'XP,attualmente in pausa per vari motivi,quindi ne approfitto per riorganizzare le idee visto che ad ogni passo avanti nel progetto,mi accorgo dei vari errori che ci sono^^' Status:Storia: 70% ->Tutta scritta nella mia testa dall'inizio alla fine,mancano gli ultimi dettagli e ovviamente come realizzarli.Mapping: 15% -> Essendo poco pratico lascio la costruzione di Città e Dungeon alla fine per ora mi concentro sulle altre cose,inizierò quando ne avrò bisogno per la storia.Eventi: 30% -> Per eventi intendo anche i vari dialoghi tra i personaggi principali il 30% è per gli eventi di gioco(ciclio giorno/notte,mostri,skill ecc..)Quest: 1% -> Per "Quest" si intende tutto ciò che è secondario dalla semplici missioni ai dialoghi con gli NPC...Script: 70% ->Anche se sto pensando di cambiare Battle Systems per vari problemi ciò farebbe scendere la % a 30-40%Database: 30% -> Ci sono tutti i PG, e quasi tutti gli oggetti,armi e skill, mancano i nemici e alcuni boss.Completamento: 30-35% -> Più o meno la base c'è,ma manca ancora molto il tutto è reso più difficile a causa della mia inesperienza con gli script,mapping e incompetenza generalexD l'unica cosa in cui sono bravo è la grafica,anche se quella usata nel gioco non mi piace molto infatti anche quella è da rivedere..Per Maggiori dettagli vi invito a visitare il topic del progetto:http://www.rpg2s.net/forum/index.php?showtopic=14695Sono ben accette critiche(costruttivexD) e consigli di ogni genere!^_^[/spoiler] Link to comment Share on other sites More sharing options...
EvilSeep Posted May 11, 2009 Share Posted May 11, 2009 e'molto bello! Ma ho un piccolo problema le sbarre dei nemici si alzato appena inizia il primo turno? si puo'rimediare? :P Premetto che ho usato lo script solo x le barre dei nemici. :) SEEP Universe su Steam:http://cdn.akamai.steamstatic.com/steam/apps/383630/capsule_184x69.jpg?t=1436537417 SEEP Universe: http://www.seepuniverse.com/ (Sito ufficiale) Blogging, dev log e vecchi progetti:SEEP Blog: http://www.seeproduction.blogspot.ie/ (DOWNLOAD dei nostri progetti)SEEP Bar: http://seepbar.blogspot.it/ (il bar viruale dove parlare di retrogaming e giochi indie) Link to comment Share on other sites More sharing options...
Andre4e Posted September 3, 2009 Share Posted September 3, 2009 Script vita mostri modificato:Visibile barra hp e se si vuole anche mp basta togliere qualke riga con gli asterischiLa barra è visualizzata al centro del nemico e non ai piediViene mostrato il numero di hp e non la percentualeBarra modificata , ora è più bella class Window_Base#--------------------------------------------------------------------------# œ ƒ‰ƒCƒ“•`‰æ by ÷‰ë Ý“y#--------------------------------------------------------------------------def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)# •`ŽÊ‹——£‚ÌŒvŽZB‘å‚«‚߂ɒ¼ŠpŽž‚Ì’·‚³Bdistance = (start_x - end_x).abs + (start_y - end_y).abs# •`ŽÊŠJŽnif end_color == start_colorfor i in 1..distancex = (start_x + 1.0 * (end_x - start_x) * i / distance).to_iy = (start_y + 1.0 * (end_y - start_y) * i / distance).to_iself.contents.fill_rect(x, y, width, width, start_color)endelsefor i in 1..distancex = (start_x + 1.0 * (end_x - start_x) * i / distance).to_iy = (start_y + 1.0 * (end_y - start_y) * i / distance).to_ir = start_color.red * (distance-i)/distance + end_color.red * i/distanceg = start_color.green * (distance-i)/distance + end_color.green * i/distanceb = start_color.blue * (distance-i)/distance + end_color.blue * i/distancea = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distanceself.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))endendendendclass Window_Base < Window #-------------------------------------------------------------------------- # * Draw Slant Bar(by SephirothSpawn) #-------------------------------------------------------------------------- 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)) # Draw Border for i in 0..height self.contents.fill_rect(x+i+3, y + height - i + 3, width+ 2,1, Color.new(0, 0, 0, 128)) #self.contents.fill_rect(x + i + 4, y + height - i + 4, width + 2, 1, Color.new(50, 50, 50, 255)) end # Draw Background 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 # Draws Bar 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 endend def draw_enemy_hp_meter_line(x, y, width = 356, height = 4)w = width * @enemy.hp / @enemy.maxhphp_color_1 = Color.new(255, 0, 0, 192)hp_color_2 = Color.new(255, 255, 0, 192)self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)x -= 1y += (height/4).floorself.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)x -= 1y += (height/4).ceilself.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)x -= 1y += (height/4).ceilself.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)end def draw_enemy_sp_meter_line(x, y, width = 156, height = 4)w = width * @enemy.sp / @enemy.maxsphp_color_1 = Color.new( 0, 0, 255, 192)hp_color_2 = Color.new( 0, 255, 255, 192)self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)x -= 1y += (height/4).floorself.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)x -= 1y += (height/4).ceilself.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)x -= 1y += (height/4).ceilself.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)end def draw_shadow_text_enemy(x, y, width, height, string, align = 0)# Œ³‚ÌF‚ð•Û‘¶‚µ‚Ä‚¨‚color = self.contents.font.color.dup# •Žš‚ʼne•`‰æself.contents.font.color = Color.new(0, 0, 0)self.contents.draw_text(x + 2, y + 2, width, height, string, align)# Œ³‚ÌF‚É–ß‚µ‚Ä•`‰æself.contents.font.color = colorself.contents.draw_text(x, y, width, height, string, align)end class Window_EnemyHP < Window_Base def initialize super(0, 0, 640, 480) self.contents = Bitmap.new(width - 32, height - 32) self.opacity = 0 refresh end def refresh self.contents.clear for i in 0...$game_troop.enemies.size @enemy = $game_troop.enemies #no# @percent = (@enemy.hp * 100) / @enemy.maxhp unless @enemy.hp == 0 #per abilitare mp togliere astersico alle righe #con scritto si e ad ogni parola sottostante #e non soprastante sostituire sp con hp #e viceversa #draw_slant_bar(@enemy.screen_x - 65, @enemy.screen_y - 60, @enemy.hp, @enemy.maxhp, width = 85, height = 12, bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255)) #si# draw_enemy_sp_meter_line(@enemy.screen_x - 62, @enemy.screen_y - 120, width = 85, height = 8) draw_enemy_hp_meter_line(@enemy.screen_x - 62, @enemy.screen_y - 90, width = 85, height = 8) #no# draw_slant_bar(@enemy.screen_x - 65, @enemy.screen_y - 60, @enemy.hp, @enemy.maxhp, width = 85, height = 12, bar_color = Color.new(255, 0, 0, 192), end_color = Color.new(255, 255, 0, 192)) #no# self.contents.draw_text(@enemy.screen_x - 20, @enemy.screen_y - 75, 100, 32, "#{@enemy.hp}") self.contents.font.size = 30 # HP/SP”’l‚Ì•¶Žš‚̑傫‚³ #si# self.contents.font.color = @enemy.sp == 0 ? knockout_color : #si# @enemy.sp <= @enemy.maxsp / 4 ? crisis_color : normal_color #si# draw_shadow_text_enemy(@enemy.screen_x - 80, @enemy.screen_y - 142, 100, 32, @enemy.sp.to_s, 2) self.contents.font.color = @enemy.hp == 0 ? knockout_color : @enemy.hp <= @enemy.maxhp / 4 ? crisis_color : normal_color draw_shadow_text_enemy(@enemy.screen_x - 80, @enemy.screen_y - 112, 100, 32, @enemy.hp.to_s, 2) self.contents.font.size = 12 # —pŒêuHP/SPv‚Ì•¶Žš‚̑傫‚³ self.contents.font.color = system_color # —pŒêuHP/SPv‚Ì•¶Žš‚ÌF #si# draw_shadow_text_enemy(@enemy.screen_x - 63 , @enemy.screen_y - 132, 96, 12, $data_system.words.sp) draw_shadow_text_enemy(@enemy.screen_x - 63 , @enemy.screen_y - 102, 96, 12, $data_system.words.hp) #si# draw_enemy_cp_meter(@enemy.screen_x - 70, @enemy.screen_y - 65, 120, 0) #no# draw_enemy_state(@enemy.screen_x - 68, @enemy.screen_y - 56) end endendend class Scene_Battle 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 wait count is larger than 0 if @phase5_wait_count > 0 # Decrease wait count @phase5_wait_count -= 1 # If wait count reaches 0 if @phase5_wait_count == 0 @enemy_window.visible = false # Show result window @result_window.visible = true # Clear main phase flag $game_temp.battle_main_phase = false # Refresh status window @status_window.refresh @enemy_window.refresh end return end raz_update_phase5end def update_phase4_step1 raz_update_phase4_step1 @enemy_window.refreshend def update_phase4_step5 # Hide help window @help_window.visible = false # Refresh status window @status_window.refresh @enemy_window.refresh raz_update_phase4_step5 endend =beginclass Window_BattleStatus < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 320, 640, 160) self.contents = Bitmap.new(width - 32, height - 32) @level_up_flags = [false, false, false, false] refresh end #-------------------------------------------------------------------------- # * Dispose #-------------------------------------------------------------------------- def dispose super end #-------------------------------------------------------------------------- # * Set Level Up Flag # actor_index : actor index #-------------------------------------------------------------------------- def level_up(actor_index) @level_up_flags[actor_index] = true end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear @item_max = $game_party.actors.size for i in 0...$game_party.actors.size actor = $game_party.actors 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 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 #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super # Slightly lower opacity level during main phase 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 endend=end http://files.nireblog.com/blogs4/narutozorro9kolas/files/firma-naruto-y-yondaime.gif Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now