10-02-2009, 11:17 AM
No way, I forbid you to use the CTB without the exp bar!
No, I'm kidding, but try again, use this modified Window_BattleReport:
I have just tested it, and it works with the main menu script (I have added only the main menu script after the CTB and before main).
No, I'm kidding, but try again, use this modified Window_BattleReport:
Window_BattleReport
Code:
#==============================================================================
# ? Window_BattleReport
#------------------------------------------------------------------------------
#==============================================================================
class Window_BattleReport < Window_Selectable_Plus
#--------------------------------------------------------------------------
# ? Inizialization
#--------------------------------------------------------------------------
def initialize
super(32,64,320,320,BATTLE_REPORT_ROW_SIZE)
@actors=$game_party.actors+
(($game_party.backup_actors!=nil)?($game_party.backup_actors):([]))+
(($game_party.removed_actors!=nil)?($game_party.removed_actors):([]))+
(($game_party.transformed_actors!=nil)?($game_party.transformed_actors):([]))
for actor in @actors.clone
if $game_party.aeons_ids!=nil and $game_party.aeons_ids.include?(actor.id)
@actors.delete(actor)
end
end
@item_max = @actors.size
self.contents = Bitmap.new(width - 32, BATTLE_REPORT_ROW_SIZE*@item_max)
self.height=4*BATTLE_REPORT_ROW_SIZE+32
@need_update=true
@wait_count=20
self.opacity=BATTLE_REPORT_WINDOW_WINDOWSKIN_OPACITY
begin
self.windowskin = RPG::Cache.windowskin(BATTLE_REPORT_WINDOWSKIN_NAME)
rescue
if BATTLE_REPORT_WINDOWSKIN_NAME != ""
p BATTLE_REPORT_WINDOWSKIN_NAME+" not found."
end
end
refresh
end
#--------------------------------------------------------------------------
# ? Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.name = Font.default_name
self.contents.font.size = 14
@custom_normal_color=Color.new(STATUS_WINDOW_TEXT_RGB[0],
STATUS_WINDOW_TEXT_RGB[1],STATUS_WINDOW_TEXT_RGB[2])
@custom_normal_b_color=Color.new(STATUS_WINDOW_TEXT_B_RGB[0],
STATUS_WINDOW_TEXT_B_RGB[1],STATUS_WINDOW_TEXT_B_RGB[2])
@bg_sprites=[]
for i in 0...([4,@item_max].min)
x = 0
y = i * BATTLE_REPORT_ROW_SIZE
@bg_sprites[i] = Sprite.new
begin
@bg_sprites[i].bitmap = RPG::Cache.picture(BATTLE_REPORT_BG_PICTURE_NAME)
rescue
if BATTLE_REPORT_BG_PICTURE_NAME != nil
p BATTLE_REPORT_BG_PICTURE_NAME+" not found."
end
end
@bg_sprites[i].opacity = BATTLE_REPORT_BG_PICTURE_OPACITY
@bg_sprites[i].x = self.x + x + 16
@bg_sprites[i].y = self.y + y + 16
@bg_sprites[i].z = self.z
end
@bg=Sprite.new
begin
@bg.bitmap=RPG::Cache.picture(BATTLE_REPORT_BACKGROUND_NAME)
@bg.z = self.z-1
rescue
if BATTLE_REPORT_BACKGROUND_NAME != nil
p BATTLE_REPORT_BACKGROUND_NAME+" not found."
end
end
@bg.opacity=BATTLE_REPORT_BACKGROUND_OPACITY
for i in 0...@item_max
x = 0
y = i * BATTLE_REPORT_ROW_SIZE
actor = @actors[i]
tag=RPG::Cache.picture("border")
src_tag = Rect.new(0, 0, tag.width, tag.height)
dest = Rect.new(x+2, y+2, BATTLE_REPORT_ROW_SIZE-6, BATTLE_REPORT_ROW_SIZE-6)
self.contents.stretch_blt(dest, tag, src_tag)
draw_actor_face(actor, x+2, y+2, BATTLE_REPORT_ROW_SIZE-6)
self.contents.font.size = 20
self.contents.font.bold=true
self.contents.font.color = @custom_normal_color
self.contents.bg_color = @custom_normal_b_color
draw_actor_name_bordered_3_width(actor, x+6, y+BATTLE_REPORT_ROW_SIZE-self.contents.font.size-2, 76, self.contents.font.size)
x+=80
# EXP
self.contents.font.color=Color.new(200,200,255)
@exp_string_size = 32
self.contents.font.size = 14
bar=Bar.new(x+2,y+22,180,6,self.contents)
bar.back_opacity=200
bar.bar="bar_exp"
bar.bar_background="bar_exp_bg"
level=actor.get_level(actor.old_exp)
actor.old_level=level
if level==99
bar.highlight_complete=true
bar.refresh(100,100)
else
bar.refresh(actor.old_exp-actor.prev_exp(level),actor.next_exp2(level)-actor.prev_exp(level))
end
self.contents.draw_text(x+2,y+4,48,24,"EXP ")
self.contents.font.color=Color.new(230,230,230)
self.contents.draw_text(x+2+48,y+4,150-48,24,Integer(actor.old_exp).to_s,2)
# Level
@level_string_size = 32
@level_value_size = 32
self.contents.font.bold = true
self.contents.font.size = 16
fontsize=self.contents.font.size
self.contents.font.color=Color.new(255,166,27)
self.contents.draw_text_bordered_2(x+2, y+BATTLE_REPORT_ROW_SIZE/2+10, @level_string_size, fontsize, "Lv.", 0)
self.contents.font.size = 30
fontsize=self.contents.font.size
self.contents.draw_text_bordered_2(x+2 + @level_string_size, y+BATTLE_REPORT_ROW_SIZE/2, @level_value_size, fontsize, level.to_s, 0)
end
end
def update
if @wait_count > 0
@wait_count-=1
super
return
end
if @need_update
@need_update=false
self.contents.font.size = 14
for i in 0...@item_max
x = 80
y = i * BATTLE_REPORT_ROW_SIZE
self.contents.fill_rect(x, y+3, 200, 26, Color.new(0,0,0,0))
self.contents.fill_rect(x, y+BATTLE_REPORT_ROW_SIZE/2, 68, BATTLE_REPORT_ROW_SIZE/2, Color.new(0,0,0,0))
actor = @actors[i]
temp=actor.old_exp
actor.old_exp=(actor.old_exp)+(0.05*(actor.exp-actor.old_exp)).ceil
if temp!=actor.old_exp
@need_update=true
end
# EXP
self.contents.font.color=Color.new(200,200,255)
@exp_string_size = 32
self.contents.font.size = 14
bar=Bar.new(x+2,y+22,180,6,self.contents)
bar.back_opacity=200
bar.bar="bar_exp"
bar.bar_background="bar_exp_bg"
level=actor.get_level(actor.old_exp)
if level==99
bar.highlight_complete=true
bar.refresh(100,100)
else
bar.refresh(actor.old_exp-actor.prev_exp(level),actor.next_exp2(level)-actor.prev_exp(level))
end
self.contents.draw_text(x+2,y+4,48,24,"EXP ")
self.contents.font.color=Color.new(230,230,230)
self.contents.draw_text(x+2+48,y+4,150-48,24,Integer(actor.old_exp).to_s,2)
@level_string_size = 32
@level_value_size = 32
self.contents.font.bold = true
self.contents.font.size = 16
fontsize=self.contents.font.size
self.contents.font.color=Color.new(255,166,27)
self.contents.draw_text_bordered_2(x+2, y+BATTLE_REPORT_ROW_SIZE/2+10, @level_string_size, fontsize, "Lv.", 0)
self.contents.font.size = 30
fontsize=self.contents.font.size
self.contents.draw_text_bordered_2(x+2 + @level_string_size, y+BATTLE_REPORT_ROW_SIZE/2, @level_value_size, fontsize, level.to_s, 0)
if level!=actor.old_level
actor.old_level=level
Audio.se_play("Audio/SE/056-Right02", 100, 150)
self.contents.font.color=Color.new(50,200,0)
self.contents.draw_text_bordered_2(x+80, i * BATTLE_REPORT_ROW_SIZE + BATTLE_REPORT_ROW_SIZE/2+2, 100, fontsize, "LEVEL UP!", 0)
end
end
end
super
end
def dispose
super
for i in 0...([4,@item_max].min)
@bg_sprites[i].dispose
end
@bg.dispose
end
def visible=(value)
super
for i in 0...([4,@item_max].min)
@bg_sprites[i].visible=value
end
@bg.visible=value
end
end
class Game_Actor
attr_accessor :old_exp
attr_accessor :old_level
def get_level(exp)
for level in 1..99
if @exp_list[level]>exp
return level-1
end
end
return 99
end
# points from level n to level n+1
def next_exp2(level=nil)
if level==nil
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] : -1
else
return @exp_list[level+1] > 0 ? @exp_list[level+1] : -1
end
end
def prev_exp(level=nil)
if level==nil
return @exp_list[@level]
else
return @exp_list[level]
end
end
end
#==============================================================================
# ** Window_BattleResult
#------------------------------------------------------------------------------
# This window displays amount of gold and EXP acquired at the end of a battle.
#==============================================================================
class Window_BattleResult < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# exp : EXP
# gold : amount of gold
# treasures : treasures
#--------------------------------------------------------------------------
def initialize(exp, gold, treasures)
@exp = exp
@gold = gold
@treasures = treasures
super(368,64+16,240,@treasures.size * 32 + 64)
self.contents = Bitmap.new(width - 32, height - 32)
#self.y = 160 - height / 2
#self.back_opacity = 160
#self.visible = false
begin
self.windowskin = RPG::Cache.windowskin(BATTLE_REPORT_WINDOWSKIN_NAME)
rescue
if BATTLE_REPORT_WINDOWSKIN_NAME != ""
p BATTLE_REPORT_WINDOWSKIN_NAME+" not found."
end
end
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
x = 4
self.contents.font.color = normal_color
cx = contents.text_size(@exp.to_s).width
self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
x += cx + 4
self.contents.font.color = system_color
cx = contents.text_size("EXP").width
self.contents.draw_text(x, 0, 64, 32, "EXP")
x += cx + 16
self.contents.font.color = normal_color
cx = contents.text_size(@gold.to_s).width
self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
x += cx + 4
self.contents.font.color = system_color
self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
y = 32
for item in @treasures
draw_item_name(item, 4, y)
y += 32
end
end
end
I have just tested it, and it works with the main menu script (I have added only the main menu script after the CTB and before main).