Vocab::PartyOrder = 'Order'
module Custom_Commands
# Maximum number of commands visible at the same time in the
# command windows
Menu_Item_Max = 8
end
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles system-related data. Also manages vehicles and BGM, etc.
# The instance of this class is referenced by $game_system.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :menu_commands
attr_accessor :disabled_menu_commands
attr_accessor :menu_party_order
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias dargor_vx_cmc_system_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
dargor_vx_cmc_system_initialize
@menu_party_order = true
@disabled_menu_commands = {}
s1 = Vocab::item
s2 = Vocab::skill
s3 = Vocab::equip
s4 = Vocab::status
s5 = Vocab::save
s6 = Vocab::game_end
@menu_commands = []
add_menu_command(0,[s1, s2, s3, s4, s5, s6])
index = @menu_commands.index(Vocab::save)
add_menu_command(index, Vocab::PartyOrder) if @menu_party_order
end
#--------------------------------------------------------------------------
# * Add Menu Command
#--------------------------------------------------------------------------
def add_menu_command(index, command)
return if @menu_commands.include?(command)
if command.is_a?(String)
@menu_commands.insert(index, command)
@disabled_menu_commands[command] = false
elsif command.is_a?(Array)
for i in 0...command.size
@menu_commands.insert(index+i, command[i])
@disabled_menu_commands[command[i]] = false
end
end
end
#--------------------------------------------------------------------------
# * Remove Menu Command
#--------------------------------------------------------------------------
def remove_menu_command(command)
if command.is_a?(String)
@menu_commands.delete(command)
elsif command.is_a?(Array)
for i in command
@menu_commands.delete(i)
end
end
end
#--------------------------------------------------------------------------
# * Add Menu Command
#--------------------------------------------------------------------------
def enable_menu_command(command)
@disabled_menu_commands[command] = false
end
#--------------------------------------------------------------------------
# * Add Menu Command
#--------------------------------------------------------------------------
def disable_menu_command(command)
@disabled_menu_commands[command] = true
end
#--------------------------------------------------------------------------
# * Add Menu Command
#--------------------------------------------------------------------------
def menu_command_disabled?(command)
return @disabled_menu_commands[command]
end
end
#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
# This window deals with general command choices.
#==============================================================================
class Window_Command < Window_Selectable
alias dargor_vx_cmc_window_command_draw_item draw_item
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# enabled : enabled flag. When false, draw semi-transparently.
#--------------------------------------------------------------------------
def draw_item(index, enabled = true)
return if index.nil?
dargor_vx_cmc_window_command_draw_item(index, enabled)
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_Command.new(160, $game_system.menu_commands)
@command_window.index = @menu_index
@command_window.height = 8 + Custom_Commands::Menu_Item_Max * 24
if $game_party.members.size == 0 # If number of party members is 0
index = $game_system.menu_commands.index(Vocab::item)
@command_window.draw_item(index, false) # Disable item
index = $game_system.menu_commands.index(Vocab::skill)
@command_window.draw_item(index, false) # Disable skill
index = $game_system.menu_commands.index(Vocab::equip)
@command_window.draw_item(index, false) # Disable equipment
index = $game_system.menu_commands.index(Vocab::status)
@command_window.draw_item(index, false) # Disable status
end
if $game_system.save_disabled # If save is forbidden
index = $game_system.menu_commands.index(Vocab::save)
@command_window.draw_item(index, false) # Disable save
end
for command in $game_system.menu_commands
index = $game_system.menu_commands.index(command)
if $game_system.menu_command_disabled?(command)
@command_window.draw_item(index, false) # Disable command
end
end
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_command_selection
command = @command_window.selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.members.size == 0 and (command == Vocab::item or
command == Vocab::skill or
command == Vocab::equip or
command == Vocab::status)
Sound.play_buzzer
return
elsif $game_system.save_disabled and command == Vocab::save
Sound.play_buzzer
return
elsif $game_system.menu_command_disabled?(command)
Sound.play_buzzer
return
end
Sound.play_decision
case command
when Vocab::item
$scene = Scene_Item.new
when Vocab::skill,Vocab::equip,Vocab::status
start_actor_selection
when Vocab::save # Save
$scene = Scene_File.new(true, false, false)
when Vocab::game_end
$scene = Scene_End.new
end
end
end
#--------------------------------------------------------------------------
# * Update Actor Selection
#--------------------------------------------------------------------------
def update_actor_selection
if Input.trigger?(Input::B)
Sound.play_cancel
end_actor_selection
elsif Input.trigger?(Input::C)
$game_party.last_actor_index = @status_window.index
Sound.play_decision
case @command_window.selection
when Vocab::skill # skill
$scene = Scene_Skill.new(@status_window.index)
when Vocab::equip # equipment
$scene = Scene_Equip.new(@status_window.index)
when Vocab::status # status
$scene = Scene_Status.new(@status_window.index)
end
end
end
end
#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
# This class performs the item screen processing.
#==============================================================================
class Scene_Item < Scene_Base
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
def return_scene
index = $game_system.menu_commands.index(Vocab::item)
$scene = Scene_Menu.new(index)
end
end
#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
# This class performs the skill screen processing.
#==============================================================================
class Scene_Skill < Scene_Base
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
def return_scene
index = $game_system.menu_commands.index(Vocab::skill)
$scene = Scene_Menu.new(index)
end
end
#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs the equipment screen processing.
#==============================================================================
class Scene_Equip < Scene_Base
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
def return_scene
index = $game_system.menu_commands.index(Vocab::equip)
$scene = Scene_Menu.new(index)
end
end
#==============================================================================
# ** Scene_Status
#------------------------------------------------------------------------------
# This class performs the status screen processing.
#==============================================================================
class Scene_Status < Scene_Base
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
def return_scene
index = $game_system.menu_commands.index(Vocab::status)
$scene = Scene_Menu.new(index)
end
end
#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
# This class performs the save and load screen processing.
#==============================================================================
class Scene_File < Scene_Base
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
alias dargor_vx_custom_commands_return_scene return_scene
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
def return_scene
if !@from_title && !@from_event
index = $game_system.menu_commands.index(Vocab::save)
$scene = Scene_Menu.new(index)
else
dargor_vx_custom_commands_return_scene
end
end
end
#==============================================================================
# ** Scene_End
#------------------------------------------------------------------------------
# This class performs game end screen processing.
#==============================================================================
class Scene_End < Scene_Base
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
def return_scene
index = $game_system.menu_commands.index(Vocab::game_end)
$scene = Scene_Menu.new(index)
end
end
#==============================================================================
# ** 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 :actors
attr_accessor :reserve_actors
attr_accessor :temp_actors
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias dargor_vx_party_changer_party_initialize initialize
alias dargor_vx_party_add_actor add_actor
alias dargor_vx_party_remove_actor remove_actor
alias dargor_vx_party_setup_starting_members setup_starting_members
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
dargor_vx_party_changer_party_initialize
@reserve_actors = []
@temp_actors = []
end
#--------------------------------------------------------------------------
# * Roll Actors
#--------------------------------------------------------------------------
def roll_actors
return unless $game_system.map_party_switcher
@actors.roll
end
#--------------------------------------------------------------------------
# * Unroll Actors
#--------------------------------------------------------------------------
def unroll_actors
return unless $game_system.map_party_switcher
@actors.unroll
end
#--------------------------------------------------------------------------
# * Initial Party Setup
#--------------------------------------------------------------------------
def setup_starting_members
dargor_vx_party_setup_starting_members
for i in $data_system.party_members
add_reserve_actor(i)
if $game_parties != nil
$game_parties.add_actor(i)
$game_parties.add_reserve_actor(i)
end
end
end
#--------------------------------------------------------------------------
# * Get Reserve Members
#--------------------------------------------------------------------------
def reserve_members
result = []
for i in @reserve_actors
result.push($game_actors[i])
end
return result.uniq
end
#--------------------------------------------------------------------------
# * Get All Members
#--------------------------------------------------------------------------
def all_members
all_actors = (@actors + @reserve_actors).sort
array = []
for i in all_actors
array << $game_actors[i]
end
return array.uniq
end
#--------------------------------------------------------------------------
# * Add an Actor
# actor_id : actor ID
#--------------------------------------------------------------------------
def add_actor(actor_id)
add_reserve_actor(actor_id)
if $game_parties != nil
$game_parties.add_actor(actor_id)
$game_parties.add_reserve_actor(actor_id)
end
dargor_vx_party_add_actor(actor_id)
end
#--------------------------------------------------------------------------
# * Add an Actor to the Reserve
# actor_id : actor ID
#--------------------------------------------------------------------------
def add_reserve_actor(actor_id, forced=false)
if forced
@reserve_actors.push(actor_id)
if $game_parties != nil
$game_parties.add_reserve_actor(actor_id)
end
$game_player.refresh
return
end
if @actors.size == MAX_MEMBERS and not @reserve_actors.include?(actor_id)
@reserve_actors.push(actor_id)
if $game_parties != nil
$game_parties.add_reserve_actor(actor_id)
end
$game_player.refresh
end
unless @reserve_actors.include?(actor_id)
@reserve_actors.push(actor_id)
if $game_parties != nil
$game_parties.add_reserve_actor(actor_id)
end
$game_player.refresh
end
end
#--------------------------------------------------------------------------
# * Remove Actor from the Reserve
# actor_id : actor ID
#--------------------------------------------------------------------------
def remove_reserve_actor(actor_id)
@reserve_actors.delete(actor_id)
$game_player.refresh
if $game_parties != nil
$game_parties.remove_reserve_actor(actor_id)
end
end
#--------------------------------------------------------------------------
# * Get members forced in the party
#--------------------------------------------------------------------------
def forced_members
array = []
for i in $game_system.forced_party
$game_actors[i].party_locked = true
array << $game_actors[i]
end
return array.uniq
end
#--------------------------------------------------------------------------
# * Get Array of All Living Members
#--------------------------------------------------------------------------
def existing_reserve_members
result = []
for battler in reserve_members
next unless battler.exist?
result.push(battler)
end
return result
end
#--------------------------------------------------------------------------
# * Get Array of All Living Members
#--------------------------------------------------------------------------
def all_existing_members
result = []
for battler in members + reserve_members
next unless battler.exist?
result.push(battler)
end
return result
end
#--------------------------------------------------------------------------
# * Clear Temporary Actors Array
#--------------------------------------------------------------------------
def clear_temp_actors
@temp_actors = []
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
extra_height = (96 * ($game_party.members.size-4))
if $game_party.members.size > 0
height += extra_height
end
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
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias dargor_vx_party_changer_menu_create_command_window create_command_window
alias dargor_vx_party_changer_menu_update_command_selection update_command_selection
alias dargor_vx_party_changer_menu_update_actor_selection update_actor_selection
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
commands = $game_system.menu_commands
dargor_vx_party_changer_menu_create_command_window
index = commands.index(Vocab::PartyOrder)
if $game_system.menu_party_order == false # If party order is forbidden
@command_window.draw_item(index, false) # Disable party arrange
end
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_command_selection
dargor_vx_party_changer_menu_update_command_selection
command = @command_window.selection
if Input.trigger?(Input::C)
case @command_window.selection
when Vocab::PartyOrder
start_actor_selection
end
end
end
#--------------------------------------------------------------------------
# * Update Actor Selection
#--------------------------------------------------------------------------
def update_actor_selection
if Input.trigger?(Input::B)
@status_window.clear_selection_rect
end
dargor_vx_party_changer_menu_update_actor_selection
if Input.trigger?(Input::C)
$game_party.last_actor_index = @status_window.index
Sound.play_decision
case @command_window.selection
when Vocab::PartyOrder # skill
# Create first member variable
if @member1.nil?
@member1 = $game_party.members[@status_window.index]
@member1_index = @status_window.index
@status_window.set_selection_rect(@member1_index)
return
end
# Create second member variable
if @member2.nil?
@member2 = $game_party.members[@status_window.index]
@member2_index = @status_window.index
# Exchange members if they are not the same
if @member1 != @member2
$game_party.actors[@member1_index] = @member2.id
$game_party.actors[@member2_index] = @member1.id
end
@status_window.clear_selection_rect
@status_window.refresh
@member1 = nil
@member2 = nil
$game_player.refresh
end
end
end
end
end