Code:
#==============================================================================
# ** Large Party
#------------------------------------------------------------------------------
# © Dargor, 2008
# 11/05/08
# Version 1.3
#------------------------------------------------------------------------------
# VERSION HISTORY:
# - 1.0 (08/03/08), Initial release
# - 1.1 (15/03/08), Added party arrange support
# - 1.2 (15/03/08), Battle Status bug fixed with Party Changer
# - 1.3 (11/05/08), Bug fixed with the add_actor method
#------------------------------------------------------------------------------
# INSTRUCTIONS:
# 1) To change the maximum # of actors allowed in the party, use:
# - $game_party.max_members = x
#==============================================================================
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles the party. It includes information on amount of gold
# and items. The instance of this class is referenced by $game_party.
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :max_members # Maximum number of party members
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias dargor_vx_large_party_initialize initialize
alias dargor_vx_large_party_add_actor add_actor
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
dargor_vx_large_party_initialize
@max_members = 6 # Maximum number of party members
end
#--------------------------------------------------------------------------
# * Add an Actor
# actor_id : actor ID
#--------------------------------------------------------------------------
def add_actor(actor_id)
if self.methods.include?('add_reserve_actor')
add_reserve_actor(actor_id)
end
if @actors.size < @max_members
dargor_vx_large_party_add_actor(actor_id)
end
end
end
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias dargor_large_party_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y)
@selection_rect = false
@selection_y = 0
dargor_large_party_initialize(x, y)
height = 416 + (96 * ($game_party.members.size-4))
self.contents = Bitmap.new(width - 32, height - 32)
self.height = 416
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @selection_rect
color = Color.new(0,0,0,160)
self.contents.fill_rect(2, @selection_y, contents.width-4, 92, color)
end
@item_max = $game_party.members.size
for actor in $game_party.members
draw_actor_face(actor, 2, actor.index * 96 + 2, 92)
x = 104
y = actor.index * 96 + WLH / 2
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 120, y)
draw_actor_level(actor, x, y + WLH * 1)
draw_actor_state(actor, x, y + WLH * 2)
draw_actor_hp(actor, x + 120, y + WLH * 1)
draw_actor_mp(actor, x + 120, y + WLH * 2)
end
end
#--------------------------------------------------------------------------
# * Set Selection Rect
#--------------------------------------------------------------------------
def set_selection_rect(index)
@selection_rect = true
@selection_y = index * 96 - WLH / 2 + 14
refresh
end
#--------------------------------------------------------------------------
# * Clear Selection Rect
#--------------------------------------------------------------------------
def clear_selection_rect
@selection_rect = false
refresh
end
#--------------------------------------------------------------------------
# * Update cursor
#--------------------------------------------------------------------------
alias dargor_large_party_update_cursor update_cursor
def update_cursor
#dargor_large_party_update_cursor
if @index < 0
self.cursor_rect.empty
return
end
# Get top row
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
# Reset Top Row if at bottom of list
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
y = @index / @column_max * 96 - self.oy
# Draw the cursor
self.cursor_rect.set(0, y, contents.width, 96)
end
#--------------------------------------------------------------------------
# * Get Top Row
#--------------------------------------------------------------------------
def top_row
return self.oy / 96
end
#--------------------------------------------------------------------------
# * Set Top Row
# row : row shown on top
#--------------------------------------------------------------------------
def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 96
end
#--------------------------------------------------------------------------
# * Get Number of Rows Displayable on 1 Page
#--------------------------------------------------------------------------
def page_row_max
return 4
end
end
#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
# This window displays the status of all party members on the battle screen.
#==============================================================================
class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias dargor_large_party_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
dargor_large_party_initialize
height = 128 + (24 * ($game_party.members.size-4))
self.contents = Bitmap.new(width - 32, height - 32)
self.height = 128
refresh
end
#--------------------------------------------------------------------------
# * Update cursor
#--------------------------------------------------------------------------
def update_cursor
if @index < 0
self.cursor_rect.empty
return
end
# Get top row
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
# Reset Top Row if at bottom of list
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
y = @index / @column_max * 24 - self.oy
# Draw the cursor
self.cursor_rect.set(0, y, contents.width, 24)
end
#--------------------------------------------------------------------------
# * Get Top Row
#--------------------------------------------------------------------------
def top_row
return self.oy / 24
end
#--------------------------------------------------------------------------
# * Set Top Row
# row : row shown on top
#--------------------------------------------------------------------------
def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 24
end
#--------------------------------------------------------------------------
# * Get Number of Rows Displayable on 1 Page
#--------------------------------------------------------------------------
def page_row_max
return 4
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Update Party Command Selection
#--------------------------------------------------------------------------
alias dargor_large_party_update_party_command_selection update_party_command_selection
def update_party_command_selection
if Input.trigger?(Input::L)
@status_window.oy = [@status_window.oy -= 24, 0].max
end
if Input.trigger?(Input::R)
@status_window.oy = [@status_window.oy += 24, ($game_party.members.size-4) * 24].min
end
dargor_large_party_update_party_command_selection
end
end