#==============================================================================
# ** Party Switcher + Extra Parties
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1
# 2006-11-25
#------------------------------------------------------------------------------
# * Description :
#
# This script was designed to allow you to switch active members with
# a list of reserve actors and optional global reserve actors. There is also
# an addition that can create multiple parties. Your extra parties can be
# dynamic, having their own items, gold, etc. or they can all just share
# these. Each party has its current position in your world stored, so you
# can switch from party to party. There is also a 'exp share' feature,
# allowing you to set a percentage of the exp gained in battle to be
# shared with your reserve actors as well as global reserves.
#
# There is a built-in party switcher scene as well as a "Quick Switcher"
# that will allow you to swith actors directly on the map.
#------------------------------------------------------------------------------
# * Instructions :
#
# Place The Script Below the SDK and Above Main.
# To Customize Starting Reserve Members, Global Reserves Members or Extra
# Parties, refer to Customization
# To open switchers or see other operations, see Syntax.
#------------------------------------------------------------------------------
# * Customization :
#
# Empty Slot Word
# - EmptySlot_Word = 'Empty'
#
# Empty Slot Character File Name
# - EmptySlot_CharacterFile = 'Empty'
#
# Max Active Members
# - Max_Active_Members = 4
#
# Max Reserve Members
# - Max_Reserve_Members = 8
#
# Max Global Reserve Members
# - Max_G_Reserve_Members = 8
#
# Starting Exp Share For Reserve Members
# - Starting_ExpShare_Reserve = 0.5
#
# Starting Exp Share For Global Reserve Members
# - Starting_ExpShare_GReserve = 0.5
#
# Starting Reserve Members
# - Starting_Reserve_Members = [actor_id, ...]
#
# Starting Global Reserve Members
# - Starting_G_Reserve_Members = []
#
# Starting Extra Paries (See Party Parameters for details)
# - Starting_Extra_Parties = [<party_parameters>, ...]
#------------------------------------------------------------------------------
# * Syntax :
#
# Open Quick Switcher
# - $scene.open_partyswitcher({<switcher_parameters>})
#
# Open Main Switcher
# - $scene = Scene_Party.new({<switcher_parameters>})
#
# ** Switcher Parameters
# - 'clear' => true or false
# - 'required' => [actor_id, ...]
# - 'restricted' => [actor_id, ...]
# - 'allow_globals' => true or false
# - 'minsize' => n
# - 'maxsize' => n
#
# Create Extra Party (See Party Parameters for details)
# - $game_party.create_extra_party(<party_parameters>)
#
# Delete Extra Party
# - $game_party.delete_extra_party(party_id, gain_gold, gain_items,
# gain_weapons, gain_armors, actors_to_global_actors)
#
# party_id : ID of party being deleted
# gain_gold : true to move all gold to current party (Default = true)
# gain_items : true to move all items to current party (Default = true)
# gain_weapons : true to move all weapons to current party (Default = true)
# gain_armors : true to move all armors to current party (Default = true)
# actors_to_global_actors : true to move all actors to global reserves
#
# Switch Parties
# - $game_party.switch_parties(party_id, dynamic)
#
# party_id : ID of party being switched with
# dynamic : if true, all instances (gold, items, etc.) will be exchanged,
# allowing parties with multiple items, weapons, etc.
#
# Add Actor to Party
# - $game_party.add_actor(actor_id, index, add_to_reserves)
#
# actor_id : id of actor
# index : index in party actor being forced into
# add_to_reserves : if true, if party full, actor added to reserve party
#
# Remove Actor from Party
# - $game_party.remove_actor(actor_id, add_to_reserves)
#
# actor_id : id of actor
# index : index in party actor being forced into
# add_to_reserves : if true, if party full, actor added to reserve party
#
# Add Reserve Actor
# - $game_party.add_reserve_actor(actor_id, index, add_to_g)
#
# actor_id : id of actor
# index : index in reserves actor being forced into
# add_to_g : if true, if reserves full, actor added to global resrves
#
# Remove Reserve Actor
# - $game_party.remove_reserve_actor(actor_id, add_to_g)
#
# actor_id : id of actor
# add_to_g : if true, if reserves full, actor added to global resrves
#
# Add Global Reserve Actor
# - $game_party.add_global_reserve_actor(actor_id, index)
#
# actor_id : id of actor
# index : index in reserves actor being forced into
#
# Remove Global Reserve Actor
# - $game_party.remove_global_reserve_actor(actor_id)
#
# actor_id : id of actor
#
# Locate Actor Party Location (See Party Location Parameters Below)
# - $game_party.locate_actor(actor_id)
#
# Move Actor (See Party Location Parameters Below)
# - $game_party.move_actor(actor_id, target_parameters)
#
# Swap Actors
# - $game_party.swap_actors(actor_id, actor_id)
#
# ** Party Location Parameters
# - Current Party : [0, 0]
# - Current Reserves : [0, 1]
# - Extra Party (Active) : [1, 0, party_id]
# - Extra Party (Reserve) : [1, 1, party_id]
# - Global Reserve Actors : [2]
#------------------------------------------------------------------------------
# * Party Parameters :
#
# { 'keyword' => value, ... }
#
# ** Require Parameters :
#
# 'actors' => [actor_id, ...]
#
# ** Optional Parameters :
#
# 'res_actors' => [actor_id, ...]
# 'map_id' => map_id
# 'x' => map_x
# 'y' => map_y
# 'dir' => direction (2 : Down, 4 : Left, 6 : Right, 8 : Up)
# 'id' => party_id
#==============================================================================
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Party Switcher +', 'SephirothSpawn', 1, '2006-11-25')
#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.state('Party Switcher +')
#==============================================================================
# ** Game_Party
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# * Options
#--------------------------------------------------------------------------
EmptySlot_Word = 'Empty'
EmptySlot_CharacterFile = 'Empty'
Max_Active_Members = 4
Max_Reserve_Members = 8
Max_G_Reserve_Members = 8
Starting_ExpShare_Reserve = 0.5
Starting_ExpShare_GReserve = 0.5
Starting_Reserve_Members = []
Starting_G_Reserve_Members = []
Starting_Extra_Parties = [
{ 'actors' => [3, 4, 5, 6], 'party_id' => 1,
'map_id' => 1, 'x' => 10, 'y' => 10, 'dir' => 6
}
]
#--------------------------------------------------------------------------
# * Extra Parties & Global Reserve Actors
#--------------------------------------------------------------------------
@@extra_parties = {}
@@global_reserve_actors = []
#--------------------------------------------------------------------------
# * Extra Parties (Read)
#--------------------------------------------------------------------------
def extra_parties
return @@extra_parties
end
#--------------------------------------------------------------------------
# * Extra Parties (Write)
#--------------------------------------------------------------------------
def extra_parties=(extra_parties)
@@extra_parties = extra_parties
end
#--------------------------------------------------------------------------
# * Global Reserve Actors (Read)
#--------------------------------------------------------------------------
def global_reserve_actors
return @@global_reserve_actors
end
#--------------------------------------------------------------------------
# * Global Reserve Actors (Write)
#--------------------------------------------------------------------------
def global_reserve_actors=(global_reserve_actors)
@@global_reserve_actors = global_reserve_actors
end
#--------------------------------------------------------------------------
# * Clear Extra Parties & G Reserve Actor
#--------------------------------------------------------------------------
def clear_extras
@@extra_parties = {}
@@global_reserve_actors = []
end
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :items
attr_reader :weapons
attr_reader :armors
attr_accessor :actors
attr_accessor :reserve_actors
attr_accessor :expshare_reserve
attr_accessor :expshare_greserve
attr_accessor :party_id
attr_accessor :map_x
attr_accessor :map_y
attr_accessor :map_id
attr_accessor :map_direction
#--------------------------------------------------------------------------
# * Alias Initialization
#--------------------------------------------------------------------------
alias seph_partychanger_gameactor_init initialize
alias seph_partychanger_gameactor_ssm setup_starting_members
alias seph_partychanger_gameactor_aa add_actor
alias seph_partychanger_gameactor_ra remove_actor
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Orginal Initialization
seph_partychanger_gameactor_init
# Sets Current Party ID
@party_id = 0
# Creates Reserve Actors
@reserve_actors = []
# Sets Exp Share For Reserve & Global Reserve Actors
@expshare_reserve = Starting_ExpShare_Reserve
@expshare_greserve = Starting_ExpShare_GReserve
end
#--------------------------------------------------------------------------
# * Setup Starting Members
#--------------------------------------------------------------------------
def setup_starting_members
# Original Setup
seph_partychanger_gameactor_ssm
# Adds Starting Reserve Members
for i in Starting_Reserve_Members
# Add Reserve Actor
add_reserve_actor(i)
end
# Adds Starting Global Reserve Members
for i in Starting_G_Reserve_Members
# Add Global Reserve Actor
add_global_reserve_actor(i)
end
# Adds Starting Extra Parties
for i in Starting_Extra_Parties
# Create New Party
create_extra_party(i)
end
end
#--------------------------------------------------------------------------
# * Give Exp Share
#--------------------------------------------------------------------------
def give_exp_share(exp = 0)
# If Reserve Exp Percent Not 0
unless (percent = @expshare_reserve) == 0
# Calculates Exp Value
n = Integer( exp * percent )
# Gives All Reserve Actors Exp
@reserve_actors.each {|actor| actor.exp += n }
end
# If GReserve Exp Percent Not 0
unless (percent = @expshare_greserve) == 0
# Calculates Exp Value
n = Integer( exp * percent )
# Gives All Reserve Actors Exp
@@global_reserve_actors.each {|actor| actor.exp += n }
end
end
#--------------------------------------------------------------------------
# * Create Extra Party
#--------------------------------------------------------------------------
def create_extra_party(parameters)
# Sets Defined Paramters
active_actors = parameters['actors']
reserve_actors = parameters.has_key?('res_actors') ?
parameters['res_actors'] : []
map_id = parameters.has_key?('map_id') ?
parameters['map_id'] : 1
x = parameters.has_key?('x') ?
parameters['x'] : 0
y = parameters.has_key?('y') ?
parameters['y'] : 0
dir = parameters.has_key?('dir') ?
parameters['dir'] : 2
id = parameters.has_key?('party_id') ?
parameters['party_id'] : nil
# Picks Party ID
if id.nil? || @@extra_parties.has_key?(id)
id = 1
id += 1 while @@extra_parties.has_key?(id)
end
# Creates New Party
extra_party = Game_Party.new
extra_party.party_id = id
extra_party.map_x = x
extra_party.map_y = y
extra_party.map_id = map_id
extra_party.map_direction = dir
# Sets Active Actors
for actor_id in active_actors
extra_party.add_actor(actor_id)
end
# Sets Reserve Actors
for actor_id in reserve_actors
extra_party.add_reserve_actor(actor_id)
end
# Saves Extra Party Information
@@extra_parties[id] = extra_party
end
#--------------------------------------------------------------------------
# * Delete Extra Party
#--------------------------------------------------------------------------
def delete_extra_party(party_id, gain_gold = true, gain_items = true,
gain_weapons = true, gain_armors = true, actors_to_g = true)
# Return if Current Party, Party Data Not Found, or Nil Party Data
return if @party_id == party_id
return unless @@extra_parties.has_key?(party_id)
return if @@extra_parties[party_id].nil?
# Retrieve Extra Party Data
extra_party = @@extra_parties[party_id]
# Gain Gold
gain_gold(extra_party.gold) if gain_gold
# Gain Items
if gain_items
extra_party.items.each { |item_id, n| gain_item(item_id, n) }
end
# Gain Armors
if gain_weapons
extra_party.weapons.each { |weapon_id, n| gain_weapon(weapon_id, n) }
end
# Gain Armors
if gain_armors
extra_party.armors.each { |armor_id, n| gain_armor(armor_id, n) }
end
# If Move Actors to Global Reserves
if actors_to_g
for actor in extra_party.actors
extra_party.remove_actor(actor.id)
add_global_reserve_actor(actor)
end
for actor in extra_party.reserve_actors
extra_party.remove_reserve_actor(actor.id)
add_global_reserve_actor(actor)
end
end
# Delete Extra Party
@@extra_parties[party_id] = nil
end
#--------------------------------------------------------------------------
# * Switch Parties
#--------------------------------------------------------------------------
def switch_parties(party_id, dynamic = true)
# Return if Current Party
return if party_id == @party_id
# Return If No Extra Party Exist
return unless @@extra_parties.has_key?(party_id)
# Return If Nil Party
return if @@extra_parties[party_id].nil?
# Saves Current Party Location
@map_x = $game_player.x
@map_y = $game_player.y
@map_id = $game_map.id
@map_direction = $game_player.direction
# Saves Current Party Info in Extra Parties
@@extra_parties[@party_id] = self.dup
# Gets New Party
new_party = @@extra_parties[party_id]
# Moves Player
$game_temp.player_transferring = true
$game_temp.player_new_map_id = new_party.map_id
$game_temp.player_new_x = new_party.map_x
$game_temp.player_new_y = new_party.map_y
$game_temp.player_new_direction = new_party.map_direction
# If Dynamic Parties
if dynamic
# Passes Through Each Instance Variable
for instance in self.instance_variables
# Removes @
instance.sub!('@', '')
# Skip if method not included
skip unless self.methods.include?(instance)
# Sets Instance Variables
eval ("@#{instance} = new_party.#{instance}")
end
# If Non-Dynamic
else
@party_id = new_party.party_id
@actors.clear
@reserve_actors.clear
for actor in new_party.actors
@actors << actor
end
for actor in new_party.reserve_actors
@reserve_actors << actor
end
end
# Removes New Party Data From Extra Parties List
@@extra_parties[party_id] = nil
# Refresh Player
$game_player.refresh
end
#--------------------------------------------------------------------------
# * Add an Actor
#--------------------------------------------------------------------------
def add_actor(*args)
# Gets Actor ID
actor_id = args[0]
# Gets Index (If Defined)
index = args.size == 2 ? args[1] : @actors.size
# Add to Reserve
add_r = args.size == 3 ? args[2] : true
# Get actor
actor = $game_actors[actor_id]
# Unless Actor In Party
unless @actors.include?(actor)
# If Party Isn't Full
if @actors.size < Max_Active_Members
# Add actor
@actors.insert(index, actor)
# Remove From Reserve (If In Reserve)
remove_reserve_actor(actor_id, false)
# Remove From Extra Parties (If In Extras)
remove_from_extra_parties(actor_id)
# Remove From Global Reserves (If In Globals)
remove_global_reserve_actor(actor_id)
# Refresh player
$game_player.refresh
# If Party Full
else
# Add To Reserve
add_reserve_actor(actor_id) if add_r
end
end
# Orginal Add Actor Phase
seph_partychanger_gameactor_aa(actor_id)
end
#--------------------------------------------------------------------------
# * Remove Actor
#--------------------------------------------------------------------------
def remove_actor(*args)
# Actor ID
actor_id = args[0]
# Add to Reserve Flag
add_r = args.size == 2 ? args[1] : true
# Add Reserves Actor
add_reserve_actor(actor_id) if add_r
# Orginal Remove Actor
seph_partychanger_gameactor_ra(actor_id)
end
#--------------------------------------------------------------------------
# * Add Reserve Actor
#--------------------------------------------------------------------------
def add_reserve_actor(actor_id, index = @reserve_actors.size, add_g = true)
# Get actor
actor = $game_actors[actor_id]
# Unless Actor In Reserves
unless @reserve_actors.include?(actor)
# If Reserve Isn't Full
if @reserve_actors.size < Max_Reserve_Members
# Add actor
@reserve_actors.insert(index, actor)
# Remove From Active Party
remove_actor(actor_id, false)
# Remove From Extra Parties
remove_from_extra_parties(actor_id)
# Remove From Global Reserves
remove_global_reserve_actor(actor_id)
# If Full
else
# Add To Global Reserve
add_global_reserve_actor(actor_id) if add_g
end
end
end
#--------------------------------------------------------------------------
# * Remove Reserve Actor
#--------------------------------------------------------------------------
def remove_reserve_actor(actor_id, add_g = true)
# Get actor
actor = $game_actors[actor_id]
# If Actor In Reserves
if @reserve_actors.include?(actor)
# Remove actor
@reserve_actors.delete(actor)
# Add Global Reserve Actor
add_global_reserve_actor(actor_id) if add_g
end
end
#--------------------------------------------------------------------------
# * Add Global Reserve Actor
#--------------------------------------------------------------------------
def add_global_reserve_actor(actor_id, indx = @@global_reserve_actors.size)
# Get actor
actor = $game_actors[actor_id]
# Unless Actor In Reserves
unless @@global_reserve_actors.include?(actor)
# If Reserve Isn't Full
if @reserve_actors.size < Max_G_Reserve_Members
# Add actor
@@global_reserve_actors.insert(indx, actor)
# Remove From Active Party
remove_actor(actor_id, false)
# Remove From Reserves
remove_reserve_actor(actor_id, false)
# Remove From Extra Parties
remove_from_extra_parties(actor_id)
end
end
end
#--------------------------------------------------------------------------
# * Remove Global Reserve Actor
#--------------------------------------------------------------------------
def remove_global_reserve_actor(actor_id)
# Get actor
actor = $game_actors[actor_id]
# Unless Actor In Reserves
if @@global_reserve_actors.include?(actor)
# Remove actor
@@global_reserve_actors.delete(actor)
end
end
#--------------------------------------------------------------------------
# * Remove From Extra Parties
#--------------------------------------------------------------------------
def remove_from_extra_parties(actor_id)
# Get actor
actor = $game_actors[actor_id]
# Passes Through All Extra Parties
for party in @@extra_parties.values
# Delete Actor If in Party
party.remove_actor(actor_id, false)
end
end
#--------------------------------------------------------------------------
# * Locate Actor
#
# Current Party : [0, 0]
# Current Reserves : [0, 1]
# Extra Party (Active) : [1, 0, party_id]
# Extra Party (Reserve) : [1, 1, party_id]
# Global Reserve Actors : [2]
#--------------------------------------------------------------------------
def locate_actor(actor_id)
# Return Nil if None-ID
return nil if actor_id.nil?
# Gets Actor
actor = $game_actors[actor_id]
# Current Party
return [0, 0] if @actors.include?(actor)
# Current Reserves
return [0, 1] if @reserve_actors.include?(actor)
# Checks Global Reserves
return [2] if @@global_reserve_actors.include?(actor)
# Checks Each Extra Party
@@extra_parties.each do |party_id, party|
# Party Active Actors
return [1, 0, party_id] if party.actors.include?(actor)
# Party Resever Actors
return [1, 1, party_id] if party.reserve_actors.include?(actor)
end
# Return False
return nil
end
#--------------------------------------------------------------------------
# * Move Actor
#
# Current Party : [0, 0]
# Current Reserves : [0, 1]
# Extra Party (Active) : [1, 0, party_id]
# Extra Party (Reserve) : [1, 1, party_id]
# Global Reserve Actors : [2]
#--------------------------------------------------------------------------
def move_actor(actor_id, target_parameters)
# Gets Actor Location
group_parameters = locate_actor(actor_id)
# Return If Matching Parameters or Group Parmeters Are Nil
return if group_parameters == target_parameters ||
group_parameters.nil?
# Get actor
actor = $game_actors[actor_id]
# Removes Actor From Current Group
if group_parameters[0] == 0
group_parameters[1] == 0 ? remove_actor(actor_id, false) :
remove_reserve_actor(actor_id, false)
# Extra Parties
elsif group_parameters[0] == 1
party = @@extra_parties[group_parameters[2]]
group_parameters[1] == 0 ? party.remove_actor(actor_id, false) :
party.remove_reserve_actor(actor_id, false)
# Global Reserves
elsif group_parameters[0] == 2
remove_global_reserve_actor(actor_id)
end
# Adds Actor To Group
if target_parameters[0] == 0
target_parameters[1] == 0 ? add_actor(actor_id, true) :
add_reserve_actor(actor_id, true)
# Extra Parties
elsif target_parameters[0] == 1
party = @@extra_parties[target_parameters[2]]
target_parameters[1] == 0 ? party.add_actor(actor_id, true) :
party.add_reserve_actor(actor_id, true)
# Global Reserves
elsif target_parameters[0] == 2
add_global_reserve_actor(actor_id)
end
# Refresh Player
$game_player.refresh
end
#--------------------------------------------------------------------------
# * Swap Actors
#--------------------------------------------------------------------------
def swap_actors(actor1_id, actor2_id)
# Return If Same Actor
return if actor1_id == actor2_id
# Locates Actor 1 & 2
group1 = locate_actor(actor1_id)
group2 = locate_actor(actor2_id)
# Gets Actor Data
actor1 = $game_actors[actor1_id]
actor2 = $game_actors[actor2_id]
# Gets Group 1
# Removes Actor 1 From Current Group
if group1[0] == 0
group1 = group1[1] == 0 ? @actors : @reserve_actors
elsif group1[0] == 1
party = @@extra_parties[group1[2]]
group1 = group1[1] == 0 ? party.actors : party.reserve_actors
elsif group1[0] == 2
group1 = @@global_reserve_actors
end
# Removes Actor 2 From Current Group
if group2[0] == 0
group2 = group2[1] == 0 ? @actors : @reserve_actors
elsif group2[0] == 1
party = @@extra_parties[group2[2]]
group2 = group2[1] == 0 ? party.actors : party.reserve_actors
elsif group2[0] == 2
group2 = @@global_reserve_actors
end
# Gets Actors Index
index1 = group1.index(actor1)
index2 = group2.index(actor2)
# Deletes Actors
group1.delete(actor1)
group2.delete(actor2)
# Inserts Into New Groups
group1.insert(index1, actor2)
group2.insert(index2, actor1)
# Refreshes Player
$game_player.refresh
end
end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor
#--------------------------------------------------------------------------
# * Get Last Experience Level Amount
#--------------------------------------------------------------------------
def last_exp
return @exp_list[@level]
end
end
#==============================================================================
# ** Window_BattleResult
#==============================================================================
class Window_BattleResult < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :exp
end
#==============================================================================
# ** Window_PSwitcherPartySprites
#==============================================================================
class Window_PSwitcherPartySprites < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actors, max, width)
super(0, 384, width * 32 + 32, 96)
self.contents = Bitmap.new(max * 32, height - 32)
self.opacity = 200 if $scene.is_a?(Scene_Map)
self.contents.font.size = 12
self.contents.font.bold = true
@index = 0
refresh(actors, max)
update
end
#--------------------------------------------------------------------------
# * Get Actor
#--------------------------------------------------------------------------
def actor
return @actors[@index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(actors = @actors, max = @max)
# Duplicates Actors & Sets Max
@actors, @max = actors.dup, max
# Adds Empty Actors Until Full
@actors << nil until @actors.size == max
# Clears Contents
self.contents.clear
# Passes Through All Actors
for i in 0...@actors.size
# Gets Actor
actor = @actors[i]
# Sets Font Color
self.contents.font.color = actor.nil? ? disabled_color : normal_color
# Draws Text
text = actor.nil? ? Game_Party::EmptySlot_Word : actor.name
self.contents.draw_text(i * 32, 52, 32, 12, text, 1)
end
# Draw Actor Sprites
draw_actor_sprites
end
#--------------------------------------------------------------------------
# * Draw Actor Sprites
#--------------------------------------------------------------------------
def draw_actor_sprites
# Passes Through All Actors
for i in 0...@actors.size
# Get Actor
actor = @actors[i]
# If Empty Actor
if actor.nil?
# Draws Empty Sprite
self.contents.draw_anim_sprite(i * 32, 0, 32, 52,
Game_Party::EmptySlot_CharacterFile, 0)
# If Actor Exist
else
# Draws Character Sprite
self.contents.draw_anim_sprite(i * 32, 0, 32, 52,
actor.character_name, actor.character_hue)
end
end
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
super
# If Active
if self.active
# If Up is Pressed
if Input.repeat?(Input::UP) || Input.repeat?(Input::LEFT)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Decrease Index
@index == 0 ? @index = @max - 1 : @index -= 1
# Update Contents Offset
update_ox
# If Down is Pressed
elsif Input.repeat?(Input::DOWN) || Input.repeat?(Input::RIGHT)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Increase Index
@index == @max - 1 ? @index = 0 : @index += 1
# Update Contents Offset
update_ox
end
end
# If Frame Reset
if Graphics.frame_count % Bitmap::Anim_Sprite_Reset_Frames == 0
# Draw Actor Sprites
draw_actor_sprites
end
# Update Cursor Rect
update_cursor_rect
end
#--------------------------------------------------------------------------
# * Update Contents Offset
#--------------------------------------------------------------------------
def update_ox
min = (@index - ((self.width - 32) / 32 / 2)) * 32
max = self.contents.width - (self.width - 32)
self.ox = [[min, 0].max, max].min
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
x = @index * 32 - self.ox
self.cursor_rect.set(x, 0, 32, 64)
end
end
#==============================================================================
# ** Window_PSwitcherActorList
#==============================================================================
class Window_PSwitcherActorList < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actors, max, description)
super(0, 192, 320, 192)
self.contents = Bitmap.new(width - 32, height)
self.oy = 16
@description = description
@index = 0
refresh(actors, max)
update
end
#--------------------------------------------------------------------------
# * Get Actor
#--------------------------------------------------------------------------
def actor
return @actors[@index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(actors = @actors, max = @max)
# Duplicates Actors & Sets Max
@actors, @max = actors.dup, max
# Adds Empty Actors Until Full
@actors << nil until @actors.size == max
# Clears Contents
self.contents.clear
# Gets Actor Data
actor1 = @actors[@index]
actor2 = @actors[@index == max - 1 ? 0 : @index + 1]
# Draws Heading
self.contents.font.color = normal_color
self.contents.font.bold = true
self.contents.draw_text(0, 16, 288, 32, @description, 1)
self.contents.font.bold = false
# Draws Actor Information
draw_actor_information(actor1, 48)
draw_actor_information(actor2, 112)
end
#--------------------------------------------------------------------------
# * Draw Actor Information
#--------------------------------------------------------------------------
def draw_actor_information(actor, y)
# If Nil Actor
if actor.nil?
# Sets Font
self.contents.font.color = disabled_color
# Draws Empty Sprite
self.contents.draw_anim_sprite(0, y, 48, 64,
Game_Party::EmptySlot_CharacterFile, 0)
# Draws Empty Postition Text
self.contents.draw_text(32, y, 256, 64, Game_Party::EmptySlot_Word, 1)
return
end
# Sets Font
self.contents.font.color = normal_color
# Draws Actor Sprite
self.contents.draw_anim_sprite(0, y, 48, 64, actor.character_name,
actor.character_hue)
# Draws Actor Name, Class & Level
self.contents.draw_text(48, y, 224, 32, actor.name)
self.contents.draw_text(48, y, 224, 32,
"#{actor.class_name} (Level : #{actor.level})", 2)
# Draws Actor Experience
self.contents.font.color = system_color
self.contents.draw_text(48, y + 32, 224, 24, 'Exp')
self.contents.font.color = normal_color
self.contents.draw_text(48, y + 32, 224, 24, actor.exp_s, 2)
l, c, n = actor.last_exp, actor.exp, actor.next_exp_s.to_i
self.contents.draw_slant_bar(138, y + 56, (c - l), (n - l), 128, 6)
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
super
# If Active
if self.active
# If Up is Pressed
if Input.repeat?(Input::UP) || Input.repeat?(Input::LEFT)
# Decrease Index
@index == 0 ? @index = @max - 1 : @index -= 1
# Refresh
refresh
# If Down is Pressed
elsif Input.repeat?(Input::DOWN) || Input.repeat?(Input::RIGHT)
# Increase Index
@index == @max - 1 ? @index = 0 : @index += 1
# Update Contents Offset
refresh
end
end
# If Frame Reset
if Graphics.frame_count % Bitmap::Anim_Sprite_Reset_Frames == 0
# Gets Actor Data
actors = [@actors[@index], @actors[@index == @max - 1 ? 0 : @index + 1]]
# Passes Through All Actors
for i in 0..1
# Gets Actor & Y Position
actor, y = actors[i], 48 + i * 64
# If Nil Actor
if actor.nil?
# Draws Empty Sprite
self.contents.draw_anim_sprite(0, y, 48, 64,
Game_Party::EmptySlot_CharacterFile, 0)
else
# Draws Actor Sprite
self.contents.draw_anim_sprite(0, y, 48, 64, actor.character_name,
actor.character_hue)
end
end
end
# Update Cursor Rect
self.cursor_rect.set(0, 32, 288, 64)
end
end
#==============================================================================
# ** Window_SwitcherActorBio
#==============================================================================
class Window_SwitcherActorBio < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 64, 640, 128)
self.contents = Bitmap.new(width - 32, height - 32)
refresh(actor)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(actor = @actor)
# Stores Actor Data
@actor = actor
# Clears Contents
self.contents.clear
# If Nil Actor
if actor.nil?
# Draws Empty Character Sprite
self.contents.draw_anim_sprite(0, 0, 96, 96,
Game_Party::EmptySlot_CharacterFile, 0)
# Draws Empty Stats
self.contents.font.color = disabled_color
self.contents.font.bold = true
self.contents.draw_text(96, 0, 512, 96, Game_Party::EmptySlot_Word)
return
end
# Sets Font
self.contents.font.color = normal_color
self.contents.font.bold = false
# Draws Character Sprite
self.contents.draw_anim_sprite(0, 0, 96, 96, actor.character_name,
actor.character_hue)
# Draws Name, Status, Class & Level
self.contents.draw_text(96, 0, 128, 24, actor.name)
self.contents.draw_text(96, 24, 128, 24, actor.class_name)
self.contents.draw_text(96, 48, 128, 24,
make_battler_state_text(actor, 128, true))
self.contents.draw_text(96, 72, 128, 24, "Level : #{actor.level}")
# Draws HP
self.contents.font.color = system_color
self.contents.draw_text(224, 0, 160, 24, $data_system.words.hp)
self.contents.font.color = normal_color
self.contents.draw_text(224, 0, 160, 24, "#{actor.hp} / #{actor.maxhp}", 2)
self.contents.draw_slant_bar(288, 24, actor.hp, actor.maxhp, 96, 8)
# Draws SP
self.contents.font.color = system_color
self.contents.draw_text(224, 32, 160, 24, $data_system.words.sp)
self.contents.font.color = normal_color
self.contents.draw_text(224, 32, 160, 24, "#{actor.sp} / #{actor.maxsp}", 2)
self.contents.draw_slant_bar(288, 56, actor.sp, actor.maxsp, 96, 8,
Color.new(0, 0, 150), Color.new(0, 100, 0))
# Draws Actor Experience
self.contents.font.color = system_color
self.contents.draw_text(224, 64, 160, 24, 'Exp')
self.contents.font.color = normal_color
self.contents.draw_text(224, 64, 160, 24, actor.exp_s, 2)
l, c, n = actor.last_exp, actor.exp, actor.next_exp_s.to_i
self.contents.draw_slant_bar(288, 88, (c - l), (n - l), 96, 8)
# Draws Str, Dex, Agi & Int
draw_actor_parameter(actor, 416, -4, 3)
draw_actor_parameter(actor, 416, 20, 4)
draw_actor_parameter(actor, 416, 44, 5)
draw_actor_parameter(actor, 416, 68, 6)
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
super
# If Frame Reset
if Graphics.frame_count % Bitmap::Anim_Sprite_Reset_Frames == 0
if @actor.nil?
# Draws Empty Character Sprite
self.contents.draw_anim_sprite(0, 0, 96, 96,
Game_Party::EmptySlot_CharacterFile, 0)
else
self.contents.draw_anim_sprite(0, 0, 96, 96, @actor.character_name,
@actor.character_hue)
end
end
end
end
#==============================================================================
# ** Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_partyswitcher_scnmp_update update
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# If Party Switcher Windows Present
unless @active_party_list.nil?
update_partyswitcher
return
end
# Update Orginal Map
seph_partyswitcher_scnmp_update
end
#--------------------------------------------------------------------------
# * Frame Update : Party Switcher
#--------------------------------------------------------------------------
def update_partyswitcher
# Update Map Systems
$game_map.update
$game_system.map_interpreter.update
$game_system.update
$game_screen.update
# Update sprite set
@spriteset.update
# Update Switcher Windows
@active_party_list.update
@reserve_party_list.update
# If Active Party Window Active
if @active_party_list.active
update_partyswitcher_active
# If Reserve Party Window Active
elsif @reserve_party_list.active
update_partyswitcher_reserve
end
end
#--------------------------------------------------------------------------
# * Frame Update : Party Switcher (Active)
#--------------------------------------------------------------------------
def update_partyswitcher_active
# If B Button is Pressed
if Input.trigger?(Input::B)
# If Party Not Full Enough or Too Full
if $game_party.actors.size < @min_party_size ||
$game_party.actors.size > @max_party_size
return
end
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Dispose Windows
@active_party_list.dispose
@reserve_party_list.dispose
@active_party_list = nil
@reserve_party_list = nil
return
end
# If C Button is Pressed
if Input.trigger?(Input::C)
# If Trying to Remove Required Actor
if @required_actors.include?((actor = @active_party_list.actor).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)
# Turn Active List Off
@active_party_list.active = false
# Turn Reserves On
@reserve_party_list.active = true
return
end
end
#--------------------------------------------------------------------------
# * Frame Update : Party Switcher (Reserve)
#--------------------------------------------------------------------------
def update_partyswitcher_reserve
# If B Button is Pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Turn Reserve List Off
@reserve_party_list.active = false
# Turn Active List On
@active_party_list.active = true
return
end
# If C Button is Pressed
if Input.trigger?(Input::C)
# Get Actor
actor1 = @active_party_list.actor
actor2 = @reserve_party_list.actor
# If Switching No Actors
if actor1.nil? && actor2.nil?
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If Trying to Add Restricted Actor
if actor2 != nil && @restricted_actors.include?(actor2.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 Nil Actor In Party
if actor1.nil?
# Add Actor
$game_party.add_actor(actor2.id)
# If Nil Reserve Actor
elsif actor2.nil?
# Add Reserve Actor
$game_party.add_reserve_actor(actor1.id)
else
# Swap Actors
$game_party.swap_actors(actor1.id, actor2.id)
end
# Refresh Windows
@active_party_list.refresh($game_party.actors)
@reserve_party_list.refresh($game_party.reserve_actors)
# Turn Reserve List Off
@reserve_party_list.active = false
# Turn Active List On
@active_party_list.active = true
return
end
end
#--------------------------------------------------------------------------
# * Open Party Switcher
#--------------------------------------------------------------------------
def open_partyswitcher(parameters = {})
# Sets Default Parameters (If Undefined)
clear_party = parameters.has_key?('clear') ?
parameters['clear'] : false
required_actors = parameters.has_key?('required') ?
parameters['required'] : []
restricted_actors = parameters.has_key?('restricted') ?
parameters['restricted'] : []
min_party_size = parameters.has_key?('minsize') ?
parameters['minsize'] : 1
max_party_size = parameters.has_key?('maxsize') ?
parameters['maxsize'] : Game_Party::Max_Active_Members
# Saves Parameters
@clear_party = clear_party
@required_actors = required_actors
@restricted_actors = restricted_actors
@min_party_size = [min_party_size, 1].max
@max_party_size = [max_party_size, Game_Party::Max_Active_Members].min
@required_actors.pop until @required_actors.size <= @max_party_size
# Duplicates Party
active_party = $game_party.actors.dup
# Clear Party
if @clear_party or not @required_actors.empty?
# Move to Reserves
active_party.each {|actor| $game_party.add_reserve_actor(actor.id)}
end
# Adds Required Actors
unless @required_actors.empty?
# Adds All Required Actors
@required_actors.each {|id| $game_party.add_actor(id)}
# If Not To Clear Party
unless @clear_party
# Adds Old Party
active_party.each do |actor|
# Unless Actor Restriced
unless @restricted_actors.include?(actor.id)
# Adds Actor In Party
$game_party.add_actor(actor.id)
end
end
end
end
# Creates Active Party Sprite
total_width = 0
max = Game_Party::Max_Active_Members
width = [20 - total_width - 2, max].min
total_width += width + 1
@active_party_list = Window_PSwitcherPartySprites.new($game_party.actors,
max, width)
# Creates Reserve Party Sprite
max = Game_Party::Max_Reserve_Members
width = [19 - total_width - 0, max].min
total_width += width + 1
@reserve_party_list = Window_PSwitcherPartySprites.new(
$game_party.reserve_actors, max, width)
@reserve_party_list.active = false
# Offsets Windows
x = 320 - (total_width * 16)
@active_party_list.x = x
@reserve_party_list.x = x + @active_party_list.width
end
end
#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_partyswitcher_scnbtl_sp5 start_phase5
#--------------------------------------------------------------------------
# * Start After Battle Phase
#--------------------------------------------------------------------------
def start_phase5
# Original Start Phase 5
seph_partyswitcher_scnbtl_sp5
# Give Exp Share to Reserve Actors
$game_party.give_exp_share(@result_window.exp)
end
end
#==============================================================================
# ** Scene_Party
#==============================================================================
class Scene_Party < Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(parameters = {})
# Sets Default Parameters (If Undefined)
clear_party = parameters.has_key?('clear') ?
parameters['clear'] : false
required_actors = parameters.has_key?('required') ?
parameters['required'] : []
restricted_actors = parameters.has_key?('restricted') ?
parameters['restricted'] : []
allow_globals = parameters.has_key?('allow_globals') ?
parameters['allow_globals'] : true
min_party_size = parameters.has_key?('minsize') ?
parameters['minsize'] : 1
max_party_size = parameters.has_key?('maxsize') ?
parameters['maxsize'] : Game_Party::Max_Active_Members
# Saves Parameters
@clear_party = clear_party
@required_actors = required_actors
@restricted_actors = restricted_actors
@allow_globals = allow_globals
@min_party_size = [min_party_size, 1].max
@max_party_size = [max_party_size, Game_Party::Max_Active_Members].min
@required_actors.pop until @required_actors.size <= @max_party_size
# Saves Previous Scene
@previous_scene = $scene.class
end
#--------------------------------------------------------------------------
# * Main Processing : Variable Initialization
#--------------------------------------------------------------------------
def main_variable
# Duplicates Party
active_party = $game_party.actors.dup
# Clear Party
if @clear_party or not @required_actors.empty?
# Move to Reserves
active_party.each {|actor| $game_party.add_reserve_actor(actor.id)}
end
# Adds Required Actors
unless @required_actors.empty?
# Adds All Required Actors
@required_actors.each {|id| $game_party.add_actor(id)}
# If Not To Clear Party
unless @clear_party
# Adds Old Party
active_party.each do |actor|
# Unless Actor Restriced
unless @restricted_actors.include?(actor.id)
# Adds Actor In Party
$game_party.add_actor(actor.id)
end
end
end
end
end
#--------------------------------------------------------------------------
# * Main Processing : Window Initialization
#--------------------------------------------------------------------------
def main_window
# Creates Help Window
@help_window = Window_Help.new
# Creates Active Party List
@active_actors_list = Window_PSwitcherActorList.new($game_party.actors,
@max_party_size, 'Active List')
# Creates Reserve Party List
@reserve_actors_list = Window_PSwitcherActorList.new(
$game_party.reserve_actors, Game_Party::Max_Reserve_Members,
'Reserve List')
@reserve_actors_list.x = 320
@reserve_actors_list.active = false
# If Global Reserves
if @allow_globals
# Creates Global Reserves Window
@global_reserve_list = Window_PSwitcherActorList.new(
$game_party.global_reserve_actors, Game_Party::Max_G_Reserve_Members,
'Global Reserve List')
@global_reserve_list.x = 320
@global_reserve_list.active = false
@global_reserve_list.visible = false
end
# Creates Active Party Sprite
total_width = 0
max = @max_party_size
width = [20 - total_width - (@allow_globals ? 4 : 2), max].min
total_width += width + 1
@active_party_sprite = Window_PSwitcherPartySprites.new($game_party.actors,
max, width)
# Creates Reserve Party Sprite
max = Game_Party::Max_Reserve_Members
width = [19 - total_width - (@allow_globals ? 2 : 0), max].min
total_width += width + 1
@reserve_party_sprite = Window_PSwitcherPartySprites.new(
$game_party.reserve_actors, max, width)
@reserve_party_sprite.x = @active_party_sprite.width
@reserve_party_sprite.active = false
# If Global Reserves
if @allow_globals
# Create Global Reserves Party Sprite
max = Game_Party::Max_G_Reserve_Members
width = [19 - total_width, max].min
total_width += width + 1
@global_reserves_sprite = Window_PSwitcherPartySprites.new(
$game_party.global_reserve_actors, max, width)
@global_reserves_sprite.x = @reserve_party_sprite.x +
@reserve_party_sprite.width
@global_reserves_sprite.active = false
end
# Creates Dummmy Window
if total_width < 20
x = @allow_globals ? @global_reserves_sprite.x :
@reserve_party_sprite.x
@dummy_window = Window_Base.new(x, 384, 640 - x, 96)
end
# Creates Active Actor Bio Window
@actor_window = Window_SwitcherActorBio.new(@active_actors_list.actor)
# Update Help Window
update_help_window
end
#--------------------------------------------------------------------------
# * Frame Update : Help Window
#--------------------------------------------------------------------------
def update_help_window
# If Active List Active
if @active_actors_list.active
actor = @active_actors_list.actor
if actor.nil?
text = 'Select To Add Reserve To Empty Party Position'
else
text = 'Select Active Member To Switch Out of Party'
text += " (#{actor.name})"
end
# If Reserve List Active
elsif @reserve_actors_list.active
actor1 = @active_actors_list.actor
actor2 = @reserve_actors_list.actor
if actor2.nil?
if actor1.nil?
text = 'Select An Actor Add To Party'
else
text = 'Select To Move Active Member To Reserve Party'
text += " (#{actor1.name})"
end
else
if actor1.nil?
text = 'Select To Move Reserve Member To Active Party'
text += " (#{actor2.name})"
else
text = 'Select To Switch Party Members'
text += " (#{actor1.name} <-> #{actor2.name})"
end
end
# If Allow Globals & Active
elsif @allow_globals && @global_reserve_list.active
actor1 = @active_actors_list.actor
actor2 = @global_reserve_list.actor
if actor2.nil?
if actor1.nil?
text = 'Select An Actor Add To Party'
else
text = 'Select To Move Active Member To Global Reserves'
text += " (#{actor1.name})"
end
else
if actor1.nil?
text = 'Select To Move Global Reserve Member To Active Party'
text += " (#{actor2.name})"
else
text = 'Select To Switch Party Members'
text += " (#{actor1.name} <-> #{actor2.name})"
end
end
end
# Set Help Text
@help_window.set_text(text, 1)
end
#--------------------------------------------------------------------------
# * Frame Update : Actor Window
#--------------------------------------------------------------------------
def update_actor_window
# If Active List Active
if @active_actors_list.active
@actor_window.refresh(@active_actors_list.actor)
# If Reserve List Active
elsif @reserve_actors_list.active
@actor_window.refresh(@reserve_actors_list.actor)
# If Allow Globals & Active
elsif @allow_globals && @global_reserve_list.active
@actor_window.refresh(@global_reserve_list.actor)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# If Direction is Pressed
if Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN) ||
Input.repeat?(Input::RIGHT) || Input.repeat?(Input::LEFT)
update_help_window
update_actor_window
end
# If Active List Active
if @active_actors_list.active
update_active_list
# If Reserve List Active
elsif @reserve_actors_list.active
update_reserves_list
# If Allow Globals & Active
elsif @allow_globals && @global_reserve_list.active
update_global_reserves_list
end
end
#--------------------------------------------------------------------------
# * Frame Update : Active List
#--------------------------------------------------------------------------
def update_active_list
# If B Button is Pressed
if Input.trigger?(Input::B)
# If Party Not Full Enough or Too Full
if $game_party.actors.size < @min_party_size ||
$game_party.actors.size > @max_party_size
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
# Text For Help Window
if $game_party.actors.size < @min_party_size
text = "Party Not Full Enough (Need At Least #{@min_party_size})"
else
text = "Party Too Full (Need No More Than #{@max_party_size})"
end
# Refresh Help Window Text
@help_window.set_text(text, 1)
return
end
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to Previous Scene
$scene = @previous_scene.new
return
end
# If C Button is Pressed
if Input.trigger?(Input::C)
# If Trying to Remove Required Actor
if @required_actors.include?((actor = @active_actors_list.actor).id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
# Set Help Text
@help_window.set_text("You Cannot Remove #{actor.name}", 1)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Turn Active List Off
@active_actors_list.active = false
@active_party_sprite.active = false
# If Reserve Visible
if @reserve_actors_list.visible
# Turn Reserves On
@reserve_actors_list.active = true
@reserve_party_sprite.active = true
else
# Turn Global Reserves On
@global_reserve_list.active = true
@global_reserves_sprite.active = true
end
# Update Actor Bio Window
update_help_window
update_actor_window
return
end
end
#--------------------------------------------------------------------------
# * Frame Update : Reserve List
#--------------------------------------------------------------------------
def update_reserves_list
# If Allow Globals
if @allow_globals
# If L or R is Pressed
if Input.trigger?(Input::L) || Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Turn Reserve List Off
@reserve_actors_list.visible = false
@reserve_actors_list.active = false
@reserve_party_sprite.active = false
# Turn Global Reserves On
@global_reserve_list.visible = true
@global_reserve_list.active = true
@global_reserves_sprite.active = true
# Update Actor Bio Window
update_help_window
update_actor_window
return
end
end
# If B Button is Pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Turn Reserve List Off
@reserve_actors_list.active = false
@reserve_party_sprite.active = false
# Turn Active List On
@active_actors_list.active = true
@active_party_sprite.active = true
# Update Actor Bio Window
update_help_window
update_actor_window
return
end
# If C Button is Pressed
if Input.trigger?(Input::C)
# Get Actor
actor1 = @active_actors_list.actor
actor2 = @reserve_actors_list.actor
# If Switching No Actors
if actor1.nil? && actor2.nil?
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
# Set Help Text
@help_window.set_text('Please Select Actor To Add To Your Party')
return
end
# If Trying to Add Restricted Actor
if actor2 != nil && @restricted_actors.include?(actor2.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
# Set Help Text
@help_window.set_text("You Cannot Add #{actor2.name}", 1)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# If Nil Actor In Party
if actor1.nil?
# Add Actor
$game_party.add_actor(actor2.id)
# If Nil Reserve Actor
elsif actor2.nil?
# Add Reserve Actor
$game_party.add_reserve_actor(actor1.id)
else
# Swap Actors
$game_party.swap_actors(actor1.id, actor2.id)
end
# Refresh Windows
@active_actors_list.refresh($game_party.actors)
@active_party_sprite.refresh($game_party.actors)
@reserve_actors_list.refresh($game_party.reserve_actors)
@reserve_party_sprite.refresh($game_party.reserve_actors)
# Turn Reserve List Off
@reserve_actors_list.active = false
@reserve_party_sprite.active = false
# Turn Active List On
@active_actors_list.active = true
@active_party_sprite.active = true
# Update Actor Bio Window
update_help_window
update_actor_window
return
end
end
#--------------------------------------------------------------------------
# * Frame Update : Global Reserve List
#--------------------------------------------------------------------------
def update_global_reserves_list
# If Allow Globals
if @allow_globals
# If L or R is Pressed
if Input.trigger?(Input::L) || Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Turn Global Reserves Off
@global_reserve_list.visible = false
@global_reserve_list.active = false
@global_reserves_sprite.active = false
# Turn Reserve List On
@reserve_actors_list.visible = true
@reserve_actors_list.active = true
@reserve_party_sprite.active = true
# Update Actor Bio Window
update_help_window
update_actor_window
return
end
end
# If B Button is Pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Turn Global Reserve List Off
@global_reserve_list.active = false
@global_reserves_sprite.active = false
# Turn Active List On
@active_actors_list.active = true
@active_party_sprite.active = true
# Update Actor Bio Window
update_help_window
update_actor_window
return
end
# If C Button is Pressed
if Input.trigger?(Input::C)
# Get Actor
actor1 = @active_actors_list.actor
actor2 = @global_reserve_list.actor
# If Switching No Actors
if actor1.nil? && actor2.nil?
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
# Set Help Text
@help_window.set_text('Please Select Actor To Add To Your Party')
return
end
# If Trying to Add Restricted Actor
if actor2 != nil && @restricted_actors.include?(actor2.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
# Set Help Text
@help_window.set_text("You Cannot Add #{actor2.name}", 1)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# If Nil Actor In Party
if actor1.nil?
# Add Actor
$game_party.add_actor(actor2.id)
# If Nil Reserve Actor
elsif actor2.nil?
# Add Reserve Actor
$game_party.add_global_reserve_actor(actor1.id)
else
# Swap Actors
$game_party.swap_actors(actor1.id, actor2.id)
end
# Refresh Windows
@active_actors_list.refresh($game_party.actors)
@active_party_sprite.refresh($game_party.actors)
@global_reserve_list.refresh($game_party.global_reserve_actors)
@global_reserves_sprite.refresh($game_party.global_reserve_actors)
# Turn Reserve List Off
@global_reserve_list.active = false
@global_reserves_sprite.active = false
# Turn Active List On
@active_actors_list.active = true
@active_party_sprite.active = true
# Update Actor Bio Window
update_help_window
update_actor_window
return
end
end
end
#==============================================================================
# ** Scene_Save
#==============================================================================
class Scene_Save
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_partyswitcher_scnsave_wd write_data
#--------------------------------------------------------------------------
# * Command : New Game
#--------------------------------------------------------------------------
def write_data(file)
# Original Write Data
seph_partyswitcher_scnsave_wd(file)
# Saves Global Reserve & Extra Party Data
Marshal.dump($game_party.global_reserve_actors, file)
Marshal.dump($game_party.extra_parties, file)
end
end
#==============================================================================
# ** Scene_Load
#==============================================================================
class Scene_Load
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_partyswitcher_scnload_rd read_data
#--------------------------------------------------------------------------
# * Command : New Game
#--------------------------------------------------------------------------
def read_data(file)
# Original Write Data
seph_partyswitcher_scnload_rd(file)
# Load Global Reserve & Extra Party Data
$game_party.global_reserve_actors = Marshal.load(file)
$game_party.extra_parties = Marshal.load(file)
end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end