This could be used for any game, but I thought it would work well for a pokemon game or something if anyone was looking for a PC script. I DID NOT MAKE THIS SCRIPT OR CLAIM TO HAVE ANY PART IN IT'S CREATION.
#==============================================================================
# Easy Party Switcher by Blizzard
# Version 1.21b
# Date: 21.05.2006
# Date v1.1: 25.05.2006
# Date v1.2b: 27.05.2006
# Date v1.21b: 12.08.2006
#
#
# This is the official Party Switcher of:
# Chaos Project - The Three Moons™
#
#
# Special Thanks to:
# Zeriab for pointing out a few glitches and shortening the code. =D
#
#
# IMPORTANT NOTE:
#
# Be sure to set the $party_max_size to the maximum size of your party.
# There is already a preconfiguration of 4.
#
#
# Compatibility:
#
# 99% chance of full compatibility with SDK, not tested altough. Can cause
# incompatibility with Party Change Systems. WILL corrupt your old savegames.
#
#
# Features:
#
# - Set party members for "not _available" (shown transparent in the reserve)
# - Remove party members from the reserve list ("disabled_for_party")
# - Set party members, who MUST be in the party (shown transparent in the
# current party, "must_be_in_party")
# - option either to wipe the party (for multi-party use) or only remove every
# member (except 1) from the party.
# - Easy to use and easy to switch party members
# - also supports small parties (2 or 3 members) and large parties (5 or more)
#
#
# How to use:
#
# To call this script, make a "Call script" command in an event. The syntax is:
#
# $scene = Scene_PartySwitcher.new
# or
# $scene = Scene_PartySwitcher.new(XXX)
# or
# $scene = Scene_PartySwitcher.new(XXX, 1)
# or
# $scene = Scene_PartySwitcher.new(XXX, YYY, ZZZ)
#
# - If you use the first syntax, no extra feature will be applied and you can
# switch the party as you wish.
# - If you use the second syntax, you can replace XXX for 1 to remove all party
# members except one (either one, who must be in the party or a random one), or
# replace XXX with 2, to cause a wipe party. Wiping a party will disable the
# of the current members and a NEW party of the remaining members must be
# formed. If you replace it with 3, the current party configuration will be
# stored for a later fast switch-back.
# - If you use the third sytnax, you can use the XXX as described above or just
# set it to 0 to disable it. Also the "1" in the syntax will reset any
# disabled_for_party and is made to be used after multi-party use.
# - If you use the fourth syntax you can replace ZZZ with 1 to replace the
# party with a stored one AND store the current or replace it with 2 to replace
# the party with a stored one, but without storing the current. USE THIS ONLY
# IF YOU ASSUME TO HAVE A STORED PARTY READY! This syntax will not open the
# Party Switcher and it will override the commands XXX and YYY, so you can
# replace these with any number.
#
# - Character faces go into a "Faces" folder in "Characters" and they have the
# same name as the character spritesets have.
#
#
# Other syntaxes:
# $game_actors[XXX].not_available = true/false
# $game_actors[XXX].disabled_for_party = true/false
# $game_actors[XXX].must_be_in_party = true/false
#
# - not_available will disable the possibility of an already unlocked character
# to be in th current party.
# - disabled for party will cause the character NOT to appear in the party
# switch screen.
# - must_be_in_party will cause the character to be automatically moved into
# the current party, while switching parties and also he cannot be put in the
# reserve.
#
#
# Additional note:
#
# For your own sake, do not apply the attribute "must_be_in_party" to a
# character at the same time with "not_available" or "disabled_for_party" as
# this WILL disrupt your party and party switch system.
#
#==============================================================================
$party_max_size = 4
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
attr_accessor :must_be_in_party
attr_accessor :disabled_for_party
attr_accessor :not_available
alias setup_eps_later setup
def setup(actor_id)
@must_be_in_party = false
@disabled_for_party = false
@not_available = false
setup_eps_later(actor_id)
end
end
#==============================================================================
# Game_Party
#==============================================================================
class Game_Party
def actors=(actors)
@actors = actors
end
end
#==============================================================================
# Window_Base
#==============================================================================
class Window_Base
def draw_actor_face(actor, x, y)
if actor != nil and actor.character_name != nil and actor.character_name != ""
bitmap = RPG::Cache.character("Faces/" + actor.character_name, actor.character_hue)
cw = 80
ch = 80
src_rect = Rect.new(0, 0, cw, ch)
if actor.not_available or actor.must_be_in_party
self.contents.blt(x, y, bitmap, src_rect, 128)
else
self.contents.blt(x, y, bitmap, src_rect)
end
end
end
end
#==============================================================================
# Window_Current
#==============================================================================
class Window_Current < Window_Selectable
def initialize
if $party_max_size > 4
super(0, 0, 240 + 32, 480)
else
super(0, 0, 240 + 32, $party_max_size * 120)
end
@item_max = $party_max_size
self.contents = Bitmap.new(width - 32, 480 - 32 + (@item_max - 4) * 120)
if $fontface != nil
self.contents.font.name = $fontface
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
end
self.contents.font.size = 24
refresh
self.active = false
self.index = -1
end
def refresh
self.contents.clear
for i in 0...$game_party.actors.size
x = 0
y = i * 120 - 4
actor = $game_party.actors[i]
self.contents.font.color = normal_color
if actor != nil
draw_actor_face(actor, x, y + 8)
draw_actor_name(actor, x + 160, y)
draw_actor_level(actor, x + 96, y)
draw_actor_hp(actor, x + 96, y + 32)
draw_actor_sp(actor, x + 96, y + 64)
end
end
end
def setactor(index_1, index_2)
temp = $game_party.actors[index_1]
$game_party.actors[index_1] = $game_party.actors[index_2]
$game_party.actors[index_2] = temp
refresh
end
def getactor(index)
return $game_actors[$game_party.actors[index].id]
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
x = 0
y = (@index / @column_max) * 120 - self.oy
self.cursor_rect.set(x, y, self.width - 32, 88)
end
def clone_cursor
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
x = 0
y = (@index / @column_max) * 120
src_rect = Rect.new(0, 0, self.width, 88)
bitmap = RPG::Cache.windowskin("Cursor_Current")
self.contents.blt(x, y, bitmap, src_rect, 192)
end
def top_row
return self.oy / 116
end
def top_row=(row)
row = row % row_max
self.oy = row * 120
end
def page_row_max
return (self.height / 120)
end
end
#==============================================================================
# Window_Reserve
#==============================================================================
class Window_Reserve < Window_Selectable
def initialize
super(0, 0, 400 - 32, 320)
setup
@column_max = 3
if (@item_max / @column_max) >= 3
self.contents = Bitmap.new(width - 32, @item_max / @column_max * 96)
else
self.contents = Bitmap.new(width - 32, height - 32)
end
if $fontface != nil
self.contents.font.name = $fontface
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
end
self.contents.font.size = 24
self.active = false
self.index = -1
refresh
end
def setup
@actors = []
for i in 0...$data_actors.size
flag = false
for j in 0...$game_party.actors.size
if $game_actors[i] == $game_party.actors[j]
flag = true
end
end
if flag == false
unless $game_actors[i] == nil or $game_actors[i].disabled_for_party
@actors.push($game_actors[i])
end
end
end
@item_max = (@actors.size + $game_party.actors.size + 3) / 3 * 3
end
def refresh
self.contents.clear
for i in 0... @actors.size
drawing(@actors[i], i)
end
end
def drawing(actor, i)
x = (i % 3) * 112 + 16
y = (i / 3) * 96 - 8
self.contents.font.color = normal_color
draw_actor_face(actor, x, y + 18)
end
def getactor(index)
return @actors[index]
end
def setactor(index_1, index_2)
temp = @actors[index_1]
@actors[index_1] = @actors[index_2]
@actors[index_2] = temp
refresh
end
def setparty(index_1, index_2)
temp = @actors[index_1]
@actors[index_1] = $game_party.actors[index_2]
$game_party.actors[index_2] = temp
refresh
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
x = (@index % @column_max) * 112 + 8
y = (@index / @column_max) * 96 - self.oy
self.cursor_rect.set(x, y, 96, 96)
end
def clone_cursor
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
x = (@index % @column_max) * 112 + 8
y = (@index / @column_max) * 96
src_rect = Rect.new(0, 0, 96, 96)
bitmap = RPG::Cache.windowskin("Cursor_Reserve")
self.contents.blt(x, y, bitmap, src_rect, 192)
end
def top_row
return self.oy / 96
end
def top_row=(row)
row = row % row_max
self.oy = row * 96
end
def page_row_max
return (self.height - 32) / 96
end
end
#==============================================================================
# Window_HelpStatus
#==============================================================================
class Window_HelpStatus < Window_Base
def initialize(gotactor)
super(0, 0, 400 - 32, 160)
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
end
self.contents.font.size = 24
refresh(gotactor)
self.active = false
end
def refresh(actor)
self.contents.clear
if actor != nil
x = 0
y = 0
self.contents.font.color = normal_color
if actor.not_available
self.contents.draw_text(x + 8, y, 160, 32, "not available", 0)
end
draw_actor_face(actor, x, y + 40)
draw_actor_name(actor, x + 160, y + 32)
draw_actor_level(actor, x + 96, y + 32)
draw_actor_hp(actor, x + 96, y + 64)
draw_actor_sp(actor, x + 96, y + 96)
end
end
end
#==============================================================================
# Window_Warning
#==============================================================================
class Window_Warning < Window_Base
def initialize
super(0, 0, 320, 96)
self.visible = false
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
end
self.contents.font.size = 24
self.x = 320 - (width / 2)
self.y = 240 - (height / 2)
self.z = 9999
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 288, 32, "You cannot remove", 1)
self.contents.draw_text(0, 32, 288, 32, "the last party member!", 1)
end
end
#==============================================================================
# Scene_PartySwitcher
#==============================================================================
class Scene_PartySwitcher
def initialize(wipe_party = 0, reset = 0, store = 0)
@wipe_party = wipe_party
@store = store
@reset = reset
@current_window_temp = 0
@reserve_window_temp = 0
@canceler = false
@temp_window = ""
end
def main
if @store == 0
if @wipe_party == 1
setup_forced_party
elsif @wipe_party == 2
wipe_party
elsif @wipe_party == 3
store_party
wipe_party
end
@current_window = Window_Current.new
@current_window.index = 0
@current_window.active = true
@reserve_window = Window_Reserve.new
@reserve_window.x = 240 + 32
@reserve_window.y = 160
@warning_window = Window_Warning.new
actor = @reserve_window.getactor(0)
@help_window = Window_HelpStatus.new(actor)
@help_window.x = 240 + 32
if @reset == 1
actor.not_available = false
end
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@current_window.dispose
@reserve_window.dispose
@help_window.dispose
else
swap_parties(@store)
$scene = Scene_Map.new
end
sort_party
$game_player.refresh
Graphics.transition
end
def update
check = @reserve_window.index
if @reserve_window.active
reserve_update
@reserve_window.update
end
if check != @reserve_window.index
if @reserve_window.active
actor = @reserve_window.getactor(@reserve_window.index)
elsif @current_window.active
actor = @reserve_window.getactor(@reserve_window_temp)
end
if @temp_window == "Current" or @temp_window == ""
@help_window.refresh(actor)
end
end
if @current_window.active
current_update
@current_window.update
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
if @canceler == false
$scene = Scene_Map.new
elsif @canceler == true
@temp_window = ""
@canceler = false
if @reserve_window.active
actor = @reserve_window.getactor(@reserve_window.index)
elsif @current_window.active
actor = @reserve_window.getactor(@reserve_window_temp)
end
if @temp_window == "Current" or @temp_window == ""
@help_window.refresh(actor)
end
@current_window.refresh
@reserve_window.refresh
end
return
end
if Input.trigger?(Input::A)
sort_party
@current_window.refresh
end
end
def current_update
if Input.trigger?(Input::C)
if @canceler == false
$game_system.se_play($data_system.decision_se)
@canceler = true
@temp_actor_index = @current_window.index
@temp_window = "Current"
@current_window.clone_cursor
elsif @canceler == true
switch_members
end
return
end
if Input.trigger?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@current_window.active = false
@reserve_window.active = true
@current_window_temp = @current_window.index
actor = @reserve_window.getactor(@reserve_window_temp)
@current_window.index = -1
@reserve_window.index = @reserve_window_temp
if @canceler == false
@help_window.refresh(actor)
end
return
end
end
def reserve_update
if Input.trigger?(Input::C)
if @canceler == false
$game_system.se_play($data_system.decision_se)
@canceler = true
@temp_actor_index = @reserve_window.index
@temp_window = "Reserve"
@reserve_window.clone_cursor
elsif @canceler == true
switch_members
end
return
end
if (@reserve_window.index % 3) == 0
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@reserve_window.active = false
@current_window.active = true
@reserve_window_temp = @reserve_window.index
@reserve_window.index = -1
@current_window.index = @current_window_temp
end
return
end
end
def switch_members
if @temp_window == "Reserve" and @reserve_window.active
@reserve_window.setactor(@temp_actor_index, @reserve_window.index)
actor = @reserve_window.getactor(@reserve_window.index)
@help_window.refresh(actor)
end
if @temp_window == "Current" and @current_window.active
@current_window.setactor(@temp_actor_index, @current_window.index)
end
if @temp_window == "Reserve" and @current_window.active
actor1 = @current_window.getactor(@current_window.index)
actor2 = @reserve_window.getactor(@temp_actor_index)
if call_warning(@current_window.index, actor2)
if actor1 != nil and actor1.must_be_in_party
$game_system.se_play($data_system.buzzer_se)
@canceler = false
@temp_window = ""
actor = @reserve_window.getactor(@reserve_window_temp)
@current_window.refresh
@reserve_window.refresh
@help_window.refresh(actor)
return
end
if actor2 != nil and actor2.not_available
$game_system.se_play($data_system.buzzer_se)
@canceler = false
@temp_window = ""
actor = @reserve_window.getactor(@reserve_window_temp)
@current_window.refresh
@reserve_window.refresh
@help_window.refresh(actor)
return
end
@reserve_window.setparty(@temp_actor_index, @current_window.index)
@current_window.refresh
actor = @reserve_window.getactor(@reserve_window_temp)
@help_window.refresh(actor)
else
warning
end
end
if @temp_window == "Current" and @reserve_window.active
actor1 = @current_window.getactor(@temp_actor_index)
actor2 = @reserve_window.getactor(@reserve_window.index)
if call_warning(@temp_actor_index, actor2)
if actor1 != nil and actor1.must_be_in_party
$game_system.se_play($data_system.buzzer_se)
@canceler = false
@temp_window = ""
actor = @reserve_window.getactor(@reserve_window.index)
@current_window.refresh
@reserve_window.refresh
@help_window.refresh(actor)
return
end
if actor2 != nil and actor2.not_available
$game_system.se_play($data_system.buzzer_se)
@canceler = false
@temp_window = ""
actor = @reserve_window.getactor(@reserve_window.index)
@current_window.refresh
@reserve_window.refresh
@help_window.refresh(actor)
return
end
@reserve_window.setparty(@reserve_window.index, @temp_actor_index)
@current_window.refresh
actor = @reserve_window.getactor(@reserve_window.index)
@help_window.refresh(actor)
else
warning
end
end
$game_system.se_play($data_system.decision_se)
@canceler = false
@temp_window = ""
return
end
def sort_party
actors = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor != nil
actors.push($game_actors[actor.id])
end
end
$game_party.actors = actors
for i in 0...$data_actors.size
actor = $game_actors[i]
if actor != nil
actor.must_be_in_party = false
end
end
end
def wipe_party
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor != nil
actor.not_available = true
end
end
actors = []
$game_party.actors = actors
for i in 0...$data_actors.size
actor = $game_actors[i]
if actor != nil and actor.must_be_in_party and not actor.not_available
$game_party.add_actor(actor.id)
end
end
if $game_party.actors.size == 0
for i in 0...$data_actors.size
actor = $game_actors[i]
unless actor == nil or actor.not_available or actor.disabled_for_party
$game_party.add_actor(actor.id)
return
end
end
end
end
def setup_forced_party
actors = []
$game_party.actors = actors
for i in 0...$data_actors.size
actor = $game_actors[i]
if actor != nil and actor.must_be_in_party and
not actor.disabled_for_party and not actor.not_available
$game_party.add_actor(actor.id)
end
end
end
def store_party
$stored_party = $game_party.actors
end
def swap_parties(swap)
temp = $game_party.actors
for i in 0...temp.size
if temp[i] != nil
temp[i].not_available = true
end
end
for i in 0...$stored_party.size
if $stored_party[i] != nil
$stored_party[i].not_available = false
end
end
$game_party.actors = $stored_party
if swap == 1
$stored_party = temp
else
$stored_party = nil
end
end
def call_warning(index, actor2)
actor1 = $game_party.actors[index]
if actor1 != nil and actor2 == nil
count = 0
for i in $game_party.actors
if i != nil
count += 1
end
end
if count <= 1
return false
end
end
return true
end
def warning
$game_system.se_play($data_system.buzzer_se)
@warning_window.visible = true
loop do
Graphics.update
Input.update
if Input.trigger?(Input::C)
@warning_window.visible = false
@current_window.refresh
@reserve_window.refresh
break
end
end
return
end
end
Not sure if the Blizzard mentioned is the one on this forum or another, but I think it is our Blizzard
. Anyway, hope it's useful!