#=========================================================================
=====
# ** Prexus - Party Manager (v1.1c)
#------------------------------------------------------------------------------
# This is a Party Management system, created by Prexus. It allows you to
# change your party makeup, out of a reserve of characters. It also allows you
# to lock characters, making them mandatory, and make characters unavailable.
#
# See thread at RMXP.org for instructions:
#
http://www.rmxp.org/forums/index.php?topic...02326#msg402326#
# - Changelog (v1.1c)
# * Fixed a graphical error in the party reserves window
#
# - (v1.1b)
# * Fixed a bug with the draw_item_name method, added the width parameter
# - (v1.1)
# * Added functionality to see player's equipment (press the A button)
#
#==============================================================================
module RPG
class Actor
def setup
@found = false
@unavailable = false
@required = false
end
attr_accessor :found
attr_accessor :unavailable
attr_accessor :required
end
end
class Game_Actors
attr_reader :data
alias prex_party_g_actors_initialize initialize
def initialize
prex_party_g_actors_initialize
$data_actors.each do |actor|
actor.setup if actor
@data[actor.id] = Game_Actor.new(actor.id) if actor
end
end
end
class Scene_File < Scene_Base
alias prex_party_s_file_write_save_data write_save_data
alias prex_party_s_file_read_save_data read_save_data
def write_save_data(file)
prex_party_s_file_write_save_data(file)
Marshal.dump($data_actors, file)
end
def read_save_data(file)
prex_party_s_file_read_save_data(file)
$data_actors = Marshal.load(file)
end
end
class Scene_Title < Scene_Base
alias prex_party_s_title_command_new_game command_new_game
def command_new_game
prex_party_s_title_command_new_game
$game_party.members.each {|s| s.actor.found = true if s}
end
end
class Window_Base < Window
def draw_item_name(item, x, y, enabled = true, width = 172)
if item != nil
draw_icon(item.icon_index, x, y, enabled)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(x + 24, y, width, WLH, item.name)
end
end
end
class Scene_Party < Scene_Base
def initialize(from_menu, from_event)
@from_menu = from_menu
@from_event = from_event
end
def start
super
create_menu_background
create_windows
end
def create_windows
@member_window = Window_CurrentMember.new
@party_window = Window_CurrentParty.new
@party_window.active = true
@selectable_window = Window_SelectMember.new
end
def update_windows
@member_window.update
@party_window.update
@selectable_window.update
if @party_window.active
@member_window.set_member(@party_window.member)
elsif @selectable_window.active
@member_window.set_member(@selectable_window.member)
end
end
def terminate
super
@member_window.dispose
@party_window.dispose
@selectable_window.dispose
end
def update
super
update_windows
update_input
end
def update_input
if Input.trigger?(Input::A)
if @member_window.mode == 1
@member_window.set_mode(0)
elsif @member_window.mode == 0
@member_window.set_mode(1)
end
end
if @party_window.active
if Input.trigger?(Input::

Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
member = @party_window.member
if member != nil
if member.actor.unavailable or member.actor.required
Sound.play_buzzer
return
end
end
Sound.play_decision
@party_window.active = false
@selectable_window.active = true
@selectable_window.index = 0
end
elsif @selectable_window.active
if Input.trigger?(Input::

Sound.play_cancel
@selectable_window.index = -1
@selectable_window.active = false
@party_window.active = true
elsif Input.trigger?(Input::C)
member = @selectable_window.member
if member != nil
if member.actor.unavailable
Sound.play_buzzer
return
end
end
if $game_party.members.size == 1 and member == nil
Sound.play_buzzer
return
end
Sound.play_decision
$game_party.remove_actor(@party_window.member.id) if @party_window.member != nil
$game_party.add_actor(@selectable_window.member.id) if @selectable_window.member != nil
@selectable_window.refresh
@party_window.refresh
@selectable_window.index = -1
@selectable_window.active = false
@party_window.active = true
end
end
end
def return_scene
if @from_menu
$scene = Scene_Menu.new(5)
elsif @from_event
$scene = Scene_Map.new
end
end
end
class Window_CurrentMember < Window_Base
attr_reader :mode
def initialize(member = nil, mode = 0)
super(304, 80, 192, 256)
create_contents
@member = member
@mode = 0
refresh
end
def member
return @member
end
def set_member(member)
old_member = @member
@member = member
refresh if old_member != @member
end
def set_mode(mode)
@mode = mode if [0, 1].include?(mode)
refresh
end
def refresh
self.contents.clear
return unless @member
x, y = 0, 0
self.draw_actor_face(@member, x, y, 48)
self.draw_actor_name(@member, x + 52, y)
self.draw_actor_class(@member, x + 52, y + WLH)
self.draw_actor_level(@member, x, y + WLH*2)
case @mode
when 0
self.draw_icon(142, self.contents.width - 24, y + WLH*2)
self.contents.draw_text(x, y + WLH*2, self.contents.width - 12, WLH, 'Equip', 2)
self.draw_actor_hp(@member, x, y + WLH*3, 160)
self.draw_actor_mp(@member, x, y + WLH*4, 160)
self.draw_actor_parameter(@member, x, y + WLH*5, 0)
self.draw_actor_parameter(@member, x, y + WLH*6, 1)
self.draw_actor_parameter(@member, x, y + WLH*7, 2)
self.draw_actor_parameter(@member, x, y + WLH*8, 3)
when 1
self.draw_icon(143, self.contents.width - 24, y + WLH*2)
self.contents.draw_text(x, y + WLH*2, self.contents.width - 12, WLH, 'Stat', 2)
for i in 0...@member.equips.size
item = @member.equips[i]
self.draw_item_name(item, x, y + WLH*(3+i), true, self.contents.width - 24)
end
end
end
end
class Window_CurrentParty < Window_Selectable
def initialize
super(48, 80, 256, 64)
@item_max = 4
@column_max = @item_max
create_contents
self.index = 0
refresh
end
def member
return $game_party.members[self.index]
end
def refresh
for i in 0...@item_max
rect = item_rect(i)
self.contents.clear_rect(rect)
end
for i in 0...$game_party.members.size
rect = item_rect(i)
bitmap = Cache.character($game_party.members[i].character_name)
sign = $game_party.members[i].character_name[/^[\!\$]./]
if sign != nil and sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = $game_party.members[i].character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
if $game_party.members[i].actor.unavailable
self.contents.blt(rect.x, rect.y, bitmap, src_rect, 128)
else
self.contents.blt(rect.x, rect.y, bitmap, src_rect, 255)
end
if $game_party.members[i].actor.required
lock_bitmap = Cache.system("Locked")
self.contents.blt(rect.x + rect.width - lock_bitmap.width,
rect.y + rect.height - lock_bitmap.height,
lock_bitmap, lock_bitmap.rect)
end
end
end
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = 32
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * 32
return rect
end
end
class Window_SelectMember < Window_Selectable
def initialize
super(48, 144, 256, 192)
calculate_actors
@item_max = @actors.size + 1
@column_max = 4
self.index = -1
self.active = false
refresh
end
def calculate_actors
@actors = []
for a in $game_actors.data
@actors << a if a != nil and a.actor.found and !$game_party.members.include?(a)
end
end
def member
return @actors[self.index]
end
def refresh
self.contents.clear
calculate_actors
@item_max = @actors.size + 1
for i in 0...@actors.size
rect = item_rect(i)
bitmap = Cache.character(@actors[i].character_name)
sign = @actors[i].character_name[/^[\!\$]./]
if sign != nil and sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = @actors[i].character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
if @actors[i].actor.unavailable
self.contents.blt(rect.x, rect.y, bitmap, src_rect, 128)
else
self.contents.blt(rect.x, rect.y, bitmap, src_rect, 255)
end
if @actors[i].actor.required
lock_bitmap = Cache.system("Locked")
self.contents.blt(rect.x + rect.width - lock_bitmap.width,
rect.y + rect.height - lock_bitmap.height,
lock_bitmap, lock_bitmap.rect)
end
end
end
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = 32
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * 32
return rect
end
end
#==============================================================================
# ** End of Party Manager (v1.1c)
#------------------------------------------------------------------------------
###############################################################################
#============================================================================
#L's Custom Menu - Simple DMS Edit (RMVX ver.) Rev.1
#============================================================================
module MenuCommand
#Default menu commands +1
Item = 'Item'
Skill = 'Skill'
Equip = 'Equip'
Status = 'Status'
Save = 'Save'
Load = 'Load'
End_Game = 'Exit'
#Optional menu commands
Party = 'Party'
Quest = 'Quest'
System = 'System'
Party = 'Party'
end
#------------------------------------------------------------------------------
# Game_Map
#------------------------------------------------------------------------------
class Game_Map
#------------------------------------------------------------------------------
# Name
#------------------------------------------------------------------------------
def name
$map_infos[@map_id]
end
end
#========================================
# Scene_Title
#--------------------------------------------------------------------------------
# Setting functions for the Title
#========================================
class Scene_Title
$map_infos = load_data("Data/MapInfos.rvdata")
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
end
class Window_MapName < Window_Base
def initialize(x, y)
super(x, 176, 160, 136)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Location")
self.contents.font.color = normal_color
self.contents.draw_text(4, WLH, 120, 32, $game_map.name.to_s, 2)
end
end
#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
# This class performs the save and load screen processing.
#==============================================================================
class Scene_File < Scene_Base
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
def return_scene
if @from_title
$scene = Scene_Title.new
elsif @from_event
$scene = Scene_Map.new
else
$scene = Scene_Menu.new(6)
end
end
end
#==============================================================================
# ** End Scene_File
#------------------------------------------------------------------------------
###############################################################################
#==============================================================================
# ** Scene_End
#------------------------------------------------------------------------------
# This class performs game end screen processing.
#==============================================================================
class Scene_End < Scene_Base
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(6)
end
end
#==============================================================================
# ** End Scene_End
#------------------------------------------------------------------------------
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
commands_init
@changer = 0 #Change Party Order by Yargovish
@where = 0 #
@checker = 0 #
end
#--------------------------------------------------------------------------
# * Set Commands
#--------------------------------------------------------------------------
def commands_init
@commands = []
s1 = MenuCommand::Item
s2 = MenuCommand::Skill
s3 = MenuCommand::Equip
s4 = MenuCommand::Status
s5 = MenuCommand::Party
s6 = MenuCommand::System
@commands.push(s1, s2, s3, s4, s5, s6).flatten!
@sys_commands = []
o1 = MenuCommand::Save
o2 = MenuCommand::Load
o3 = MenuCommand::End_Game
@sys_commands.push(o1, o2, o3).flatten!
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_command_window
create_system_window
@gold_window = Window_Gold.new(384, 264)
@status_window = Window_MenuStatus.new(0, 0)
@mapname_window = Window_MapName.new(384, 320)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@command_window.dispose
@sys_command_window.dispose
@gold_window.dispose
@status_window.dispose
@mapname_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@command_window.update
@sys_command_window.update
@gold_window.update
@status_window.update
@mapname_window.update
if @command_window.active
update_command_selection
elsif @sys_command_window.active
@sys_command_window.z = +500
update_sys_command_selection
elsif @status_window.active
update_actor_selection
end
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_Command.new(160, @commands)
@command_window.x = 384
@command_window.index = @menu_index
if $game_party.members.size == 0 # If number of party members is 0
@command_window.draw_item(0, false) # Disable item
@command_window.draw_item(1, false) # Disable skill
@command_window.draw_item(2, false) # Disable equipment
@command_window.draw_item(3, false) # Disable status
@command_window.draw_item(5, false) # Disable party
end
if $game_party.members.size <= 1
@command_window.draw_item(4, false) # Disable ordering
end
end
#--------------------------------------------------------------------------
# * Create System Command Window
#--------------------------------------------------------------------------
def create_system_window
@sys_command_window = Window_Command.new(128, @sys_commands)
@sys_command_window.visible = false
@sys_command_window.active = false
@sys_command_window.x = 250
@sys_command_window.y = 121
@sys_command_window.z = 0
check_save_available
check_load_available
end
#-----------------
def check_save_available
if $game_system.save_disabled # If save is forbidden
@sys_command_window.draw_item(1, false) # Disable save
end
end
#-----------------
def check_load_available
#Check if saved file exists
@load_enabled = (Dir.glob('Save*.rvdata').size > 0)
if !@load_enabled
#Put your @command_window.draw_item(index, false) to disable load
@sys_command_window.draw_item(2, false)
end
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::

Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
# Return if Disabled Command
if disabled_main_command?
# Play buzzer SE
Sound.play_buzzer
return
end
main_command_input
end
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_sys_command_selection
if Input.trigger?(Input::

Sound.play_cancel
@command_window.active = true
@sys_command_window.active = false
@sys_command_window.visible = false
@sys_command_window.index = 0
@sys_command_window.z = -500
return
elsif Input.trigger?(Input::C)
# Return if Disabled Command
if disabled_main_command?
# Play buzzer SE
Sound.play_buzzer
return
end
sys_command_input
end
end
#--------------------------------------------------------------------------
# * Disabled Main Command? Test
#--------------------------------------------------------------------------
def disabled_main_command?
# Gets Current Command
command = @commands[@command_window.index]
sys_command = @sys_commands[@sys_command_window.index]
# Gets Menu Commands
c = MenuCommand
# If 0 Party Size
if $game_party.members.size == 0
# If Item, Skill, Equip or Status Selected
if [c::Item, c::Skill, c::Equip, c::Status, c::Party].include?(command)
return true
end
elsif $game_party.members.size <= 1
# If the command is changing member order
if [c::Order].include?(command)
return true
end
end
# If Save Disabled && Command is Save
return true if $game_system.save_disabled and sys_command == c::Save
# If Load Disabled && Command is Load
return true if !@load_enabled && sys_command == c::Load
return false
end
#--------------------------------------------------------------------------
# * Update Command Check
#--------------------------------------------------------------------------
def main_command_input
# Loads Current Command
command = @commands[@command_window.index]
# Play decision SE
Sound.play_decision
# Checks Commands
case command
when MenuCommand::Item #item
command_item
when MenuCommand::Skill, MenuCommand::Equip, MenuCommand::Status #skill, equip, status
start_actor_selection
when MenuCommand::Party #order
command_party
when MenuCommand::System #call system submenu
@sys_command_window.active = true
@sys_command_window.visible = true
@command_window.active = false
end
end
#--------------------------------------------------------------------------
# * Update System Command Check
#--------------------------------------------------------------------------
def sys_command_input
# Loads Current Command
sys_command = @sys_commands[@sys_command_window.index]
# Play decision SE
Sound.play_decision
# Checks Commands
case sys_command
when MenuCommand::Save #save
command_save
when MenuCommand::Load #load
command_load
when MenuCommand::End_Game #exit
command_endgame
end
end
#--------------------------------------------------------------------------
# * Start Actor Selection
#--------------------------------------------------------------------------
def start_actor_selection
@command_window.active = false
@status_window.active = true
if $game_party.last_actor_index < @status_window.item_max
@status_window.index = $game_party.last_actor_index
else
@status_window.index = 0
end
end
#--------------------------------------------------------------------------
# * End Actor Selection
#--------------------------------------------------------------------------
def end_actor_selection
@command_window.active = true
@status_window.active = false
@status_window.index = -1
end
#--------------------------------------------------------------------------
# * Update Actor Selection
#--------------------------------------------------------------------------
def update_actor_selection
# Loads Current Command
command = @commands[@command_window.index]
if Input.trigger?(Input::

Sound.play_cancel
end_actor_selection
elsif Input.trigger?(Input::C)
$game_party.last_actor_index = @status_window.index
Sound.play_decision
case command
when MenuCommand::Skill # skill
command_skill
when MenuCommand::Equip # equipment
command_equip
when MenuCommand::Status # status
command_status
end
end
end
#--------------------------------------------------------------------------
# * Command Item
#--------------------------------------------------------------------------
def command_item
# Switch to item screen
$scene = Scene_Item.new
end
#--------------------------------------------------------------------------
# * Command Skill
#--------------------------------------------------------------------------
def command_skill
# Switch to skill screen
$scene = Scene_Skill.new(@status_window.index)
end
#--------------------------------------------------------------------------
# * Command Equip
#--------------------------------------------------------------------------
def command_equip
# Switch to equipment screen
$scene = Scene_Equip.new(@status_window.index)
end
#--------------------------------------------------------------------------
# * Command Status
#--------------------------------------------------------------------------
def command_status
# Switch to status screen
$scene = Scene_Status.new(@status_window.index)
end
#--------------------------------------------------------------------------
# * Command Order
#--------------------------------------------------------------------------
def command_order
# If Main Command Active
if @command_window.active
# Activate Status Window
start_actor_selection
@checker = 0
return
end
#Change Party Order by Yargovish
if @checker == 0
@changer = $game_party.members[@status_window.index]
@where = @status_window.index
@checker = 1
else
$game_party.members[@where] = $game_party.members[@status_window.index]
$game_party.members[@status_window.index] = @changer
@checker = 0
@status_window.refresh
$game_player.refresh #
end
end
#--------------------------------------------------------------------------
# * Command Party
#--------------------------------------------------------------------------
def command_party
# Switch to party change screen
#Put your Party Change Scene here
$scene = Scene_Party.new(true, false)
end
#--------------------------------------------------------------------------
# * Command Option
#--------------------------------------------------------------------------
def command_option
# Switch to party change screen
#Put your Option Scene here
end
#--------------------------------------------------------------------------
# * Command Quest
#--------------------------------------------------------------------------
def command_quest
# Switch to party change screen
#Put your Quest Scene here
end
#--------------------------------------------------------------------------
# * Command Save
#--------------------------------------------------------------------------
def command_save
# Switch to save screen
$scene = Scene_File.new(true, false, false)
end
#--------------------------------------------------------------------------
# * Command Load
#--------------------------------------------------------------------------
def command_load
# Switch to load screen
$scene = Scene_File.new(false, false, false)
end
#--------------------------------------------------------------------------
# * Command End Game
#--------------------------------------------------------------------------
def command_endgame
# Switch to end game screen
$scene = Scene_End.new
end
end
#============================================================================
# End of L's Custom Menu - Simple DMS Edit (RMVX ver.) Rev.1
#============================================================================