1 Barras no estilo CogWheel 1.0 30/7/2012, 19:58
The Lucas Wugades
Membro Honorário III
Barras no estilo CogWheel 1.0
por Syvkal
Introdução
Este pequeno script muda o estilo das barras padrão do RPG Maker VX (que exibem quantidades de HP, MP, atributos, etc.) para um estilo mais conhecido, e bonito. Trata-se do estilo CogWheel.
Como usar
Abra o Editor de Scripts, crie um novo script na seção de Scripts Adicionais e cole o código abaixo.
Criado por Syvkal
por Syvkal
Introdução
Este pequeno script muda o estilo das barras padrão do RPG Maker VX (que exibem quantidades de HP, MP, atributos, etc.) para um estilo mais conhecido, e bonito. Trata-se do estilo CogWheel.
Como usar
Abra o Editor de Scripts, crie um novo script na seção de Scripts Adicionais e cole o código abaixo.
- Código:
#==============================================================================
# Barras no estilo CogWheel
#-------------------------------------------------------------------------------
# por Syvkal
# Versão 1.0
# 04/03/08
#==============================================================================
# Cores da borda
COG_COLOR1 = Color.new(0, 0, 0, 192) # Borda exterior
COG_COLOR2 = Color.new(255, 255, 192, 192) # Borda interior
# Cores do núcleo
COG_COLOR3 = Color.new(0, 0, 0, 12) # Metade do sombreamento
COG_COLOR4 = Color.new(64, 0, 0, 92) # Metade do sombreamento
class Window_Base < Window
alias draw_actor_hp_gauge_original draw_actor_hp_gauge
def draw_actor_hp_gauge(actor, x, y, width = 120)
if actor.maxhp != 0
rate = actor.hp.to_f / actor.maxhp
else
rate = 0
end
if actor.maxhp != 0
gw = width * actor.hp / actor.maxhp
else
gw = 0
end
gc1 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
gc2 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
self.contents.fill_rect(x-2, y + WLH - 10, width+4, 10, COG_COLOR1)
self.contents.fill_rect(x-1, y + WLH - 9, width+2, 8, COG_COLOR2)
self.contents.gradient_fill_rect(x, y + WLH - 8, width, 6, COG_COLOR3, COG_COLOR4)
self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
end
alias draw_actor_mp_gauge_original draw_actor_mp_gauge
def draw_actor_mp_gauge(actor, x, y, width = 120)
if actor.maxmp != 0
rate = actor.mp.to_f / [actor.maxmp, 1].max
else
rate = 1
end
if actor.maxmp != 0
gw = width * actor.mp / [actor.maxmp, 1].max
else
gw = width
end
gc1 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
gc2 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
self.contents.fill_rect(x-2, y + WLH - 10, width+4, 10, COG_COLOR1)
self.contents.fill_rect(x-1, y + WLH - 9, width+2, 8, COG_COLOR2)
self.contents.gradient_fill_rect(x, y + WLH - 8, width, 6, COG_COLOR3, COG_COLOR4)
self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
end
alias draw_actor_parameter_original draw_actor_parameter
def draw_actor_parameter(actor, x, y, type)
draw_actor_parameter_gauge(actor, x, y, type)
draw_actor_parameter_original(actor, x, y, type)
end
def draw_actor_parameter_gauge(actor, x, y, type)
case type
when 0
e1 = actor.atk
gc1 = Color.new(253, 53, 56, 192)
gc2 = Color.new(242, 2, 6, 192)
when 1
e1 = actor.def
gc1 = Color.new(238, 254, 124, 192)
gc2 = Color.new(228, 253, 48, 192)
when 2
e1 = actor.spi
gc1 = Color.new(119, 203, 254, 192)
gc2 = Color.new(8, 160, 253, 192)
when 3
e1 = actor.agi
gc1 = Color.new(124, 254, 155, 192)
gc2 = Color.new(33, 253, 86, 192)
end
# Calcular gradiente da barra
e2 = 999
if e1.to_f != 0
rate = e1.to_f / e2.to_f
else
rate = 1
end
# Ajustar cor da barra baseado no gradiente e parâmetros
for i in 0..7
r = gc2.red * rate
g = (gc2.green - 10) * rate
b = gc2.blue * rate
a = gc2.alpha
end
# Calcular largura
width = 168
if e1.to_f != 0
par = width * e1.to_f / e2.to_f
else
par = width
end
# Cálculo de equipamento
case type
when 0
if e1 == 0
par = 0
end
when 1
if e1 == 0
par = 0
end
end
self.contents.fill_rect(x-2, y + WLH - 10, width+4, 10, COG_COLOR1)
self.contents.fill_rect(x-1, y + WLH - 9, width+2, 8, COG_COLOR2)
self.contents.gradient_fill_rect(x, y + WLH - 8, width, 6, COG_COLOR3, COG_COLOR4)
self.contents.gradient_fill_rect(x, y + WLH - 8, par, 6, gc1, gc2)
end
end
<p>class Window_SkillStatus < Window_Base
alias refresh_original refresh
def refresh
draw_actor_name(@actor, 4, 0)
draw_actor_level(@actor, 140, 0)
draw_actor_hp(@actor, 238, 0)
draw_actor_mp(@actor, 390, 0)
end
end
Criado por Syvkal