[XP]-Silentwalker's Zune Bars-[Aporte]

OP

~Doku

Banneado
Mensajes
1.024
Reacciones
0
Puntos
0
Ubicación
Mafia
Es hora de comenzar a aportar script de nuevo.

Introducción:

Simple, automaticamente añade barras para el HP/SP/EXP en el menu de tu juego
Incluye el metodo para crear una barra donde quieras, pero necesitas conocimientos básicos sobre RGSS.

Características

  • Dos estilos diferentes; Zune y degradado vertical comun.
  • Puedes elegir el alto y el ancho de las barras así como el color y el fondo.
  • Es posible elegir si las barras van a mostrarse automáticamente
Screen:

screenhunter05apr292259.png


Script:

Código:
#==============================================================================
# **** Silentwalker's Zune Bars
#------------------------------------------------------------------------------
# *** Version - 1.0
# *** Fecha - 27/04/10 (DD/MM/YY)
#------------------------------------------------------------------------------
# ** Instrucciones - Pegar arriba de Main y debajo de cualquier cosa que muestre
# los parametros de HP, MP y EXP en caso de querer muestreo automatico.
# 
# * Configuracion de HP/SP/EXP
# - La constante SWZUNE_xCOLOR es un array con los dos colores, el primero es 
# el inicial y el segundo, el final.
# - La constante SWZUNE_xVSIZE es un array con los dos parametros de tamaño, el
# primero es el ancho de la barra y el segundo el alto.
#
# <a href="http://planetarpg.com.ar/foro/" target="_blank">http://planetarpg.com.ar/foro/</a>
#==============================================================================
 
  #--------------------------------------------------------------------------
  # * Zune Style
  #--------------------------------------------------------------------------
  SWZUNE_ZSTYLED = true
  #--------------------------------------------------------------------------
  # * Modificar los metodos de muestreo en Window_Base para usar las barras
  #--------------------------------------------------------------------------
  SWZUNE_AUTOUSE = true
  #--------------------------------------------------------------------------
  # * Modificador del eje Y de la barra debajo del texto (when autouse)
  #--------------------------------------------------------------------------
  SWZUNE_FNTJSTF = 18
  #--------------------------------------------------------------------------
  # * Color para el fondo de la barra
  #--------------------------------------------------------------------------
  SWZUNE_BKCOLOR = Color.new(55, 55, 55, 200)
  #--------------------------------------------------------------------------
  # * HP
  #--------------------------------------------------------------------------
  SWZUNE_HPCOLOR = [Color.new(255, 185, 0, 255), Color.new(155, 55, 0, 200)]
  SWZUNE_HPVSIZE = [100, 8]
  #--------------------------------------------------------------------------
  # * MP
  #--------------------------------------------------------------------------
  SWZUNE_MPCOLOR = [Color.new(0, 185, 255, 255), Color.new(0, 55, 155, 200)]
  SWZUNE_MPVSIZE = [100, 8]
  #--------------------------------------------------------------------------
  # * EP
  #--------------------------------------------------------------------------
  SWZUNE_EPCOLOR = [Color.new(0, 255, 185, 255), Color.new(0, 155, 55, 200)]
  SWZUNE_EPVSIZE = [120, 8]
 
#==============================================================================
# ** Bitmap
#------------------------------------------------------------------------------
# - Adds Zune Bar Method
#==============================================================================
 
class Bitmap
  #--------------------------------------------------------------------------
  # * Draw Zune Bar
  #--------------------------------------------------------------------------
  def draw_swzune_bar(x, y, width, height, value, end_v, c1, c2)
    end_v, value = 1, 1 if end_v <= 0
    fill_rect(x - 1, y - 1, width + 2, height + 3, c1)
    set_pixel(x - 1, y - 1, Color.new(0, 0, 0, 0))
    set_pixel(x - 1, y + 1 + height, Color.new(0, 0, 0, 0))
    set_pixel(x + width, y - 1, Color.new(0, 0, 0, 0))
    set_pixel(x + width, y + 1 + height, Color.new(0, 0, 0, 0))
    fill_rect(x, y, width, height + 1, SWZUNE_BKCOLOR)
    w = width * value / end_v
    (0..height).each {|i|
    r = (c2.red + (c1.red - c2.red) * (height - i) / height)
    g = (c2.green + (c1.green - c2.green) * (height - i) / height)
    b = (c2.blue + (c1.blue - c2.blue) * (height - i) / height)
    a = (c2.alpha + (c1.alpha - c2.alpha) * (height - i) / height)
    if (i >= (2 + (height / 2))) && SWZUNE_ZSTYLED
      r = c2.red
      g = c2.green
      b = c2.blue
      a = c2.alpha
    end
    fill_rect(x, y + i, w, 1, Color.new(r, g, b, a))
    }
  end
