Hi guys, I have a problem with a part of the script of my battle system.
I use CCOA 4.3 EX, until yesterday worked fine, today I take a test and when I start a battle I always get the following error:
This is the part of the script where the error occurs ...
#==============================================================================
# ADD-ON - LAYOUT
#==============================================================================
# By Moghunter
#==============================================================================
class React < Window_Base
attr_reader :index
attr_reader :help_window
def initialize(x, y, width, height)
super(x, y, width, height)
@item_max = 1
@row_max = 1
@index = -1
end
def index=(index)
@index = index
refresh
if self.active and @help_window != nil
update_help
end
update_cursor_rect
end
def row_max
return (@item_max + @column_max - 1) / @column_max
end
def top_row
return self.oy / 32
end
def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 32
end
def page_row_max
return (self.height - 32) / 32
end
def page_item_max
return page_row_max * @column_max
end
def help_window=(help_window)
@help_window = help_window
if self.active and @help_window != nil
update_help
end
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
cursor_width = 0
x = @index / @column_max * 48 - self.oy
y = 110 + @index % @column_max * (cursor_width + 100)
self.cursor_rect.set(x, y, cursor_width, 32)
t = @index / @column_max * 28 - self.oy
end
def update
super
if self.active and @item_max > 0 and @index >= 0
if Input.repeat?(Input::C) or Input.repeat?(Input::B)
refresh
end
if Input.repeat?(Input::RIGHT)
if (@column_max == 1 and Input.trigger?(Input::RIGHT)) or
@index < @item_max - @row_max
$game_system.se_play($data_system.cursor_se)
@index = (@index + @row_max) % @item_max
refresh
end
end
if Input.repeat?(Input::LEFT)
if (@column_max == 1 and Input.trigger?(Input::LEFT)) or
@index >= @row_max
$game_system.se_play($data_system.cursor_se)
@index = (@index - @row_max + @item_max) % @item_max
refresh
end
end
if Input.repeat?(Input::RIGHT)
if @column_max >= 2 and @index < @item_max - 1
$game_system.se_play($data_system.cursor_se)
@index += 1
refresh
end
end
if Input.repeat?(Input::LEFT)
if @column_max >= 2 and @index > 0
$game_system.se_play($data_system.cursor_se)
@index -= 1
refresh
end
end
if Input.repeat?(Input::R)
if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
$game_system.se_play($data_system.cursor_se)
@index = [@index + self.page_item_max, @item_max - 1].min
refresh
self.top_row += self.page_row_max
end
end
if Input.repeat?(Input::L)
if self.top_row > 0
$game_system.se_play($data_system.cursor_se)
@index = [@index - self.page_item_max, 0].max
refresh
self.top_row -= self.page_row_max
end
end
end
if self.active and @help_window != nil
update_help
end
update_cursor_rect
end
end
class Window_Base < Window
def draw_face(actor,x,y)
face = RPG::Cache.picture(actor.name + "_face")
cw = face.width
ch = face.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, face, src_rect)
end
def draw_face2(actor,x,y)
face = RPG::Cache.picture(actor.name + "_face2")
cw = face.width
ch = face.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, face, src_rect)
end
def draw_lay(actor,x,y)
layout = RPG::Cache.picture(actor.name + "_lay")
cw = layout.width
ch = layout.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, layout, src_rect)
end
def draw_hp(actor, x, y, width = 144)
back = RPG::Cache.picture("BAR0")
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, back, src_rect)
meter = RPG::Cache.picture("HP_BAR")
cw = meter.width * actor.hp / actor.maxhp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
text = RPG::Cache.picture("HP_T")
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 60, y - ch + 15, text, src_rect)
self.contents.font.color = system_color
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
self.contents.font.color = Color.new(250,255,255,255)
self.contents.draw_text(hp_x + 20, y - 8, 48, 32, actor.hp.to_s, 2)
end
def draw_hp2(actor, x, y, width = 144)
back = RPG::Cache.picture("BAR0")
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 25, back, src_rect)
meter = RPG::Cache.picture("HP_BAR")
cw = meter.width * actor.hp / actor.maxhp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 25, meter, src_rect)
text = RPG::Cache.picture("HP_T")
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 33, y - ch + 20, text, src_rect)
self.contents.font.color = system_color
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
self.contents.font.color = Color.new(250,255,255,255)
self.contents.sfont = SFont.new("Arial_Battle")
self.contents.draw_text(hp_x - 21, y - 4, 12, 32, "HP", 1)
self.contents.draw_text(hp_x - 33, y - 4, 48, 32, actor.hp.to_s, 2)
self.contents.font.color = normal_color
self.contents.sfont = SFont.new("Arial_Battle")
self.contents.draw_text(hp_x + 15, y - 4, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 27, y - 4, 48, 32, actor.maxhp.to_s)
end
def draw_sp(actor, x, y, width = 144)
back = RPG::Cache.picture("BAR0")
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, back, src_rect)
meter = RPG::Cache.picture("SP_BAR")
cw = meter.width * actor.sp / actor.maxsp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
text = RPG::Cache.picture("SP_T")
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 60, y - ch + 15, text, src_rect)
self.contents.font.color = system_color
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
self.contents.font.color = Color.new(250,255,255,255)
self.contents.draw_text(sp_x + 20, y - 8, 48, 32, actor.sp.to_s, 2)
end
def draw_sp2(actor, x, y, width = 144)
back = RPG::Cache.picture("BAR0")
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 25, back, src_rect)
meter = RPG::Cache.picture("SP_BAR")
cw = meter.width * actor.sp / actor.maxsp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 25, meter, src_rect)
text = RPG::Cache.picture("SP_T")
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 33, y - ch + 20, text, src_rect)
self.contents.font.color = system_color
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
self.contents.font.color = Color.new(250,255,255,255)
self.contents.sfont = SFont.new("Arial_Battle")
self.contents.draw_text(sp_x - 48, y - 4, 12, 32, "EP", 1)
self.contents.draw_text(sp_x - 60, y - 4, 48, 32, actor.sp.to_s, 2)
self.contents.font.color = normal_color
self.contents.sfont = SFont.new("Arial_Battle")
self.contents.draw_text(sp_x - 12, y - 4, 12, 32, "/", 1)
self.contents.draw_text(sp_x, y - 4, 48, 32, actor.maxsp.to_s)
end
def draw_name(actor, x, y)
self.contents.font.color = Color.new(238,46,218,255)
self.contents.sfont = SFont.new("Arial_Battle")
self.contents.draw_text(x , y, 100, 40, actor.name,15) #self.contents.draw_text(x , y, 70, 40, actor.name,1)
end
def draw_commando(x,y)
com = RPG::Cache.picture("commando")
cw = com.width
ch = com.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, com, src_rect)
end
def draw_level(actor, x, y)
self.contents.font.color = Color.new(238,46,218,255)
self.contents.draw_text(x + 32, y, 20, 20, actor.level.to_s, 1)
end
def draw_com(actor, x, y)
action = RPG::Cache.picture(actor.name + "_com")
cw = action.width
ch = action.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, action, src_rect)
end
end
def draw_select(x,y)
com = RPG::Cache.picture("select")
cw = com.width
ch = com.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, com, src_rect)
end
, but I have not changed anything about it ... what can it be?