My problem is that I have 2 health and sp bars appearing in the CMS. The problem is that I have 2 scripts that "draw" the bars on the menu, and I need bot those scripts too...unless they can be combined. What I need is so it only shows the bars in the CMS and the battle (thats what the other script does) The other script that "draws" the bars is apparently for the menu XD but also for the battle system. So I need some sort of edit so that these one will atleast keep the bars in the menu and the other will keep the bars in the battle system. There are a total of 2 scripts that rely on each other, the third is the part of the CMS where it draws the bars. I have small knowledge of scripting, I tryed playing around with no luck, so now I'm asking.
I believe line 26 (I think) in the Enemy HP Bars is what connects to the HP/MP/ATB (Seph Slant) script. Thats where I ran into some problems trying to modify.
Thanks for any help given! :thumb:
CMS Part
HP/MP/ATB (Seph Slant)
Enemy HP Bars
I believe line 26 (I think) in the Enemy HP Bars is what connects to the HP/MP/ATB (Seph Slant) script. Thats where I ran into some problems trying to modify.
Thanks for any help given! :thumb:
CMS Part
Code:
#==============================================================================
# ** LegACy's Script Customization (CMS-Alternate)
#==============================================================================
class LegACy
#--------------------------------------------------------------------------
# * Features Customization Constants
#--------------------------------------------------------------------------
CUSTOM_SAVE = true # True if you're using the custom save menu that comes with the menu.
SAVE_COUNT = 99 # Number of saves slot available for custom save menu.
BATTLE_BAR = false # True if you want to have bar for battle system.
#--------------------------------------------------------------------------
# * Item Grouping Customization Constants
#--------------------------------------------------------------------------
ITEMS = [17, 18, 19, 20, 21, 22] # Attributes ID for Item Catagory in order.
#--------------------------------------------------------------------------
# * Display Customization Constants
#--------------------------------------------------------------------------
WIN_Z = 201 # Z value of CMS' windows.
ICON_NAME = ['stat', 'menu', 'item'] # Image name for icon,
STAT_BAR = [false, false, true] # Windows where the stat bar appears.
BAR_COLOR = [Color.new(255, 0, 0, 200), # Color for bars.
Color.new(255, 255, 0, 200),
Color.new(0, 255, 255, 200),
Color.new(200, 64, 64, 255),
Color.new(64, 128, 64, 255),
Color.new(160, 100, 160, 255),
Color.new(128, 128, 200, 255)]
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Get Current Experience Points
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Get Needed Experience Points
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# This class handles the map. It includes scrolling and passable determining
# functions. Refer to "$game_map" for the instance of this class.
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Get Map Name
#--------------------------------------------------------------------------
def name
load_data('Data/MapInfos.rxdata')[@map_id].name
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#-----------------------------------------------------------------------
# Draw Stat Bar
# actor : actor
# x : bar x-coordinate
# y : bar y-coordinate
# stat : stat to be displayed
#--------------------------------------------------------------------------
def draw_LegACy_bar(actor, x, y, stat, width = 156, height = 7)
bar_color = Color.new(0, 0, 0, 255)
end_color = Color.new(255, 255, 255, 255)
max = 999
case stat
when 'hp'
bar_color = Color.new(150, 0, 0, 255)
end_color = Color.new(255, 255, 60, 255)
min = actor.hp
max = actor.maxhp
when 'sp'
bar_color = Color.new(0, 0, 155, 255)
end_color = Color.new(255, 255, 255, 255)
min = actor.sp
max = actor.maxsp
when 'exp'
bar_color = Color.new(0, 155, 0, 255)
end_color = Color.new(255, 255, 255, 255)
unless actor.level == $data_actors[actor.id].final_level
min = actor.now_exp
max = actor.next_exp
else
min = 1
max = 1
end
when 'atk'
bar_color = LegACy::BAR_COLOR[0]
min = actor.atk
when 'pdef'
bar_color = LegACy::BAR_COLOR[1]
min = actor.pdef
when 'mdef'
bar_color = LegACy::BAR_COLOR[2]
min = actor.mdef
when 'str'
bar_color = LegACy::BAR_COLOR[3]
min = actor.str
when 'dex'
bar_color = LegACy::BAR_COLOR[4]
min = actor.dex
when 'agi'
bar_color = LegACy::BAR_COLOR[5]
min = actor.agi
when 'int'
bar_color = LegACy::BAR_COLOR[6]
min = actor.int
end
max = 1 if max == 0
# 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
# Draws Bar
for i in 1..( (min.to_f / 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
case stat
when 'hp'
draw_actor_hp(actor, x - 1, y - 18)
when 'sp'
draw_actor_sp(actor, x - 1, y - 18)
when 'exp'
draw_actor_exp(actor, x - 1, y - 18)
end
end
#--------------------------------------------------------------------------
# * Draw Sprite
#--------------------------------------------------------------------------
def draw_LegACy_sprite(x, y, name, hue)
bitmap = RPG::Cache.character(name, hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
# Bitmap Rectange
src_rect = Rect.new(0, 0, cw, ch)
# Draws Bitmap
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# * Get Upgrade Text Color
#--------------------------------------------------------------------------
def up_color
return Color.new(74, 210, 74)
end
#--------------------------------------------------------------------------
# * Get Downgrade Text Color
#--------------------------------------------------------------------------
def down_color
return Color.new(170, 170, 170)
end
#--------------------------------------------------------------------------
# * Draw parameter
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# type : parameter type
#------------------------------------------------------------------------
def draw_actor_parameter(actor, x, y, type, width = 120, bar = false)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
stat = 'atk'
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
stat = 'pdef'
when 2
parameter_name = $data_system.words.mdef
parameter_value = actor.mdef
stat = 'mdef'
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
stat = 'str'
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
stat = 'dex'
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
stat = 'agi'
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
stat = 'int'
when 7
parameter_name = 'Evasion'
parameter_value = actor.eva
stat = 'eva'
end
if bar == true && stat != 'eva'
draw_LegACy_bar(actor, x + 16, y + 21, stat, width - 16, 5)
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + width, y, 36, 32, parameter_value.to_s, 2)
end
end
HP/MP/ATB (Seph Slant)
Code:
#===========================================================================
# *** HP/MP/ATB/LimitBreak bar Slanted Style Compatible with RTAB ***
# *** Version 2.1
#---------------------------------------------------------------------------
# by Clive
# based on Cogwheel's Bars and Sephiroth Spawn's Slanted Bars.
#---------------------------------------------------------------------------
# ----- GREAT THANKS to DerVVulfman for solving the lag problem
#------This is a plug and play script so it should work without any problem!
#=============================================================================
# If using with Limit Break, must paste BELOW the Limit Break script as it re-
# writes the 'Gauge drawing' system. Will cause an error if not properly put.
# If used with Trickster's STEAL SCRIPT version 6 R1 (revision 1), then the
# height of RTAB's AT Bar (Draw Actor ATG) may not be smaller than 5 pixels
# due to a float-to-float error. A height of 6 pixels is the smallest.
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * 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
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#==========================================================================
# * 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
# Draws Bar
for i in 1..( (min.to_f / 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
#==========================================================================
alias :draw_actor_hp_hpsp :draw_actor_hp
def draw_actor_hp(actor, x, y, width = 156)
draw_slant_bar(x, y + 12, actor.hp, actor.maxhp, width, 6,
bar_color = Color.new(150, 0, 0, 255),
end_color = Color.new(255, 255, 60, 255))
draw_actor_hp_hpsp(actor, x, y, width)
end
#==========================================================================
# * Draw SP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#==========================================================================
alias :draw_actor_sp_hpsp :draw_actor_sp
def draw_actor_sp(actor, x, y, width = 156)
draw_slant_bar(x, y + 12, actor.sp, actor.maxsp, width, 6,
bar_color = Color.new(0, 0, 155, 255),
end_color = Color.new(255, 255, 255, 255))
draw_actor_sp_hpsp(actor, x, y, width)
end
#==========================================================================
# * Draw EXP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#==========================================================================
alias raz_bars_base_exp draw_actor_exp
def draw_actor_exp(actor, x, y)
if actor.level == 99
draw_slant_bar(x, y + 18, 1, 1, 190, 6, bar_color = Color.new(0, 100, 0, 255), end_color = Color.new(0, 255, 0, 255))
else
draw_slant_bar(x, y + 18, actor.now_exp, actor.next_exp, 190, 6, bar_color = Color.new(0, 100, 0, 255), end_color = Color.new(255, 255, 255, 255))
end
raz_bars_base_exp(actor, x, y)
end
#==========================================================================
# * Draw Parameter
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# type : parameter type (0-6)
#==========================================================================
alias raz_bars_base_parameter draw_actor_parameter
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, bar_color = para_color1,
end_color = para_color2)
raz_bars_base_parameter(actor, x, y, type)
end
#=========================================================================
# * Draw Actor ATG
# actor : Actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#=========================================================================
def draw_actor_atg(actor, x, y, width = 144, height = 6)
if @at_gauge == nil
# plus_x: revised x-coordinate
# rate_x: revised X-coordinate as (%)
# plus_y: revised y-coordinate
# plus_width: revised width
# rate_width: revised width as (%)
# height: Vertical width
# align1: Type 1 ( 0: left justify 1: center justify 2: right justify )
# align2: Type 2 ( 0: Upper stuffing 1: Central arranging 2:Lower stuffing )
# align3: Gauge type 0:Left justify 1: Right justify
@plus_x = 0
@rate_x = 0
@plus_y = 16
@plus_width = 0
@rate_width = 100
@width = @plus_width + width * @rate_width / 100
@height = 6
@align1 = 0
@align2 = 1
@align3 = 0
# Gradation settings: grade1: Empty gauge grade2:Actual gauge
# (0:On side gradation 1:Vertically gradation 2: Slantedly gradation)
grade1 = 1
grade2 = 0
# Color setting. color1: Outermost framework, color2: Medium framework
# color3: Empty framework dark color, color4: Empty framework light/write color
color1 = Color.new(0, 0, 0)
color2 = Color.new(255, 255, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(0, 0, 64, 192)
# Color setting of gauge
# Usually color setting of the time
color5 = Color.new(0, 64, 80)
color6 = Color.new(255, 255, 255)#(0, 128, 160)
# When gauge is MAX, color setting
color7 = Color.new(80, 0, 0)
color8 = Color.new(255, 255,255) #(240,0,0)
# Color setting at time of cooperation skill use
color9 = Color.new(80, 64, 32)
color10 = Color.new(255, 255, 255) #(240, 192, 96)
# Color setting at time of skill permanent residence
color11 = Color.new(80, 0, 64)
color12 = Color.new(255,255, 255) #(240, 0, 192)
# Drawing of gauge
gauge_rect_at(@width, @height, @align3, color1, color2, color3, color4,
color5, color6, color7, color8, color9, color10, color11, color12,
grade1, grade2)
end
# Variable at substituting the width of the gauge which is drawn
if actor.rtp == 0
at = (width + @plus_width) * actor.atp * @rate_width / 10000
else
at = (width + @plus_width) * actor.rt * @rate_width / actor.rtp / 100
end
# AT Width Check
if at > width
at = width
end
# Revision such as the left stuffing central posture of gauge
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
# Draw Border
for i in 0..height
self.contents.fill_rect(x + 1.5 + i, y + 12 + height - i, width - 2 , 3,
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 + 1.5 + i, y + 12 + height - i, width - 3, 3,
Color.new(r, b, g, a))
end
# Rect_X control
if @align3 == 0
rect_x = 0
else
x += @width - at - 1
rect_x = @width - at - 1
end
# Color setting of gauge
if at == width
#Gauge drawing at the time of MAX
for i in 0..height
self.contents.blt(x + i + @plus_x + @width * @rate_x / 100, y -i +
@plus_y, @at_gauge, Rect.new(rect_x, @height * 2, at, @height))
end
else
if actor.rtp == 0
for i in 0..height
# Usually gauge drawing of the time
self.contents.blt(x + i + @plus_x + @width * @rate_x / 100, y- i +
@plus_y, @at_gauge,Rect.new(rect_x, @height, at, @height))
end
else
if actor.spell == true
for i in 0..height
#Gauge drawing at time of cooperation skill use
self.contents.blt(x + i + @plus_x + @width * @rate_x / 100, y - i +
@plus_y, @at_gauge, Rect.new(rect_x, @height * 3, at, @height))
end
else
for i in 0..height
# Gauge drawing at time of skill permanent residence
self.contents.blt(x + i + @plus_x + @width * @rate_x / 100, y - i +
@plus_y, @at_gauge, Rect.new(rect_x, @height * 4, at, @height))
end
end
end
end
end
#=========================================================================
# * Draw Actor Limit Break Bar
# actor : Actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#=========================================================================
def draw_actor_lb(actor, x, y, width = 144)
rate = actor.limitbreak.to_f / LB_MAX
plus_x = 0
rate_x = 0
plus_y = 15
plus_width = 0
rate_width = 100
height = 7
lb = (width + plus_width) * actor.limitbreak * rate_width / 100 / LB_MAX
# Drawing of gauge
if actor.limitbreak == LB_MAX
# Draw Silver Blue Bar
draw_slant_bar(x + plus_x + width * rate_x / 100, y + plus_y, lb, width,
width, height, od_color1 = Color.new(0,80,200,192),
od_color2 = Color.new(255,255,255,192))
else
# Draw Green Bar
draw_slant_bar(x + plus_x + width * rate_x / 100, y + plus_y, lb, width,
width, height, od_color1 = Color.new(31, 128, 0, 128),
od_color2 = Color.new(255, 255, 191))
end
end
end
Enemy HP Bars
Code:
class Window_EnemyHP < Window_Base
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
@old_hp = []
refresh
end
def refresh
self.contents.clear
for i in 0...$game_troop.enemies.size
@enemy = $game_troop.enemies[i]
@old_hp[i] = @enemy.hp
unless @enemy.hp == 0
self.contents.font.size = 15
self.contents.font.bold = true
self.contents.font.color = Color.new(0,0,0)
self.contents.draw_text(1, i * 32 + 36, 100, 32, @enemy.name)
self.contents.draw_text(-1, i * 32 + 36, 100, 32, @enemy.name)
self.contents.draw_text(1, i * 32 + 38, 100, 32, @enemy.name)
self.contents.draw_text(-1, i * 32 + 38, 100, 32, @enemy.name)
self.contents.font.color = normal_color
self.contents.draw_text(0, i * 32 + 37, 100, 32, @enemy.name)
draw_slant_bar(0, i*32 + 60, @enemy.hp, @enemy.maxhp, 50)
end
end
end
def update
for i in 0...$game_troop.enemies.size
enemy = $game_troop.enemies[i]
if enemy.hp != @old_hp[i]
refresh
end
end
end
end
class Scene_Battle
alias raz_update_phase5 update_phase5
alias raz_update_phase4_step1 update_phase4_step1
alias raz_update_phase4_step5 update_phase4_step5
alias raz_enemy_hp_main main
def main
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
@enemy_window = Window_EnemyHP.new
@enemy_window.z = 95
raz_enemy_hp_main
@enemy_window.dispose
end
def update_phase5
# If wait count is larger than 0
if @phase5_wait_count > 0
# Decrease wait count
@phase5_wait_count -= 1
# If wait count reaches 0
if @phase5_wait_count == 0
@enemy_window.visible = false
# Show result window
@result_window.visible = true
# Clear main phase flag
$game_temp.battle_main_phase = false
# Refresh status window
@status_window.refresh
@enemy_window.refresh
end
return
end
raz_update_phase5
end
def update_phase4_step1
raz_update_phase4_step1
@enemy_window.refresh
end
def update_phase4_step5
# Hide help window
@help_window.visible = false
# Refresh status window
@status_window.refresh
@enemy_window.refresh
raz_update_phase4_step5
end
end