Esse incrível script de Cogwhell, mostra as barras de HP, MP e Exp no menu sem precisar de nenhuma imagem, num jogo ou projeto do RPG Maker XP.
Pode ser muito útil para Actions RPG.
Para usar, basta copiar e colar o código abaixo em cima do script Main
:
# HP/SP/EXP盗Q・[盗W痿〇貼側盗X盗N盗邸盗v盗g Ver 1.00 # 痿掏痿』・続・E盗T盗|・[盗gURL # http://members.jcom.home.ne.jp/cogwheel/ #============================================================================== # ・臓 Game_Actor #------------------------------------------------------------------------------ # ・@盗A盗N盗^・[痿囃O・袖痿囁「盗N盗痿案湛痿囃%痿囁オ・B痿囁ッ痿囃,盗N盗痿案湛痿囃- Game_Actors 盗N盗痿案湛 ($game_actors) # 痿囃,痿恍@痿≒昵~囃%貼g痿廃痿囁ア痿囃I・AGame_Party 盗N盗痿案湛 ($game_party) 痿囁ァ痿囃F痿囃@貼Q総・痿囁ア痿囃I痿囃<痿囁オ・B #============================================================================== class Game_Actor < Game_Battler def now_exp return @exp - @exp_list[@level] end def next_exp return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0 end end #============================================================================== # ・臓 Window_Base #------------------------------------------------------------------------------ # ・@盗Q・[盗痼・吼~痿囃,痿囁オ痿囃7痿囃$痿囃,盗E盗B盗痿恣辛盗E痿囃,盗X・[盗p・[盗N盗痿案湛痿囃%痿囁オ・B #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ・・ HP 盗Q・[盗W痿囃,痿/痿庵・ #-------------------------------------------------------------------------- # 盗I盗邸盗W盗i盗痿高囃,HP痿/痿庵・囃O draw_actor_hp_hpsp 痿囃&痿淘コ痿楼痿・書宜 alias :draw_actor_hp_hpsp :draw_actor_hp def draw_actor_hp(actor, x, y, width = 144) # 痿・書若~搜ate痿囃) ・損窓・痿囃,HP/MHP痿囃O痿・B痿恍[ if actor.maxhp != 0 rate = actor.hp.to_f / actor.maxhp else rate = 0 end # plus_x:X窓・痿ゞ痿囃,・・痿冰痿・・髄ア rate_x:X窓・痿ゞ痿囃,・・痿冰痿・・髄ア(%) plus_y:Y窓・痿ゞ痿囃,・・痿冰痿・・髄ア # plus_width:痿・昵~囃,痿・・髄ア rate_width:痿・昵~囃,痿・・髄ア(%) height:総c痿・・ # align1:痿/痿庵ζ耽盗C盗v1 0:窓其痿・痿囃? 1:痿吼~痿謂財・ウ痿囁、 2:痿・痿・痿囃? # align2:痿/痿庵ζ耽盗C盗v2 0:総達痿・痿囃? 1:痿吼~痿謂財・ウ痿囁、 2:痿安財・痿囃? # align3:盗Q・[盗W盗^盗C盗v 0:窓其痿・痿囃? 1:痿・痿・痿囃? plus_x = 0 rate_x = 0 plus_y = 25 plus_width = 0 rate_width = 100 height = 10 align1 = 1 align2 = 2 align3 = 0 # 盗O盗痿案断・[盗V盗痿‘低~恆賜=痿剪G grade1:痿甲各嘆・[盗W grade2:貼・盗Q・[盗W # (0:痿安≠囃)盗O盗痿案断・[盗V盗痿‘低~・1:総c痿囃)盗O盗痿案断・[盗V盗痿‘低~・2:貼・痿囃?痿囃)盗O盗痿案断・[盗V盗痿‘低~・・盗総d)・j grade1 = 1 grade2 = 0 # 綜F綜・痿剪G・Bcolor1:邸O・g・Ccolor2:痿吼~・g # color3:痿甲各嘆・[盗W盗_・[盗N盗J盗痿安ー・Ccolor4:痿甲各嘆・[盗W盗痿案辰盗g盗J盗痿安ー # color5:貼・盗Q・[盗W盗_・[盗N盗J盗痿安ー・Ccolor6:貼・盗Q・[盗W盗痿案辰盗g盗J盗痿安ー color1 = Color.new(0, 0, 0, 192) color2 = Color.new(255, 255, 192, 192) color3 = Color.new(0, 0, 0, 192) color4 = Color.new(64, 0, 0, 192) color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192) color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192) # 痿・書若~捏p痿囃)痿/痿庵・囁オ痿囃H盗Q・[盗W痿囃,痿・昵~囃O痿・B痿恍[ if actor.maxhp != 0 hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp else hp = 0 end # 盗Q・[盗W痿囃,痿/痿庵・ gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y, width, plus_width + width * rate_width / 100, height, hp, align1, align2, align3, color1, color2, color3, color4, color5, color6, grade1, grade2) # 盗I盗邸盗W盗i盗痿高囃,HP痿/痿庵β叙&痿泊帋~囃O・・痿囃1総o痿囁ウ draw_actor_hp_hpsp(actor, x, y, width) end #-------------------------------------------------------------------------- # ・・ SP 盗Q・[盗W痿囃,痿/痿庵・ #-------------------------------------------------------------------------- # 盗I盗邸盗W盗i盗痿高囃,SP痿/痿庵・囃O draw_actor_sp_hpsp 痿囃&痿淘コ痿楼痿・書宜 alias :draw_actor_sp_hpsp :draw_actor_sp def draw_actor_sp(actor, x, y, width = 144) # 痿・書若~搜ate痿囃) ・損窓・痿囃,SP/MSP痿囃O痿・B痿恍[ if actor.maxsp != 0 rate = actor.sp.to_f / actor.maxsp else rate = 1 end # plus_x:X窓・痿ゞ痿囃,・・痿冰痿・・髄ア rate_x:X窓・痿ゞ痿囃,・・痿冰痿・・髄ア(%) plus_y:Y窓・痿ゞ痿囃,・・痿冰痿・・髄ア # plus_width:痿・昵~囃,痿・・髄ア rate_width:痿・昵~囃,痿・・髄ア(%) height:総c痿・・ # align1:痿/痿庵ζ耽盗C盗v1 0:窓其痿・痿囃? 1:痿吼~痿謂財・ウ痿囁、 2:痿・痿・痿囃? # align2:痿/痿庵ζ耽盗C盗v2 0:総達痿・痿囃? 1:痿吼~痿謂財・ウ痿囁、 2:痿安財・痿囃? # align3:盗Q・[盗W盗^盗C盗v 0:窓其痿・痿囃? 1:痿・痿・痿囃? plus_x = 0 rate_x = 0 plus_y = 25 plus_width = 0 rate_width = 100 height = 10 align1 = 1 align2 = 2 align3 = 0 # 盗O盗痿案断・[盗V盗痿‘低~恆賜=痿剪G grade1:痿甲各嘆・[盗W grade2:貼・盗Q・[盗W # (0:痿安≠囃)盗O盗痿案断・[盗V盗痿‘低~・1:総c痿囃)盗O盗痿案断・[盗V盗痿‘低~・2:貼・痿囃?痿囃)盗O盗痿案断・[盗V盗痿‘低~・・盗総d)・j grade1 = 1 grade2 = 0 # 綜F綜・痿剪G・Bcolor1:邸O・g・Ccolor2:痿吼~・g # color3:痿甲各嘆・[盗W盗_・[盗N盗J盗痿安ー・Ccolor4:痿甲各嘆・[盗W盗痿案辰盗g盗J盗痿安ー # color5:貼・盗Q・[盗W盗_・[盗N盗J盗痿安ー・Ccolor6:貼・盗Q・[盗W盗痿案辰盗g盗J盗痿安ー color1 = Color.new(0, 0, 0, 192) color2 = Color.new(255, 255, 192, 192) color3 = Color.new(0, 0, 0, 192) color4 = Color.new(0, 64, 0, 192) color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192) color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192) # 痿・書若~捏p痿囃)痿/痿庵・囁オ痿囃H盗Q・[盗W痿囃,痿・昵~囃O痿・B痿恍[ if actor.maxsp != 0 sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp else sp = (width + plus_width) * rate_width / 100 end # 盗Q・[盗W痿囃,痿/痿庵・ gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y, width, plus_width + width * rate_width / 100, height, sp, align1, align2, align3, color1, color2, color3, color4, color5, color6, grade1, grade2) # 盗I盗邸盗W盗i盗痿高囃,SP痿/痿庵β叙&痿泊帋~囃O・・痿囃1総o痿囁ウ draw_actor_sp_hpsp(actor, x, y, width) end #-------------------------------------------------------------------------- # ・・ EXP 盗Q・[盗W痿囃,痿/痿庵・ #-------------------------------------------------------------------------- # 盗I盗邸盗W盗i盗痿高囃,EXP痿/痿庵・囃O draw_actor_sp_hpsp 痿囃&痿淘コ痿楼痿・書宜 alias :draw_actor_exp_hpsp :draw_actor_exp def draw_actor_exp(actor, x, y, width = 204) # 痿・書若~搜ate痿囃) ・損窓・痿囃,exp/nextexp痿囃O痿・B痿恍[ if actor.next_exp != 0 rate = actor.now_exp.to_f / actor.next_exp else rate = 1 end # plus_x:X窓・痿ゞ痿囃,・・痿冰痿・・髄ア rate_x:X窓・痿ゞ痿囃,・・痿冰痿・・髄ア(%) plus_y:Y窓・痿ゞ痿囃,・・痿冰痿・・髄ア # plus_width:痿・昵~囃,痿・・髄ア rate_width:痿・昵~囃,痿・・髄ア(%) height:総c痿・・ # align1:痿/痿庵ζ耽盗C盗v1 0:窓其痿・痿囃? 1:痿吼~痿謂財・ウ痿囁、 2:痿・痿・痿囃? # align2:痿/痿庵ζ耽盗C盗v2 0:総達痿・痿囃? 1:痿吼~痿謂財・ウ痿囁、 2:痿安財・痿囃? # align3:盗Q・[盗W盗^盗C盗v 0:窓其痿・痿囃? 1:痿・痿・痿囃? plus_x = 0 rate_x = 0 plus_y = 25 plus_width = 0 rate_width = 100 height = 10 align1 = 1 align2 = 2 align3 = 0 # 盗O盗痿案断・[盗V盗痿‘低~恆賜=痿剪G grade1:痿甲各嘆・[盗W grade2:貼・盗Q・[盗W # (0:痿安≠囃)盗O盗痿案断・[盗V盗痿‘低~・1:総c痿囃)盗O盗痿案断・[盗V盗痿‘低~・2:貼・痿囃?痿囃)盗O盗痿案断・[盗V盗痿‘低~・・盗総d)・j grade1 = 1 grade2 = 0 # 綜F綜・痿剪G・Bcolor1:邸O・g・Ccolor2:痿吼~・g # color3:痿甲各嘆・[盗W盗_・[盗N盗J盗痿安ー・Ccolor4:痿甲各嘆・[盗W盗痿案辰盗g盗J盗痿安ー # color5:貼・盗Q・[盗W盗_・[盗N盗J盗痿安ー・Ccolor6:貼・盗Q・[盗W盗痿案辰盗g盗J盗痿安ー color1 = Color.new(0, 0, 0, 192) color2 = Color.new(255, 255, 192, 192) color3 = Color.new(0, 0, 0, 192) color4 = Color.new(64, 0, 0, 192) color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192) color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192) # 痿・書若~抛xp痿囃)痿/痿庵・囁オ痿囃H盗Q・[盗W痿囃,痿・昵~囃O痿・B痿恍[ if actor.next_exp != 0 exp = (width + plus_width) * actor.now_exp * rate_width / 100 / actor.next_exp else exp = (width + plus_width) * rate_width / 100 end # 盗Q・[盗W痿囃,痿/痿庵・ gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y, width, plus_width + width * rate_width / 100, height, exp, align1, align2, align3, color1, color2, color3, color4, color5, color6, grade1, grade2) # 盗I盗邸盗W盗i盗痿高囃,EXP痿/痿庵β叙&痿泊帋~囃O・・痿囃1総o痿囁ウ draw_actor_exp_hpsp(actor, x, y) end #-------------------------------------------------------------------------- # ・・ 盗Q・[盗W痿囃,痿/痿庵・ #-------------------------------------------------------------------------- def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3, color1, color2, color3, color4, color5, color6, grade1, grade2) case align1 when 1 x += (rect_width - width) / 2 when 2 x += rect_width - width end case align2 when 1 y -= height / 2 when 2 y -= height end # ・g痿/痿庵・ self.contents.fill_rect(x, y, width, height, color1) self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2) if align3 == 0 if grade1 == 2 grade1 = 3 end if grade2 == 2 grade2 = 3 end end if (align3 == 1 and grade1 == 0) or grade1 > 0 color = color3 color3 = color4 color4 = color end if (align3 == 1 and grade2 == 0) or grade2 > 0 color = color5 color5 = color6 color6 = color end # 痿甲各嘆・[盗W痿囃,痿/痿庵・ self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4, color3, color4, grade1) if align3 == 1 x += width - gauge end # 貼・盗Q・[盗W痿囃,痿/痿庵・ self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4, color5, color6, grade2) end end #------------------------------------------------------------------------------ # ・@Bitmap盗N盗痿案湛痿囃)綜V痿囁サ痿囃(痿財痿拿痿囃O痿剪'痿庵≪~囁ウ痿囃<痿囁オ・B #============================================================================== class Bitmap #-------------------------------------------------------------------------- # ・・ 痿甲・蛋痿囃O盗O盗痿案断・[盗V盗痿‘低~憮~〇貼側 # color1 : 盗X盗^・[盗g盗J盗痿安ー # color2 : 盗G盗痿恣辛盗J盗痿安ー # align : 0:痿安≠囃)盗O盗痿案断・[盗V盗痿‘低~・ # 1:総c痿囃)盗O盗痿案断・[盗V盗痿‘低~・ # 2:貼・痿囃?痿囃)盗O盗痿案断・[盗V盗痿‘低~恆i・盗総d痿囃)痿囃"痿囁ゥ痿剔許&・・j #-------------------------------------------------------------------------- def gradation_rect(x, y, width, height, color1, color2, align = 0) if align == 0 for i in x...x + width red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1) green = color1.green + (color2.green - color1.green) * (i - x) / (width - 1) blue = color1.blue + (color2.blue - color1.blue) * (i - x) / (width - 1) alpha = color1.alpha + (color2.alpha - color1.alpha) * (i - x) / (width - 1) color = Color.new(red, green, blue, alpha) fill_rect(i, y, 1, height, color) end elsif align == 1 for i in y...y + height red = color1.red + (color2.red - color1.red) * (i - y) / (height - 1) green = color1.green + (color2.green - color1.green) * (i - y) / (height - 1) blue = color1.blue + (color2.blue - color1.blue) * (i - y) / (height - 1) alpha = color1.alpha + (color2.alpha - color1.alpha) * (i - y) / (height - 1) color = Color.new(red, green, blue, alpha) fill_rect(x, i, width, 1, color) end elsif align == 2 for i in x...x + width for j in y...y + height red = color1.red + (color2.red - color1.red) * ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 green = color1.green + (color2.green - color1.green) * ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 blue = color1.blue + (color2.blue - color1.blue) * ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 alpha = color1.alpha + (color2.alpha - color1.alpha) * ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 color = Color.new(red, green, blue, alpha) set_pixel(i, j, color) end end elsif align == 3 for i in x...x + width for j in y...y + height red = color1.red + (color2.red - color1.red) * ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 green = color1.green + (color2.green - color1.green) * ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 blue = color1.blue + (color2.blue - color1.blue) * ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 alpha = color1.alpha + (color2.alpha - color1.alpha) * ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 color = Color.new(red, green, blue, alpha) set_pixel(i, j, color) end end end end end #============================================================================== # ・臓 Sprite盗痿囀晋盗痿βー盗痿根 #------------------------------------------------------------------------------ # ・@盗A盗j盗・・[盗V盗痿‘低~憮~囃,邸・痿泊帋~囃O窓s痿囁「盗痿囀晋盗痿βー盗痿高囃%痿囁オ・B #============================================================================== module RPG class Sprite < ::Sprite def damage(value, critical) dispose_damage if value.is_a?(Numeric) damage_string = value.abs.to_s else damage_string = value.to_s end bitmap = Bitmap.new(160, 48) bitmap.font.name = "Arial Black" bitmap.font.size = 32 bitmap.font.color.set(0, 0, 0) bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1) bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1) bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1) bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1) if value.is_a?(Numeric) and value < 0 bitmap.font.color.set(176, 255, 144) else bitmap.font.color.set(255, 255, 255) end bitmap.draw_text(0, 12, 160, 36, damage_string, 1) if critical bitmap.font.size = 20 bitmap.font.color.set(0, 0, 0) bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1) bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1) bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1) bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1) bitmap.font.color.set(255, 255, 255) bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1) end @_damage_sprite = ::Sprite.new @_damage_sprite.bitmap = bitmap @_damage_sprite.ox = 80 + self.viewport.ox @_damage_sprite.oy = 20 + self.viewport.oy @_damage_sprite.x = self.x + self.viewport.rect.x @_damage_sprite.y = self.y - self.oy / 2 + self.viewport.rect.y @_damage_sprite.z = 3000 @_damage_duration = 40 end def animation(animation, hit) dispose_animation @_animation = animation return if @_animation == nil @_animation_hit = hit @_animation_duration = @_animation.frame_max animation_name = @_animation.animation_name animation_hue = @_animation.animation_hue bitmap = RPG::Cache.animation(animation_name, animation_hue) if @@_reference_count.include?(bitmap) @@_reference_count[bitmap] += 1 else @@_reference_count[bitmap] = 1 end @_animation_sprites = [] if @_animation.position != 3 or not @@_animations.include?(animation) for i in 0..15 sprite = ::Sprite.new sprite.bitmap = bitmap sprite.visible = false @_animation_sprites.push(sprite) end unless @@_animations.include?(animation) @@_animations.push(animation) end end update_animation end def loop_animation(animation) return if animation == @_loop_animation dispose_loop_animation @_loop_animation = animation return if @_loop_animation == nil @_loop_animation_index = 0 animation_name = @_loop_animation.animation_name animation_hue = @_loop_animation.animation_hue bitmap = RPG::Cache.animation(animation_name, animation_hue) if @@_reference_count.include?(bitmap) @@_reference_count[bitmap] += 1 else @@_reference_count[bitmap] = 1 end @_loop_animation_sprites = [] for i in 0..15 sprite = ::Sprite.new sprite.bitmap = bitmap sprite.visible = false @_loop_animation_sprites.push(sprite) end update_loop_animation end def animation_set_sprites(sprites, cell_data, position) for i in 0..15 sprite = sprites[i] pattern = cell_data[i, 0] if sprite == nil or pattern == nil or pattern == -1 sprite.visible = false if sprite != nil next end sprite.visible = true sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192) if position == 3 if self.viewport != nil sprite.x = self.viewport.rect.width / 2 sprite.y = self.viewport.rect.height - 160 else sprite.x = 320 sprite.y = 240 end else sprite.x = self.x + self.viewport.rect.x - self.ox + self.src_rect.width / 2 sprite.y = self.y + self.viewport.rect.y - self.oy + self.src_rect.height / 2 sprite.y -= self.src_rect.height / 4 if position == 0 sprite.y += self.src_rect.height / 4 if position == 2 end sprite.x += cell_data[i, 1] sprite.y += cell_data[i, 2] sprite.z = 2000 sprite.ox = 96 sprite.oy = 96 sprite.zoom_x = cell_data[i, 3] / 100.0 sprite.zoom_y = cell_data[i, 3] / 100.0 sprite.angle = cell_data[i, 4] sprite.mirror = (cell_data[i, 5] == 1) sprite.opacity = cell_data[i, 6] * self.opacity / 255.0 sprite.blend_type = cell_data[i, 7] end end end end
Observação: se você gostou deste post ou ele lhe foi útil de alguma forma, por favor considere apoiar financeiramente a Gaming Room. Fico feliz só de ajudar, mas a contribuição do visitante é muito importante para que este site continua existindo e para que eu possa continuar provendo este tipo de conteúdo e melhorar cada vez mais. Acesse aqui e saiba como. Obrigado!