Code:
#===============================
# Window_BattleStatistics v 1.0
# by shadowball
# 02.06.2008
#===============================
class Window_BattleStatistics < Window_Base
def initialize
super(0, 320, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.z = 104
refresh
end
def refresh
self.contents.clear
self.contents.font.size = 21
self.contents.font.color = system_color
self.contents.draw_text(0, -8, 120, 32, 'Battles Won')
self.contents.draw_text(0, 14, 120, 32, 'Battles Lost')
self.contents.draw_text(0, 36, 120, 32, 'Escaped')
self.contents.font.size = 22
self.contents.font.color = normal_color
self.contents.draw_text(4, -8, 120, 32, $shb_win.to_s, 2)
self.contents.draw_text(4, 14, 120, 32, $shb_lose.to_s, 2)
self.contents.draw_text(4, 36, 120, 32, $shb_escape.to_s, 2)
end
end
#===============================
# * Scene_title Mini Add-on
#===============================
class Scene_Title
alias shb_cng command_new_game
def command_new_game
shb_cng
$shb_win = 0
$shb_lose = 0
$shb_escape = 0
end
end
#===============================
# * Scene_Menu Mini Add-on
#===============================
class Scene_Menu
alias shb_sm_main main
def main
@battle_stats = Window_BattleStatistics.new
shb_sm_main
@battle_stats.dispose
end
alias shb_sm_up update
def update
shb_sm_up
# Press Q or PageUp key to make the window appear / disappear
if Input.trigger?(Input::L)
if @battle_stats.visible
@battle_stats.visible = false
else
@battle_stats.visible = true
end
end
end
end
#================================
# Scene_Save Add-on
#================================
class Scene_Save
alias shb_write_save_data write_save_data
def write_save_data(file)
shb_write_save_data(file)
# You'll need to save these variables
Marshal.dump($shb_win, file)
Marshal.dump($shb_lose, file)
Marshal.dump($shb_escape, file)
end
end
#================================
# Scene_Load Mini Add-on
#================================
class Scene_Load
alias shb_read_save_data read_save_data
def read_save_data(file)
shb_read_save_data(file)
# You'll need to load these variables if you'd like to continue playing...
$shb_win = Marshal.load(file)
$shb_lose = Marshal.load(file)
$shb_escape = Marshal.load(file)
end
end
#===============================
# * Scene_Battle Mini Add-on
#===============================
class Scene_Battle
def battle_end(result)
# Clear in battle flag
$game_temp.in_battle = false
# Clear entire party actions flag
$game_party.clear_actions
# Remove battle states
for actor in $game_party.actors
actor.remove_states_battle
end
# Clear enemies
$game_troop.enemies.clear
# Call battle callback
if $game_temp.battle_proc != nil
$game_temp.battle_proc.call(result)
$game_temp.battle_proc = nil
end
case result
when 0 # win
$shb_win += 1
when 1 # escape
$shb_escape += 1
when 2 # lose
$shb_lose += 1
end
# Switch to map screen
$scene = Scene_Map.new
end
end