#######################
# Battle Count Window #
#######################
# Version 0.0.1 #
##########################
# aWhiteRaven / Newbcake #
################################################################################
# This is my first script. I learned from just looking at the smaller scripts.
# It's not perfect as it doesnt factor in anything such as existing windows.
# At least I do not think it does.
################################################################################
# Instructions (if needed):
# Put above (Main) and under (Materials)
################################################################################
# Credits: Adrien
# Basically his script was the easiest to understand
################################################################################
#--------------------------------------------------------------------------
# Start Customizable Section
#--------------------------------------------------------------------------
module WindowBattleCount
# Set to use either an icon or not. Default is true. If false, it will print
# the text specified by BC.
USE_ICON = true
# This is the string you want to appear IF you specify that want one.
BC = "Battles"
# What icon to use
ICON = 1
end
#--------------------------------------------------------------------------
# End Customizable Section
#--------------------------------------------------------------------------
class BC_Window < Window_Base
#--------------------------------------------------------------------------
# Initialize the window.
# super(x,y,width,height)
# This sets it at the left/right above any other windows.
# Width of 160, and a height of 1 row.
#-------------------------------------------------------------------------
def initialize
super(0,0,160,fitting_height(1))
refresh
end
#-------------------------------------------------------------------------
# Clears anything in the window "cache"
# Uses the inherited draw_currency_value method to draw the number, the
# unit (user specified as icon or text) at x, y, and a width.
#
# draw_curreny_value(value, unit, x, y, width)
#-------------------------------------------------------------------------
def refresh
contents.clear
draw_currency_value(battles, iconText, 0, 0, contents.width - 2)
end
#-------------------------------------------------------------------------
# Defines value as the battle count.
#-------------------------------------------------------------------------
def battles
$game_system.battle_count
end
#-------------------------------------------------------------------------
# Draws the unit/icon for battles.
#-------------------------------------------------------------------------
def iconText
if WindowBattleCount::USE_ICON == true
draw_icon(WindowBattleCount::ICON,0,0)
else
draw_text_ex(0,0,WindowBattleCount::BC)
end
end
end
#--------------------------------------------------------------------------
# Alias the original start method and then add in the battle count window
#--------------------------------------------------------------------------
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# Alias: start method.
#--------------------------------------------------------------------------
alias start_original start
def start
start_original
create_bc_window
end
#--------------------------------------------------------------------------
# Create the window.
#--------------------------------------------------------------------------
def create_bc_window
@bc_window = BC_Window.new
@bc_window.x = 0
@bc_window.y = (Graphics.height - @bc_window.height) - 98
end
end