#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#
# Pokemon Menu v2.00
#
# By Ryex
#
#==============================================================================
#
# Features:
# * Map as background
# * Pokemon style menu with Actor menu
# * No Equip
# * Skill Screen is used from the actor menu
# * modified status screen
# * gradient Bars that change color based on hp
#
#==============================================================================
#
# Instructions:
# Make a new script and place above main.
#
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
# This window deals with general command choices.
#==============================================================================
class Window_Command_pokemon < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# width : window width
# commands : command text string array
#--------------------------------------------------------------------------
def initialize(commands, type)
# Compute window height from command quantity
if type == 0
super(480, 0, 160, commands.size * 32 + 32)
elsif type == 1
super(240, 176, 160, commands.size * 32 + 32)
end
self.z = 200
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 32)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text color
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make Map background
@map = Spriteset_Map.new
# Make command window
s1 = $data_system.words.item
s2 = "Pokèmon"
s3 = "Save"
s4 = "End Game"
@command_window = Window_Command_pokemon.new([s1, s2, s3, s4], 0)
@command_window.index = @menu_index
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(2)
end
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@command_window.dispose
@map.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@command_window.update
@map.update
# If command window is active: call update_command
if @command_window.active
update_command
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If command other than save or end game, and party members = 0
if $game_party.actors.size == 0 and @command_window.index < 4
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Branch by command window cursor position
case @command_window.index
when 0 # item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to item screen
$scene = Scene_Item.new
when 1 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
$scene = Scene_Status.new
when 2 # save
# If saving is forbidden
if $game_system.save_disabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to save screen
$scene = Scene_Save.new
when 3 # end game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to end game screen
$scene = Scene_End.new
end
return
end
end
end
class Window_Base < Window
#----------------------------------------------------------------------------
# x: x
# y: y
# m: max width
# a: actor
#----------------------------------------------------------------------------
def draw_actor_hp_bar_ryex(x, y, m, actor)
gray = Color.new(100, 100, 100)
h = 10
p = actor.hp.to_f / actor.maxhp
for i in 0...(h - 2)
self.contents.fill_rect(x + (h - i - 1), y + i, m - h, 1, Color.new(0, 0, 0))
end
for i in 0...(h - 2)
ty = y + (h - 2) - (i + 1)
gr = gray.red * i / (h - 2)
gg = gray.green * i / (h - 2)
gb = gray.blue * i / (h - 2)
self.contents.fill_rect(x + (h + i - 1) - 6, ty, m - h - 2, 1, Color.new(gr, gg, gb, 192))
end
if p > 0.5
c = Color.new(0, 255, 0)
elsif p < 0.1
c = Color.new(255, 0, 0)
elsif p < 0.5
c = Color.new(255, 100, 0)
end
for i in 0...(h - 2)
r = c.red * i / (h - 2)
g = c.green * i / (h - 2)
b = c.blue * i / (h - 2)
self.contents.fill_rect(x + (h - i - 1), y + i, p * (m - h - 2), 1, Color.new(r, g, b))
end
end
def draw_actor_sp_bar_ryex(x, y, m, actor)
gray = Color.new(100, 100, 100)
h = 10
p = actor.sp.to_f / actor.maxsp
for i in 0...(h - 2)
self.contents.fill_rect(x + (h - i - 1), y + i, m - h, 1, Color.new(0, 0, 0))
end
for i in 0...(h - 2)
ty = y + (h - 2) - (i + 1)
gr = gray.red * i / (h - 2)
gg = gray.green * i / (h - 2)
gb = gray.blue * i / (h - 2)
self.contents.fill_rect(x + (h + i - 1) - 6, ty, m - h - 2, 1, Color.new(gr, gg, gb, 192))
end
c = Color.new(0, 0, 255)
for i in 0...(h - 2)
r = c.red * i / (h - 2)
g = c.green * i / (h - 2)
b = c.blue * i / (h - 2)
self.contents.fill_rect(x + (h - i - 1), y + i, p * (m - h - 2), 1, Color.new(r, g, b))
end
end
def draw_actor_exp_bar_ryex(x, y, m, actor)
gray = Color.new(100, 100, 100)
h = 10
p = actor.exp.to_f / actor.next_exp_s.to_i
for i in 0...(h - 2)
self.contents.fill_rect(x + (h - i - 1), y + i, m - h, 1, Color.new(0, 0, 0))
end
for i in 0...(h - 2)
ty = y + (h - 2) - (i + 1)
gr = gray.red * i / (h - 2)
gg = gray.green * i / (h - 2)
gb = gray.blue * i / (h - 2)
self.contents.fill_rect(x + (h + i - 1) - 6, ty, m - h - 2, 1, Color.new(gr, gg, gb, 192))
end
c = Color.new(255, 255, 0)
for i in 0...(h - 2)
r = c.red * i / (h - 2)
g = c.green * i / (h - 2)
b = c.blue * i / (h - 2)
self.contents.fill_rect(x + (h - i - 1), y + i, p * (m - h - 2), 1, Color.new(r, g, b))
end
end
end
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 64
y = i * 76
actor = $game_party.actors[i]
draw_actor_graphic(actor, x - 40, y + 64 )
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 200, y)
draw_actor_level(actor, x + 400, y)
draw_actor_state(actor, x + 100, y )
draw_actor_exp_bar_ryex(x + 400, y + 45, 120, actor)
draw_actor_hp_bar_ryex(x + 10, y + 45, 120, actor)
draw_actor_hp(actor, x, y + 34)
draw_actor_sp_bar_ryex(x + 200, y + 45, 120, actor)
draw_actor_sp(actor, x + 200, y + 34)
end
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 76, self.width - 32, 80)
end
end
end
class Window_stats_Pokemon < Window_Selectable
def initialize(actor_index = nil)
super(208, 48, 224, 384)
self.contents = Bitmap.new(width - 32, height - 32)
if actor_index != nil
@actor = $game_party.actors[actor_index]
else
@actor = nil
end
refresh
self.active = false
self.z = 99
end
def refresh
self.contents.clear
if @actor != nil
draw_actor_name(@actor, 0, 0)
draw_actor_class(@actor, 0, 32)
draw_actor_parameter(@actor, 0, 128, 0)
draw_actor_parameter(@actor, 0, 160, 1)
draw_actor_parameter(@actor, 0, 192, 2)
draw_actor_parameter(@actor, 0, 224, 3)
draw_actor_parameter(@actor, 0, 256, 4)
draw_actor_parameter(@actor, 0, 288, 5)
draw_actor_parameter(@actor, 0, 320, 6)
end
end
end
#==============================================================================
# ** Scene_Status
#------------------------------------------------------------------------------
# This class performs status screen processing.
#==============================================================================
class Scene_Status
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
#make Command Window
s1 = "Stats"
s2 = "Skill"
@command_window = Window_Command_pokemon.new([s1, s2], 1)
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
end
# Make status window
@status_window = Window_MenuStatus.new
@stat_window = Window_stats_Pokemon.new
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@command_window.dispose
@status_window.dispose
@stat_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@command_window.update
@status_window.update
@stat_window.update
# If command window is active: call update_command
if @command_window.active
update_command
return
end
# If status window is active: call update_status
if @status_window.active
update_status
return
end
if @stat_window.active
update_stat
return
end
end
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Menu.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If command other than save or end game, and party members = 0
if $game_party.actors.size == 0 and @command_window.index < 4
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Branch by command window cursor position
case @command_window.index
when 0 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@command_window.z = 50
@status_window.active = true
@status_window.index = 0
when 1 # skill
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@command_window.z = 50
@status_window.active = true
@status_window.index = 0
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when status window is active)
#--------------------------------------------------------------------------
def update_status
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Make command window active
@command_window.active = true
@command_window.z = 200
@status_window.active = false
@status_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to status screen
@status_window.active = false
@stat_window.dispose
@stat_window = Window_stats_Pokemon.new(@status_window.index)
@stat_window.active = true
@stat_window.z = 200
when 1 # skill
# If this actor's action limit is 2 or more
if $game_party.actors[@status_window.index].restriction >= 2
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to skill screen
$scene = Scene_Skill.new(@status_window.index)
end
return
end
end
def update_stat
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Make command window active
@status_window.active = true
@stat_window.dispose
@stat_window = Window_stats_Pokemon.new
@stat_window.z = 50
@stat_window.active = false
return
end
end
end
#==============================================================================
# ** Window_Target
#------------------------------------------------------------------------------
# This window selects a use target for the actor on item and skill screens.
#==============================================================================
class Window_Target < Window_Selectable
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...$game_party.actors.size
x = 4
y = i * 116
actor = $game_party.actors[i]
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 144, y)
draw_actor_level(actor, x + 8, y + 32)
draw_actor_state(actor, x + 8, y + 64)
draw_actor_hp_bar_ryex(x + 152, y + 44, 120, actor)
draw_actor_hp(actor, x + 152, y + 32)
draw_actor_sp_bar_ryex(x + 152, y + 76, 120, actor)
draw_actor_sp(actor, x + 152, y + 64)
end
end
end
#==============================================================================
# ** Window_SkillStatus
#------------------------------------------------------------------------------
# This window displays the skill user's status on the skill screen.
#==============================================================================
class Window_SkillStatus < Window_Base
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_state(@actor, 140, 0)
draw_actor_hp_bar_ryex(284, 12, 120, @actor)
draw_actor_hp(@actor, 284, 0)
draw_actor_sp_bar_ryex(460, 12, 120, @actor)
draw_actor_sp(@actor, 460, 0)
end
end
#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
# This class performs skill screen processing.
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# * Frame Update (if skill window is active)
#--------------------------------------------------------------------------
def update_skill
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Status.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the skill window
@skill = @skill_window.skill
# If unable to use
if @skill == nil or not @actor.skill_can_use?(@skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# If effect scope is ally
if @skill.scope >= 3
# Activate target window
@skill_window.active = false
@target_window.x = (@skill_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
# Set cursor position to effect scope (single / all)
if @skill.scope == 4 || @skill.scope == 6
@target_window.index = -1
elsif @skill.scope == 7
@target_window.index = @actor_index - 10
else
@target_window.index = 0
end
# If effect scope is other than ally
else
# If common event ID is valid
if @skill.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = @skill.common_event_id
# Play use skill SE
$game_system.se_play(@skill.menu_se)
# Use up SP
@actor.sp -= @skill.sp_cost
# Remake each window content
@status_window.refresh
@skill_window.refresh
@target_window.refresh
# Switch to map screen
$scene = Scene_Map.new
return
end
end
return
end
# If R button was pressed
if Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To next actor
@actor_index += 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_Skill.new(@actor_index)
return
end
# If L button was pressed
if Input.trigger?(Input::L)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To previous actor
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_Skill.new(@actor_index)
return
end
end
end
#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
# This class performs save screen processing.
#==============================================================================
class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# * Decision Processing
#--------------------------------------------------------------------------
def on_decision(filename)
# Play save SE
$game_system.se_play($data_system.save_se)
# Write save data
file = File.open(filename, "wb")
write_save_data(file)
file.close
# If called from event
if $game_temp.save_calling
# Clear save call flag
$game_temp.save_calling = false
# Switch to map screen
$scene = Scene_Map.new
return
end
# Switch to menu screen
$scene = Scene_Menu.new(1)
end
#--------------------------------------------------------------------------
# * Cancel Processing
#--------------------------------------------------------------------------
def on_cancel
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# If called from event
if $game_temp.save_calling
# Clear save call flag
$game_temp.save_calling = false
# Switch to map screen
$scene = Scene_Map.new
return
end
# Switch to menu screen
$scene = Scene_Menu.new(1)
end
end
#==============================================================================
# ** Scene_End
#------------------------------------------------------------------------------
# This class performs game end screen processing.
#==============================================================================
class Scene_End
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update command window
@command_window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(0)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # to title
command_to_title
when 1 # shutdown
command_shutdown
when 2 # quit
command_cancel
end
return
end
end
#--------------------------------------------------------------------------
# * Process When Choosing [Cancel] Command
#--------------------------------------------------------------------------
def command_cancel
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to menu screen
$scene = Scene_Menu.new(0)
end
end