end
 
if SWZUNE_AUTOUSE
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# - Agrega metodos para mostrar automaticamente
#==============================================================================
  class Window_Base < Window
    #--------------------------------------------------------------------------
    # * draw_actor_hp
    #--------------------------------------------------------------------------
    alias swzune_draw_actor_hp draw_actor_hp
    #--------------------------------------------------------------------------
    # * draw_actor_sp
    #--------------------------------------------------------------------------
    alias swzune_draw_actor_sp draw_actor_sp
    #--------------------------------------------------------------------------
    # * draw_actor_exp
    #--------------------------------------------------------------------------
    alias swzune_draw_actor_exp draw_actor_exp
    #--------------------------------------------------------------------------
    # * Draw HP
    #--------------------------------------------------------------------------
    def draw_actor_hp(actor, x, y, width = 144)
      if $scene.is_a? Scene_Menu
        hp_string = $data_system.words.hp + " " + actor.hp.to_s + "/" + actor.maxhp.to_s
        w = SWZUNE_HPVSIZE[0]
        h = SWZUNE_HPVSIZE[1]
        c1 = SWZUNE_HPCOLOR[0]
        c2 = SWZUNE_HPCOLOR[1]
        e1 = actor.hp
        e2 = actor.maxhp
        self.contents.font.color = actor.hp == 0 ? knockout_color :
          actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
        self.contents.draw_text(x, y - h, w, 32, hp_string, 1)
        self.contents.draw_swzune_bar(x, y + SWZUNE_FNTJSTF, w, h, e1, e2, c1, c2)
        return
      end
      swzune_draw_actor_hp(actor, x, y, width = 144)
    end
    #--------------------------------------------------------------------------
    # * Draw SP
    #--------------------------------------------------------------------------
    def draw_actor_sp(actor, x, y, width = 144)
      if $scene.is_a? Scene_Menu
        mp_string = $data_system.words.sp + " " + actor.sp.to_s + "/" + actor.maxsp.to_s
        w = SWZUNE_MPVSIZE[0]
        h = SWZUNE_MPVSIZE[1]
        c1 = SWZUNE_MPCOLOR[0]
        c2 = SWZUNE_MPCOLOR[1]
        e1 = actor.sp
        e2 = actor.maxsp
        self.contents.font.color = actor.sp == 0 ? knockout_color :
          actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
        self.contents.draw_text(x, y - h, w, 32, mp_string, 1)
        self.contents.draw_swzune_bar(x, y + SWZUNE_FNTJSTF, w, h, e1, e2, c1, c2)
        return
      end
      swzune_draw_actor_sp(actor, x, y, width = 144)
    end
    #--------------------------------------------------------------------------
    # * Draw EXP
    #--------------------------------------------------------------------------
    def draw_actor_exp(actor, x, y)
      if $scene.is_a? Scene_Menu
        w = SWZUNE_EPVSIZE[0]
        h = SWZUNE_EPVSIZE[1]
        c1 = SWZUNE_EPCOLOR[0]
        c2 = SWZUNE_EPCOLOR[1]
        e1 = actor.exp_s.to_i
        e2 = actor.next_exp_s.to_i
        exp_string = "Exp  " + " " + actor.exp_s + "/" + actor.next_exp_s
        self.contents.draw_text(x, y - h, w, 32, exp_string, 1)
        self.contents.draw_swzune_bar(x, y + SWZUNE_FNTJSTF, w, h, e1, e2, c1, c2)
        return
      end
      swzune_draw_actor_exp(actor, x, y)
    end
  end
end

Instrucciones:

Pegar encima del main.

Créditos: Silentwalker

Saludos.
 
Arriba Pie