+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker XP (RGSS) Engine (https://www.save-point.org/forum-116.html)
+---- Thread: SephirothSpawn's Bars (/thread-2449.html)
SephirothSpawn's Bars - Raziel - 03-07-2008
SephirothSpawn's Bars
Version: 1.0
Introduction
An alternative to Cogwheel's Menu Bar's. It's also sexier. ;)
Features
Draws HP/SP/Exp and also parameters bars, whereever they are shown.
Screenshots
Script
Post this above main
Code:
class Window_Base < Window
alias raz_bars_base_exp draw_actor_exp
alias raz_bars_base_parameter draw_actor_parameter
#--------------------------------------------------------------------------
# * 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
# Exit if bar is empty
return if max==0
# 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
#--------------------------------------------------------------------------
# * Draw HP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y, width = 144)
# Calculate if there is draw space for MaxHP
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
if $game_temp.in_battle
bar_width = hp_x - x + 50
else
bar_width = hp_x - x + 100
end
# Draw HP
draw_slant_bar(x, y + 18, actor.hp, actor.maxhp, bar_width, 6, Color.new(100, 0, 0, 255), Color.new(255, 0, 0, 255))
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
# Draw MaxHP
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
end
end
#--------------------------------------------------------------------------
# * Draw SP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
def draw_actor_sp(actor, x, y, width = 144)
# Calculate if there is draw space for MaxHP
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
if $game_temp.in_battle
bar_width = sp_x - x + 50
else
bar_width = sp_x - x + 100
end
# Draw SP
draw_slant_bar(x, y + 18, actor.sp, actor.maxsp, bar_width, 6, Color.new(0, 0, 100, 255), Color.new(0, 0, 255, 255))
# Draw "SP" text string
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
# Draw MaxSP
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
end
end
def draw_actor_exp(actor, x, y)
if actor.level == 99
draw_slant_bar(x, y + 18, 1, 1, 190, 6, Color.new(0, 100, 0, 255), Color.new(0, 255, 0, 255))
else
draw_slant_bar(x, y + 18, actor.now_exp, actor.next_exp, 190, 6, Color.new(0, 100, 0, 255), Color.new(0, 255, 0, 255))
end
raz_bars_base_exp(actor, x, y)
end
def draw_actor_parameter(actor, x, y, type)
case type
when 0
para_color1 = Color.new(100,0,0)
para_color2 = Color.new(255,0,0)
para_begin = actor.atk
when 1
para_color1 = Color.new(100,100,0)
para_color2 = Color.new(255,255,0)
para_begin = actor.pdef
when 2
para_color1 = Color.new(100,0,100)
para_color2 = Color.new(255,0,255)
para_begin = actor.mdef
when 3
para_color1 = Color.new(50,0,100)
para_color2 = Color.new(50,0,255)
para_begin = actor.str
when 4
para_color1 = Color.new(0,100,0)
para_color2 = Color.new(0,255,0)
para_begin = actor.dex
when 5
para_color1 = Color.new(50,0,50)
para_color2 = Color.new(255,0,255)
para_begin = actor.agi
when 6
para_color1 = Color.new(0,100,100)
para_color2 = Color.new(0,255,255)
para_begin = actor.int
end
draw_slant_bar(x, y + 18, para_begin, 999, 155, 4, para_color1, para_color2)
raz_bars_base_parameter(actor, x, y, type)
end
end
class Game_Actor
#--------------------------------------------------------------------------
# * Get the current EXP
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Get the next level's EXP
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
Instructions
Just delete Cogwheel's bars and place this script above main. ^_^
FAQ
None so far.
FORUM ADMIN NOTE
DerVVulfman: "I added two lines into SephirothSpawn's script that prevents a problem when a statistic (such as SP) has 0 points.
Credits and Thanks
Credits and thanks to SephirothSpawn for the gradient bars script.
I know this is one hell of an old post and the user isn't even in the forums anymore, but I got a question for anyone who can help me :/ Is there anyway to set a MAXIMUM value to the bar while representing the values? Say my character's parameters get to 255 tops, how can I make the bars to be fully filled when the stat reaches 255? Thanks beforehand and sorry again for reviving the undead :)
Near the bottom of the script there's a line that goes draw_slant_bar(x, y + 18, para_begin, 999, 155, 4, para_color1, para_color2), simply edit the '999' to 255.
Hi, first I'd like to say this is an amazing Bar script thats more prettier than Cogwheel's one but it seems like the script doesn't like it if any of my Actor's MaxSP is 0 at all times. I have certain classes that does not have any SP Growth and cogwheel's script never gave me any trouble xcept this one. Anyone would be kind enough to help out? Thanks in advance!
I guess Seph didn't account for that. Wow. You're the first person to notice that after all these years. In any case, I have a solution:
Place this bit of code on line 23, right above the # Draws Bar code. In doing this, the background for the bar will draw just fine. But it will exit if there is no value to send into the bar.
Code:
# Exit if bar is empty
return if max==0
In any event, I just edited the script posted above and included the fix. I know Seph wouldn't mind.
(02-05-2013, 06:11 PM)DerVVulfman Wrote: I guess Seph didn't account for that. Wow. You're the first person to notice that after all these years. In any case, I have a solution:
Place this bit of code on line 23, right above the # Draws Bar code. In doing this, the background for the bar will draw just fine. But it will exit if there is no value to send into the bar.
Code:
# Exit if bar is empty
return if max==0
In any event, I just edited the script posted above and included the fix. I know Seph wouldn't mind.
Sorry for late reply [b]DerVVulfman[/b], been working all week and finally got sometime off but thanks a million for resolving the issue I have!