Lo inserisco qui poiché è un problema di script e mi sembrava logico metterlo qui..
Ho un problema con i PV (Punti vita) quando in-game sei stato avvelenato (no per causa mostro), la vita del PG non scende al di sotto di 1.. invece a me serve proprio che scenda a 0 cosi che si ha lo stato KO facendomi partire un evento comune..
come posso risolvere?
L'unica script che coinvolge le barre di vita e PM e la Menu Bars di Eikichi.. ma io non so dove mettere le mani e non so neanche se sia questa la causa... comunque sia posto il codice
Question
Astro86
Lo inserisco qui poiché è un problema di script e mi sembrava logico metterlo qui..
Ho un problema con i PV (Punti vita) quando in-game sei stato avvelenato (no per causa mostro), la vita del PG non scende al di sotto di 1.. invece a me serve proprio che scenda a 0 cosi che si ha lo stato KO facendomi partire un evento comune..
come posso risolvere?
L'unica script che coinvolge le barre di vita e PM e la Menu Bars di Eikichi.. ma io non so dove mettere le mani e non so neanche se sia questa la causa... comunque sia posto il codice
# ** COGWHEEL Style Menu Bars
#------------------------------------------------------------------------------
# by Syvkal
# Version 3.0
# 20-05-2008
# Tradotto by Eikichi
# 03/06/2008
#==============================================================================
#
# ISTRUZIONI:
#
# Questo è uno script Plug 'N' Play
# Funzionerà in qualsiasi classe voi lo mettiate.
#
# è molto semplice creare da voi stessi le vostre barre nuove.
# Per creare una barra modificare:
# draw_custom_gauge
#
# Seguito da:
# (value, max, x, y, color1, color2, width, height, slanted, up)
#
# Value - è il valore base per creare la barra
# Max - è il valore massimo nella barra
# x, y - sono le coordinate x e y
# Color1, Color2 - sono i due colori usati nella barra
# specificate il colorei in Color.new(r,g,b,a) o semplicemente
# - aggiuntete il numero del colore dalla windowskin
# width, height - solo i valori di altezza e lunghezza della barra
# sono di default 120 e 6
# slanted - se impostato su TRUE la barra sarà un parallelepipedo
# di default è FALSE
# up - se impostato su TRUE la barra sarà verticale
# by default it is set to false
# di default è FALSE
#==============================================================================
module COG
#=================================================#
# ** C O N F I G U R A Z I O N E ** #
#=================================================#
# Usa i colori della windowskin
USE_WINDOWSKIN = true
# valore massimo dei parametri
P_MAX = 500
# Lo script usa delle costanti che possono essere editate qui di seguito
# Controllano i colori della barra piena e a metà:
# Colore del bordo
COLOR1 = Color.new(0, 0, 0, 192) # Bordo esterno
COLOR2 = Color.new(255, 255, 192, 192) # Bordo interno
# Colore della barra
COLOR3 = Color.new(0, 0, 0, 12) # Colore della prima metà
COLOR4 = Color.new(64, 0, 0, 92) # Colore della seconda metà
# Impostazioni Barra
EMPTY = false # VUOTA (false - Lato : true - Verticale)
FILLER = false # PIENA (false - Lato : true - Verticale)
# Lo script usa delle switch che possono essere editate qui di seguito
# Controllano se la barra è rettangolare/parallelepipeda o orizzontale/verticale
# Barra HP e MP
HPMPSLANT = false # parallelepipeda?
HPMPUP = false # verticale?
# Parameter Bars
PARSLANT = false # parallelepipeda?
PARUP = false # verticale?
# Limit Break Bars
DVVLBSLANT = true # parallelepipeda?
DVVLBUP = false # verticale?
#=================================================#
end
class Window_Base < Window
alias draw_actor_hp_gauge_original draw_actor_hp_gauge
def draw_actor_hp_gauge(actor, x, y, width = 120)
rate = actor.hp.to_f / actor.maxhp
gw = width * actor.hp / actor.maxhp
gc1 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
gc2 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
COG::HPMPUP ? ow = 6 : ow = width; COG::HPMPUP ? oh = width : oh = 6
COG::HPMPSLANT ? self.contents.cogwheel_fill_slant(x, y + WLH - 8, gw, ow, oh, gc1, gc2, COG::HPMPUP) :
self.contents.cogwheel_fill_rect(x, y + WLH - 8, gw, ow, oh, gc1, gc2, COG::HPMPUP)
end
alias draw_actor_mp_gauge_original draw_actor_mp_gauge
def draw_actor_mp_gauge(actor, x, y, width = 120)
rate = actor.mp.to_f / [actor.maxmp, 1].max
gw = width * actor.mp / [actor.maxmp, 1].max
gc1 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
gc2 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
COG::HPMPUP ? ow = 6 : ow = width; COG::HPMPUP ? oh = width : oh = 6
COG::HPMPSLANT ? self.contents.cogwheel_fill_slant(x, y + WLH - 8, gw, ow, oh, gc1, gc2, COG::HPMPUP) :
self.contents.cogwheel_fill_rect(x, y + WLH - 8, gw, ow, oh, gc1, gc2, COG::HPMPUP)
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, width = 168)
case type
when 0
e1 = actor.atk
COG::USE_WINDOWSKIN ? gc1 = text_color(20) : gc1 = Color.new(253, 53, 56, 192)
COG::USE_WINDOWSKIN ? gc2 = text_color(2) : gc2 = Color.new(242, 74, 6, 192)
when 1
e1 = actor.def
COG::USE_WINDOWSKIN ? gc1 = text_color(21) : gc1 = Color.new(238, 254, 124, 192)
COG::USE_WINDOWSKIN ? gc2 = text_color(17) : gc2 = Color.new(228, 253, 48, 192)
when 2
e1 = actor.spi
COG::USE_WINDOWSKIN ? gc1 = text_color(31) : gc1 = Color.new(119, 203, 254, 192)
COG::USE_WINDOWSKIN ? gc2 = text_color(30) : gc2 = Color.new(8, 160, 253, 192)
when 3
e1 = actor.agi
COG::USE_WINDOWSKIN ? gc1 = text_color(4) : gc1 = Color.new(124, 254, 155, 192)
COG::USE_WINDOWSKIN ? gc2 = text_color(12) : gc2 = Color.new(33, 253, 86, 192)
end
e2 = COG::P_MAX
rate = [e1.to_f / e2.to_f, 1].min
gw = width * [e1.to_f / e2.to_f, 1].min
r = gc2.red * rate
g = (gc2.green - 72) * rate
b = gc2.blue * rate
a = gc2.alpha
COG::PARUP ? ow = 6 : ow = width; COG::HPMPUP ? oh = width : oh = 6
COG::PARSLANT ? self.contents.cogwheel_fill_slant(x, y + WLH - 8, gw, ow, oh, Color.new(r, g, b, a), gc1, COG::PARUP) :
self.contents.cogwheel_fill_rect(x, y + WLH - 8, gw, ow, oh, Color.new(r, g, b, a), gc1, COG::PARUP)
end
def draw_custom_gauge(value, max, x, y, color1, color2, width=120, height=6, slanted = false, up = false)
rate = [value.to_f / max.to_f, 1].min
gw = width * [value.to_f / max.to_f, 1].min
color1.is_a?(Integer) ? gc1 = text_color(color1) : gc1 = color1
color2.is_a?(Integer) ? gc2 = text_color(color2) : gc2 = color2
r = gc2.red * rate
g = (gc2.green - 72) * rate
b = gc2.blue * rate
a = gc2.alpha
up ? ow = height : ow = width; up ? oh = width : oh = height
slanted ? self.contents.cogwheel_fill_slant(x, y + WLH - 8, gw, ow, oh, gc1, Color.new(r, g, b, a), up) :
self.contents.cogwheel_fill_rect(x, y + WLH - 8, gw, ow, oh, gc1, Color.new(r, g, b, a), up)
end
def draw_actor_lb(actor, x, y, width = 120)
return unless actor.lb_gauge_visible?
st1 = lb_gauge_normal_start_color; st2 = lb_gauge_max_start_color
ed1 = lb_gauge_normal_end_color; ed2 = lb_gauge_max_end_color
rate = actor.limitbreak.to_f / [LB_MAX, 1].max
gw = width * actor.limitbreak / LB_MAX
gc1 = (gw == width ? st2 : Color.new(st1.red,st1.green-(10*rate),st1.blue-(10*rate), 192))
gc2 = (gw == width ? ed2 : Color.new(ed1.red,ed1.green-(10*rate),ed1.blue-(10*rate), 192))
COG::DVVLBUP ? ow = 6 : ow = width; COG::HPMPUP ? oh = width : oh = 6
COG::DVVLBSLANT ? self.contents.cogwheel_fill_slant(x, y + WLH - 8, gw, ow, oh, gc1, gc2, COG::DVVLBUP) :
self.contents.cogwheel_fill_rect(x, y + WLH - 8, gw, ow, oh, gc1, gc2, COG::DVVLBUP)
end
end
class Window_SkillStatus < Window_Base
def refresh
self.contents.clear
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
class Bitmap
alias gradient_original gradient_fill_rect unless method_defined?('gradient_original')
def gradient_fill_rect(*args)
args.pop if !args.last if args.size == 4 || 7 and !args.last
gradient_original(*args)
end
def cogwheel_fill_rect(x, y, gw, width, height, gc1, gc2, up = false)
fill_rect(x-2, y-2, width+4, height+4, COG::COLOR1)
fill_rect(x-1, y-1, width+2, height+2, COG::COLOR2)
gradient_fill_rect(x, y, width, height, COG::COLOR3, COG::COLOR4, COG::EMPTY)
gradient_fill_rect(x, y, up ? width : gw, up ? gw : height, gc1, gc2, COG::FILLER)
end
def cogwheel_fill_slant(x, y, gw, width, height, gc1, gc2, up = false)
up ? bgx = 2 : bgx = 4; up ? bdx = 1 : bdx = 2
up ? bgy = 4 : bgy = 2; up ? bdy = 2 : bdy = 1
up ? bgw = 4 : bgw = 8; up ? bdw = 2 : bdw = 4
up ? bgh = 8 : bgh = 4; up ? bdh = 5 : bdh = 2
fill_slant(x-bgx, y-bgy, width+bgw, height+bgh, COG::COLOR1, up)
fill_slant(x-bdx, y-bdy, width+bdw, height+bdh, COG::COLOR2, up)
gradient_fill_slant(x, y, width, height, COG::COLOR3, COG::COLOR4, COG::EMPTY, up)
gradient_fill_slant(x, y,up ? width : gw,up ? gw : height, gc1, gc2, COG::FILLER, up)
end
def gradient_fill_slant(x, y, width, height, gc1, gc2, vertical = false, up = false)
up ? ow = height : ow = width; up ? oh = width : oh = height
for i in 1..oh
for j in 1..(ow-2)-oh
if vertical
red = gc1.red * (height - i) / height + gc2.red * i / height
green = gc1.green * (height - i) / height + gc2.green * i / height
blue = gc1.blue * (height - i) / height + gc2.blue * i / height
alpha = gc1.alpha * (height - i) / height + gc2.alpha * i / height
color = Color.new(red, green, blue, alpha)
if up
gradient_fill_rect(x + width - i, y+i+1, 1, (height-2)-width, gc1, gc2, vertical)
else
set_pixel(x + j + i, y + height - i, color)
end
else
red = gc1.red * (width - i) / width + gc2.red * i / width
green = gc1.green * (width - i) / width + gc2.green * i / width
blue = gc1.blue * (width - i) / width + gc2.blue * i / width
alpha = gc1.alpha * (width - i) / width + gc2.alpha * i / width
color = Color.new(red, green, blue, alpha)
if up
set_pixel(x + width - i, y + j + i, color)
else
gradient_fill_rect(x+i+1, y + height - i, (width-2)-height, 1, gc1, gc2)
end
end
end
end
end
def fill_slant(x, y, width, height, gc1, up = false)
up ? oh = width : oh = height
for i in 1..oh
if up
fill_rect(x + width -i, y+i, 1, height-width, gc1)
else
fill_rect(x+i, y + height -i, width-height, 1, gc1)
end
end
end
end
Edited by Astro86Link to comment
Share on other sites
5 answers to this question
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