#==============================================================================
# module BlizzCFG
#==============================================================================
module BlizzCFG
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Conficuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# how many party members do you use
MAX_PARTY = 6
# set to true to use facesets instead of spritesets
FACESETS = true
# allows a party with 0 members
ALLOW_EMPTY_PARTY = false
# allows switching the party in battle
BATTLE_SWITCH = true
# gives all other characters EXP (specify in %)
EXP_RESERVE = 0
# gives "not available" characters EXP (specify in %)
EXP_NOT_AVAILABLE = 0
# gives "disabled for party" characters EXP (specify in %)
EXP_DISABLED_FOR_PARTY = 0
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Conficuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
end
# recognition variable for plug-ins
$easy_party_switcher = 2.4
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
attr_accessor :must_be_in_party
attr_accessor :disabled_for_party
attr_accessor :not_available
attr_accessor :forced_position
alias setup_eps_later setup
def setup(actor_id)
setup_eps_later(actor_id)
@must_be_in_party = @disabled_for_party = @not_available = false
end
end
#==============================================================================
# Game_System
#==============================================================================
class Game_System
attr_accessor :stored_party
attr_accessor :order_only
attr_accessor :battle_order_only
alias init_eps_later initialize
def initialize
init_eps_later
@order_only = @battle_order_only = false
end
end
#==============================================================================
# Game_Party
#==============================================================================
class Game_Party
attr_accessor :actors
attr_accessor :forced_size
def any_forced_position
return (@actors.any? {|actor| actor != nil && actor.forced_position != nil})
end
end
#==============================================================================
# Window_Base
#==============================================================================
class Window_Base
alias draw_actor_graphic_eps_later draw_actor_graphic
def draw_actor_graphic(actor, x, y)
if actor != nil && actor.character_name != ''
classes = [Window_Current, Window_Reserve, Window_HelpStatus]
if BlizzCFG::FACESETS && !$all_available && classes.include?(self.class)
draw_actor_face_eps(actor, x, y)
else
if classes.include?(self.class)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
x += bitmap.width / 8 + 24
y += bitmap.height / 4 + 16
end
draw_actor_graphic_eps_later(actor, x, y)
end
end
end
def draw_actor_face_eps(actor, x, y)
if $tons_version == nil || $tons_version < 3.71 || !FACE_HUE
hue = 0
else
hue = actor.character_hue
end
bitmap = RPG::Cache.character("#{actor.character_name}_face", hue)
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
if actor.not_available || 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
#==============================================================================
# Window_BattleResult
#==============================================================================
class Window_BattleResult
attr_reader :exp
end
#==============================================================================
# Window_Current
#==============================================================================
class Window_Current < Window_Selectable
def initialize
super(0, 0, 240 + 32, (BlizzCFG::MAX_PARTY > 4 ? 480 : BlizzCFG::MAX_PARTY * 120))
self.contents = Bitmap.new(width - 32, 448 + (BlizzCFG::MAX_PARTY-4) * 120)
@item_max = BlizzCFG::MAX_PARTY
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
self.contents.font.size = 24
refresh
self.active, self.index, self.z = false, -1, 5000
end
def refresh
self.contents.clear
$game_party.actors.each_index {|i|
if $game_party.actors[i] != nil
draw_actor_graphic($game_party.actors[i], 4, i*120+4)
draw_actor_name($game_party.actors[i], 152, i*120-4)
draw_actor_level($game_party.actors[i], 88, i*120-4)
draw_actor_hp($game_party.actors[i], 88, i*120+24)
draw_actor_sp($game_party.actors[i], 88, i*120+52)
end}
end
def setactor(index_1, index_2)
$game_party.actors[index_2], $game_party.actors[index_1] =
$game_party.actors[index_1], $game_party.actors[index_2]
refresh
end
def getactor(index)
return $game_party.actors[index]
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
self.top_row = row if row < self.top_row
self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
y = (@index / @column_max) * 120 - self.oy
self.cursor_rect.set(0, y, self.width - 32, 88)
end
def clone_cursor
row = @index / @column_max
self.top_row = row if row < self.top_row
self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
y = (@index / @column_max) * 120
src_rect = Rect.new(0, 0, self.width, 88)
bitmap = Bitmap.new(self.width-32, 88)
bitmap.fill_rect(0, 0, self.width-32, 88, Color.new(255, 255, 255, 192))
bitmap.fill_rect(2, 2, self.width-36, 84, Color.new(255, 255, 255, 80))
self.contents.blt(0, y, bitmap, src_rect, 192)
end
def top_row
return self.oy / 116
end
def top_row=(row)
self.oy = (row % row_max) * 120
end
def page_row_max
return (self.height / 120)
end
end
#==============================================================================
# Window_Reserve
#==============================================================================
class Window_Reserve < Window_Selectable
attr_reader :actors
def initialize(scene)
super(0, 0, 368, 320)
setup
@column_max, rows = 3, @item_max / @column_max
self.contents = Bitmap.new(width - 32, (rows >= 3 ? rows * 96 : height - 32))
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
self.contents.font.size = 24
self.active, self.index, self.z = false, -1, 5000
refresh
if scene == Scene_Map && $game_system.order_only ||
scene == Scene_Battle && $game_system.battle_order_only
self.opacity = 128
end
end
def setup
@actors = []
(1...$data_actors.size).each {|i|
unless $game_party.actors.include?($game_actors[i]) ||
$game_actors[i].disabled_for_party && !$all_available
@actors.push($game_actors[i])
end}
@item_max = (@actors.size + $game_party.actors.size + 3) / 3 * 3
end
def refresh
self.contents.clear
@actors.each_index {|i| draw_actor_graphic(@actors[i], i%3*112+16, i/3*96+8)}
end
def getactor(index)
return @actors[index]
end
def get_number
return (@actors.find_all {|actor| actor != nil}).size if $all_available
return (@actors.find_all {|actor| actor != nil && !actor.not_available}).size
end
def setactor(index_1, index_2)
@actors[index_1], @actors[index_2] = @actors[index_2], @actors[index_1]
refresh
end
def setparty(index_1, index_2)
@actors[index_1], $game_party.actors[index_2] =
$game_party.actors[index_2], @actors[index_1]
refresh
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
self.top_row = row if row < self.top_row
self.top_row = row - (page_row_max-1) if row > top_row + (page_row_max-1)
x, y = (@index % @column_max)*112 + 8, (@index / @column_max)*96 - self.oy
self.cursor_rect.set(x, y, 96, 96)
end
def clone_cursor
row = @index / @column_max
self.top_row = row if row < self.top_row
self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
x, y = (@index % @column_max) * 112 + 8, (@index / @column_max) * 96
src_rect = Rect.new(0, 0, 96, 96)
bitmap = Bitmap.new(96, 96)
bitmap.fill_rect(0, 0, 96, 96, Color.new(255, 255, 255, 192))
bitmap.fill_rect(2, 2, 92, 92, Color.new(255, 255, 255, 80))
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, scene)
super(0, 0, 400 - 32, 160)
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
self.contents.font.size = 24
refresh(gotactor)
self.active, self.z = false, 5000
if scene == Scene_Map && $game_system.order_only ||
scene == Scene_Battle && $game_system.battle_order_only
self.opacity = 128
end
end
def refresh(actor)
self.contents.clear
if actor != nil
self.contents.font.color = normal_color
if actor.not_available && !$all_available
self.contents.draw_text(8, 0, 160, 32, 'not available', 0)
end
draw_actor_graphic(actor, 0, 40)
draw_actor_name(actor, 160, 32)
draw_actor_level(actor, 96, 32)
draw_actor_hp(actor, 96, 64)
draw_actor_sp(actor, 96, 96)
end
end
end
#==============================================================================
# Window_Warning
#==============================================================================
class Window_Warning < Window_Base
def initialize(mode, members)
super(0, 0, 320, 96)
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
self.contents.font.size = 24
self.x, self.y, self.z = 320 - width/2, 240 - height/2, 9999
self.contents.font.color = normal_color
if mode
self.contents.draw_text(0, 0, 288, 32, 'You need a party', 1)
num = [$game_party.forced_size, members + $game_party.actors.nitems].min
self.contents.draw_text(0, 32, 288, 32, "of #{num} members!", 1)
else
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
end
if BlizzCFG::BATTLE_SWITCH
#==============================================================================
# Window_PartyCommand
#==============================================================================
class Window_PartyCommand < Window_Selectable
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
@commands = ['Fight', 'Escape', 'Switch']
@item_max = @column_max = 3
draw_item(0, normal_color)
draw_item(1, $game_temp.battle_can_escape ? normal_color : disabled_color)
draw_item(2, normal_color)
self.active, self.visible, self.index = false, false, 0
end
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(80 + index * 160 + 4, 0, 128 - 10, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
end
def update_cursor_rect
self.cursor_rect.set(80 + index * 160, 0, 128, 32)
end
def command(index = self.index)
return @commands[index]
end
end
end
#==============================================================================
# Scene_PartySwitcher
#==============================================================================
class Scene_PartySwitcher
def initialize(wipe_party = 0, reset = 0, store = 0)
@wipe_party, @store, @reset = store, reset, wipe_party
@current_window_temp = @reserve_window_temp = 0
@scene_flag, @temp_window = false, ''
@scene = $scene.class
end
def main
if @store != 0
swap_parties
$scene = Scene_Map.new
return
end
case @wipe_party
when 1 then setup_forced_party
when 2 then wipe_party
when 3
$game_system.stored_party = $game_party.actors
wipe_party
when 10 then $all_available = true
end
if @reset == 1
(1...$data_actors.size).each {|i| $game_actors[i].not_available = false}
end
@current_window = Window_Current.new
@current_window.index, @current_window.active = 0, true
@reserve_window = Window_Reserve.new(@scene)
@reserve_window.x, @reserve_window.y = 272, 160
@help_window = Window_HelpStatus.new(@reserve_window.getactor(0), @scene)
@help_window.x = 240 + 32
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
[@current_window, @reserve_window, @help_window].each {|win| win.dispose}
$game_party.actors.compact!
$all_available = nil
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
@help_window.refresh(actor) if ['', 'Current'].include?(@temp_window)
end
current_update if @current_window.active
if Input.trigger?(Input::B)
if @scene_flag
$game_system.se_play($data_system.cancel_se)
@scene_flag, @temp_window = false, ''
if @reserve_window.active
actor = @reserve_window.getactor(@reserve_window.index)
elsif @current_window.active
actor = @reserve_window.getactor(@reserve_window_temp)
end
@help_window.refresh(actor) if ['', 'Current'].include?(@temp_window)
[@current_window, @reserve_window].each {|win| win.refresh}
return
end
if $game_party.forced_size != nil &&
($game_party.forced_size < $game_party.actors.nitems ||
($game_party.forced_size > $game_party.actors.nitems &&
@reserve_window.get_number != 0))
$game_system.se_play($data_system.buzzer_se)
warning(true)
return
end
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
elsif Input.trigger?(Input::A)
if $game_party.any_forced_position
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.decision_se)
$game_party.actors.compact!
@current_window.refresh
end
end
end
def current_update
@current_window.update
if Input.trigger?(Input::C)
actor = @current_window.getactor(@current_window.index)
if actor != nil && actor.forced_position != nil
$game_system.se_play($data_system.buzzer_se)
else
if @scene_flag
switch_members
else
$game_system.se_play($data_system.decision_se)
@scene_flag, @temp_window = true, 'Current'
@temp_actor_index = @current_window.index
@current_window.clone_cursor
end
end
elsif Input.trigger?(Input::RIGHT)
if @scene == Scene_Map && $game_system.order_only ||
@scene == Scene_Battle && $game_system.battle_order_only
$game_system.se_play($data_system.buzzer_se)
else
$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
@help_window.refresh(actor) unless @scene_flag
end
end
end
def reserve_update
if Input.trigger?(Input::C)
if @scene_flag
switch_members
else
$game_system.se_play($data_system.decision_se)
@scene_flag, @temp_window = true, 'Reserve'
@temp_actor_index = @reserve_window.index
@reserve_window.clone_cursor
end
elsif @reserve_window.index % 3 == 0 && 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
end
def switch_members
if @temp_window == 'Reserve' && @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' && @current_window.active
@current_window.setactor(@temp_actor_index, @current_window.index)
end
if @temp_window == 'Reserve' && @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 && actor1.must_be_in_party
$game_system.se_play($data_system.buzzer_se)
@scene_flag, @temp_window = false, ''
actor = @reserve_window.getactor(@reserve_window_temp)
[@current_window, @reserve_window].each {|win| win.refresh}
@help_window.refresh(actor)
return
end
if actor2 != nil && actor2.not_available && !$all_available
$game_system.se_play($data_system.buzzer_se)
@scene_flag, @temp_window = false, ''
actor = @reserve_window.getactor(@reserve_window_temp)
[@current_window, @reserve_window].each {|win| win.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' && @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 && actor1.must_be_in_party
$game_system.se_play($data_system.buzzer_se)
@scene_flag, @temp_window = false, ''
actor = @reserve_window.getactor(@reserve_window.index)
[@current_window, @reserve_window].each {|win| win.refresh}
@help_window.refresh(actor)
return
end
if actor2 != nil && actor2.not_available && !$all_available
$game_system.se_play($data_system.buzzer_se)
@scene_flag, @temp_window = false, ''
actor = @reserve_window.getactor(@reserve_window.index)
[@current_window, @reserve_window].each {|win| win.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)
@scene_flag, @temp_window = false, ''
end
def wipe_party
$game_party.actors.each {|actor| actor.not_available = true if actor != nil}
setup_forced_party(true)
if $game_party.actors == []
(1...$data_actors.size).each {|i|
unless $game_actors[i].not_available ||
$game_actors[i].disabled_for_party
$game_party.actors.push($game_actors[i])
return
end}
end
end
def setup_forced_party(flag = false)
$game_party.actors, party = [], []
(1...$data_actors.size).each {|i|
if $game_actors[i] != nil && $game_actors[i].must_be_in_party &&
(!$game_actors[i].disabled_for_party || flag) &&
!$game_actors[i].not_available
party.push($game_actors[i])
end}
party.clone.each {|actor|
if actor.forced_position != nil
$game_party.actors[actor.forced_position] = actor
party.delete(actor)
end}
$game_party.actors.each_index {|i|
$game_party.actors[i] = party.shift if $game_party.actors[i] == nil}
$game_party.actors += party.compact
end
def swap_parties
$game_party.actors.compact!
temp_actors = $game_party.actors
temp_actors.each {|actor| actor.not_available = true}
$game_system.stored_party.compact!
$game_system.stored_party.each {|actor| actor.not_available = false}
$game_party.actors = $game_system.stored_party
$game_system.stored_party = (@store == 1 ? temp_actors : nil)
end
def call_warning?(index, actor2)
return (BlizzCFG::ALLOW_EMPTY_PARTY || $game_party.actors[index] == nil ||
actor2 != nil || $game_party.actors.nitems > 1)
end
def warning(flag = false)
$game_system.se_play($data_system.buzzer_se)
@warning_window = Window_Warning.new(flag, @reserve_window.get_number)
loop do
Graphics.update
Input.update
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se) if flag
[@current_window, @reserve_window].each {|win| win.refresh}
@warning_window.dispose
@warning_window = nil
break
$game_temp.common_event_id = 11
end
end
end
end
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle
alias update_phase2_eps_later update_phase2
def update_phase2
update_phase2_eps_later
if Input.trigger?(Input::C) && @party_command_window.index == 2
$game_system.se_play($data_system.decision_se)
@spriteset.dispose
$scene = Scene_PartySwitcher.new
$scene.main
$scene = self
@spriteset = Spriteset_Battle.new
15.times {@spriteset.update}
@status_window.refresh
Graphics.transition(0)
end
end
alias start_phase5_eps_later start_phase5
def start_phase5
start_phase5_eps_later
(1...$data_actors.size).each {|i|
unless $game_party.actors.include?($game_actors[i])
if $game_actors[i].not_available
$game_actors[i].exp += @result_window.exp * BlizzCFG::EXP_NOT_AVAILABLE/100
elsif $game_actors[i].disabled_for_party
$game_actors[i].exp += @result_window.exp * BlizzCFG::EXP_DISABLED_FOR_PARTY/100
else
$game_actors[i].exp += @result_window.exp * BlizzCFG::EXP_RESERVE/100
end
end}
end
end
if BlizzCFG::BATTLE_SWITCH
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# EPS Battle Switch Mod by Blizzard
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle
alias start_phase1_esp_mod_later start_phase1
def start_phase1
start_phase1_esp_mod_later
@switch_pos = @actor_command_window.commands.size
@actor_command_window.add_command('Pokemon')
end
alias update_phase3_basic_command_eps_mod_later update_phase3_basic_command
def update_phase3_basic_command
update_phase3_basic_command_eps_mod_later
if Input.trigger?(Input::C) && @actor_command_window.index == @switch_pos
$game_system.se_play($data_system.decision_se)
@spriteset.dispose
$scene = Scene_PartySwitcher.new
$scene.main
$scene = self
@spriteset = Spriteset_Battle.new
15.times {@spriteset.update}
@status_window.refresh
@active_battler.blink = false if @active_battler != nil
@actor_index = 0
start_phase3
@actor_command_window.index = @switch_pos
Graphics.transition(10)
end
end
end
endQuote from: jcsnider on April 22, 2009, 04:17:15 pm
Ok, I am making a pokemon game and I used Blizzard's party switcher for the pokemon pc system and in battle switching order of the pokemon but I seem to have a few problems since I am making a pokemon game and this script wasnt made for it in particular...
Here is the script I am using now, it has a few edits Blizzard made for me awhile back...#==============================================================================
# module BlizzCFG
#==============================================================================
module BlizzCFG
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Conficuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# how many party members do you use
MAX_PARTY = 6
# set to true to use facesets instead of spritesets
FACESETS = true
# allows a party with 0 members
ALLOW_EMPTY_PARTY = false
# allows switching the party in battle
BATTLE_SWITCH = true
# gives all other characters EXP (specify in %)
EXP_RESERVE = 0
# gives "not available" characters EXP (specify in %)
EXP_NOT_AVAILABLE = 0
# gives "disabled for party" characters EXP (specify in %)
EXP_DISABLED_FOR_PARTY = 0
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Conficuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
end
# recognition variable for plug-ins
$easy_party_switcher = 2.4
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
attr_accessor :must_be_in_party
attr_accessor :disabled_for_party
attr_accessor :not_available
attr_accessor :forced_position
alias setup_eps_later setup
def setup(actor_id)
setup_eps_later(actor_id)
@must_be_in_party = @disabled_for_party = @not_available = false
end
end
#==============================================================================
# Game_System
#==============================================================================
class Game_System
attr_accessor :stored_party
attr_accessor :order_only
attr_accessor :battle_order_only
alias init_eps_later initialize
def initialize
init_eps_later
@order_only = @battle_order_only = false
end
end
#==============================================================================
# Game_Party
#==============================================================================
class Game_Party
attr_accessor :actors
attr_accessor :forced_size
def any_forced_position
return (@actors.any? {|actor| actor != nil && actor.forced_position != nil})
end
end
#==============================================================================
# Window_Base
#==============================================================================
class Window_Base
alias draw_actor_graphic_eps_later draw_actor_graphic
def draw_actor_graphic(actor, x, y)
if actor != nil && actor.character_name != ''
classes = [Window_Current, Window_Reserve, Window_HelpStatus]
if BlizzCFG::FACESETS && !$all_available && classes.include?(self.class)
draw_actor_face_eps(actor, x, y)
else
if classes.include?(self.class)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
x += bitmap.width / 8 + 24
y += bitmap.height / 4 + 16
end
draw_actor_graphic_eps_later(actor, x, y)
end
end
end
def draw_actor_face_eps(actor, x, y)
if $tons_version == nil || $tons_version < 3.71 || !FACE_HUE
hue = 0
else
hue = actor.character_hue
end
bitmap = RPG::Cache.character("#{actor.character_name}_face", hue)
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
if actor.not_available || 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
#==============================================================================
# Window_BattleResult
#==============================================================================
class Window_BattleResult
attr_reader :exp
end
#==============================================================================
# Window_Current
#==============================================================================
class Window_Current < Window_Selectable
def initialize
super(0, 0, 240 + 32, (BlizzCFG::MAX_PARTY > 4 ? 480 : BlizzCFG::MAX_PARTY * 120))
self.contents = Bitmap.new(width - 32, 448 + (BlizzCFG::MAX_PARTY-4) * 120)
@item_max = BlizzCFG::MAX_PARTY
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
self.contents.font.size = 24
refresh
self.active, self.index, self.z = false, -1, 5000
end
def refresh
self.contents.clear
$game_party.actors.each_index {|i|
if $game_party.actors[i] != nil
draw_actor_graphic($game_party.actors[i], 4, i*120+4)
draw_actor_name($game_party.actors[i], 152, i*120-4)
draw_actor_level($game_party.actors[i], 88, i*120-4)
draw_actor_hp($game_party.actors[i], 88, i*120+24)
draw_actor_sp($game_party.actors[i], 88, i*120+52)
end}
end
def setactor(index_1, index_2)
$game_party.actors[index_2], $game_party.actors[index_1] =
$game_party.actors[index_1], $game_party.actors[index_2]
refresh
end
def getactor(index)
return $game_party.actors[index]
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
self.top_row = row if row < self.top_row
self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
y = (@index / @column_max) * 120 - self.oy
self.cursor_rect.set(0, y, self.width - 32, 88)
end
def clone_cursor
row = @index / @column_max
self.top_row = row if row < self.top_row
self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
y = (@index / @column_max) * 120
src_rect = Rect.new(0, 0, self.width, 88)
bitmap = Bitmap.new(self.width-32, 88)
bitmap.fill_rect(0, 0, self.width-32, 88, Color.new(255, 255, 255, 192))
bitmap.fill_rect(2, 2, self.width-36, 84, Color.new(255, 255, 255, 80))
self.contents.blt(0, y, bitmap, src_rect, 192)
end
def top_row
return self.oy / 116
end
def top_row=(row)
self.oy = (row % row_max) * 120
end
def page_row_max
return (self.height / 120)
end
end
#==============================================================================
# Window_Reserve
#==============================================================================
class Window_Reserve < Window_Selectable
attr_reader :actors
def initialize(scene)
super(0, 0, 368, 320)
setup
@column_max, rows = 3, @item_max / @column_max
self.contents = Bitmap.new(width - 32, (rows >= 3 ? rows * 96 : height - 32))
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
self.contents.font.size = 24
self.active, self.index, self.z = false, -1, 5000
refresh
if scene == Scene_Map && $game_system.order_only ||
scene == Scene_Battle && $game_system.battle_order_only
self.opacity = 128
end
end
def setup
@actors = []
(1...$data_actors.size).each {|i|
unless $game_party.actors.include?($game_actors[i]) ||
$game_actors[i].disabled_for_party && !$all_available
@actors.push($game_actors[i])
end}
@item_max = (@actors.size + $game_party.actors.size + 3) / 3 * 3
end
def refresh
self.contents.clear
@actors.each_index {|i| draw_actor_graphic(@actors[i], i%3*112+16, i/3*96+8)}
end
def getactor(index)
return @actors[index]
end
def get_number
return (@actors.find_all {|actor| actor != nil}).size if $all_available
return (@actors.find_all {|actor| actor != nil && !actor.not_available}).size
end
def setactor(index_1, index_2)
@actors[index_1], @actors[index_2] = @actors[index_2], @actors[index_1]
refresh
end
def setparty(index_1, index_2)
@actors[index_1], $game_party.actors[index_2] =
$game_party.actors[index_2], @actors[index_1]
refresh
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
self.top_row = row if row < self.top_row
self.top_row = row - (page_row_max-1) if row > top_row + (page_row_max-1)
x, y = (@index % @column_max)*112 + 8, (@index / @column_max)*96 - self.oy
self.cursor_rect.set(x, y, 96, 96)
end
def clone_cursor
row = @index / @column_max
self.top_row = row if row < self.top_row
self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
x, y = (@index % @column_max) * 112 + 8, (@index / @column_max) * 96
src_rect = Rect.new(0, 0, 96, 96)
bitmap = Bitmap.new(96, 96)
bitmap.fill_rect(0, 0, 96, 96, Color.new(255, 255, 255, 192))
bitmap.fill_rect(2, 2, 92, 92, Color.new(255, 255, 255, 80))
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, scene)
super(0, 0, 400 - 32, 160)
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
self.contents.font.size = 24
refresh(gotactor)
self.active, self.z = false, 5000
if scene == Scene_Map && $game_system.order_only ||
scene == Scene_Battle && $game_system.battle_order_only
self.opacity = 128
end
end
def refresh(actor)
self.contents.clear
if actor != nil
self.contents.font.color = normal_color
if actor.not_available && !$all_available
self.contents.draw_text(8, 0, 160, 32, 'not available', 0)
end
draw_actor_graphic(actor, 0, 40)
draw_actor_name(actor, 160, 32)
draw_actor_level(actor, 96, 32)
draw_actor_hp(actor, 96, 64)
draw_actor_sp(actor, 96, 96)
end
end
end
#==============================================================================
# Window_Warning
#==============================================================================
class Window_Warning < Window_Base
def initialize(mode, members)
super(0, 0, 320, 96)
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
self.contents.font.size = 24
self.x, self.y, self.z = 320 - width/2, 240 - height/2, 9999
self.contents.font.color = normal_color
if mode
self.contents.draw_text(0, 0, 288, 32, 'You need a party', 1)
num = [$game_party.forced_size, members + $game_party.actors.nitems].min
self.contents.draw_text(0, 32, 288, 32, "of #{num} members!", 1)
else
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
end
if BlizzCFG::BATTLE_SWITCH
#==============================================================================
# Window_PartyCommand
#==============================================================================
class Window_PartyCommand < Window_Selectable
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
@commands = ['Fight', 'Escape', 'Switch']
@item_max = @column_max = 3
draw_item(0, normal_color)
draw_item(1, $game_temp.battle_can_escape ? normal_color : disabled_color)
draw_item(2, normal_color)
self.active, self.visible, self.index = false, false, 0
end
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(80 + index * 160 + 4, 0, 128 - 10, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
end
def update_cursor_rect
self.cursor_rect.set(80 + index * 160, 0, 128, 32)
end
def command(index = self.index)
return @commands[index]
end
end
end
#==============================================================================
# Scene_PartySwitcher
#==============================================================================
class Scene_PartySwitcher
def initialize(wipe_party = 0, reset = 0, store = 0)
@wipe_party, @store, @reset = store, reset, wipe_party
@current_window_temp = @reserve_window_temp = 0
@scene_flag, @temp_window = false, ''
@scene = $scene.class
end
def main
if @store != 0
swap_parties
$scene = Scene_Map.new
return
end
case @wipe_party
when 1 then setup_forced_party
when 2 then wipe_party
when 3
$game_system.stored_party = $game_party.actors
wipe_party
when 10 then $all_available = true
end
if @reset == 1
(1...$data_actors.size).each {|i| $game_actors[i].not_available = false}
end
@current_window = Window_Current.new
@current_window.index, @current_window.active = 0, true
@reserve_window = Window_Reserve.new(@scene)
@reserve_window.x, @reserve_window.y = 272, 160
@help_window = Window_HelpStatus.new(@reserve_window.getactor(0), @scene)
@help_window.x = 240 + 32
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
[@current_window, @reserve_window, @help_window].each {|win| win.dispose}
$game_party.actors.compact!
$all_available = nil
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
@help_window.refresh(actor) if ['', 'Current'].include?(@temp_window)
end
current_update if @current_window.active
if Input.trigger?(Input::B)
if @scene_flag
$game_system.se_play($data_system.cancel_se)
@scene_flag, @temp_window = false, ''
if @reserve_window.active
actor = @reserve_window.getactor(@reserve_window.index)
elsif @current_window.active
actor = @reserve_window.getactor(@reserve_window_temp)
end
@help_window.refresh(actor) if ['', 'Current'].include?(@temp_window)
[@current_window, @reserve_window].each {|win| win.refresh}
return
end
if $game_party.forced_size != nil &&
($game_party.forced_size < $game_party.actors.nitems ||
($game_party.forced_size > $game_party.actors.nitems &&
@reserve_window.get_number != 0))
$game_system.se_play($data_system.buzzer_se)
warning(true)
return
end
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
elsif Input.trigger?(Input::A)
if $game_party.any_forced_position
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.decision_se)
$game_party.actors.compact!
@current_window.refresh
end
end
end
def current_update
@current_window.update
if Input.trigger?(Input::C)
actor = @current_window.getactor(@current_window.index)
if actor != nil && actor.forced_position != nil
$game_system.se_play($data_system.buzzer_se)
else
if @scene_flag
switch_members
else
$game_system.se_play($data_system.decision_se)
@scene_flag, @temp_window = true, 'Current'
@temp_actor_index = @current_window.index
@current_window.clone_cursor
end
end
elsif Input.trigger?(Input::RIGHT)
if @scene == Scene_Map && $game_system.order_only ||
@scene == Scene_Battle && $game_system.battle_order_only
$game_system.se_play($data_system.buzzer_se)
else
$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
@help_window.refresh(actor) unless @scene_flag
end
end
end
def reserve_update
if Input.trigger?(Input::C)
if @scene_flag
switch_members
else
$game_system.se_play($data_system.decision_se)
@scene_flag, @temp_window = true, 'Reserve'
@temp_actor_index = @reserve_window.index
@reserve_window.clone_cursor
end
elsif @reserve_window.index % 3 == 0 && 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
end
def switch_members
if @temp_window == 'Reserve' && @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' && @current_window.active
@current_window.setactor(@temp_actor_index, @current_window.index)
end
if @temp_window == 'Reserve' && @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 && actor1.must_be_in_party
$game_system.se_play($data_system.buzzer_se)
@scene_flag, @temp_window = false, ''
actor = @reserve_window.getactor(@reserve_window_temp)
[@current_window, @reserve_window].each {|win| win.refresh}
@help_window.refresh(actor)
return
end
if actor2 != nil && actor2.not_available && !$all_available
$game_system.se_play($data_system.buzzer_se)
@scene_flag, @temp_window = false, ''
actor = @reserve_window.getactor(@reserve_window_temp)
[@current_window, @reserve_window].each {|win| win.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' && @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 && actor1.must_be_in_party
$game_system.se_play($data_system.buzzer_se)
@scene_flag, @temp_window = false, ''
actor = @reserve_window.getactor(@reserve_window.index)
[@current_window, @reserve_window].each {|win| win.refresh}
@help_window.refresh(actor)
return
end
if actor2 != nil && actor2.not_available && !$all_available
$game_system.se_play($data_system.buzzer_se)
@scene_flag, @temp_window = false, ''
actor = @reserve_window.getactor(@reserve_window.index)
[@current_window, @reserve_window].each {|win| win.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)
@scene_flag, @temp_window = false, ''
end
def wipe_party
$game_party.actors.each {|actor| actor.not_available = true if actor != nil}
setup_forced_party(true)
if $game_party.actors == []
(1...$data_actors.size).each {|i|
unless $game_actors[i].not_available ||
$game_actors[i].disabled_for_party
$game_party.actors.push($game_actors[i])
return
end}
end
end
def setup_forced_party(flag = false)
$game_party.actors, party = [], []
(1...$data_actors.size).each {|i|
if $game_actors[i] != nil && $game_actors[i].must_be_in_party &&
(!$game_actors[i].disabled_for_party || flag) &&
!$game_actors[i].not_available
party.push($game_actors[i])
end}
party.clone.each {|actor|
if actor.forced_position != nil
$game_party.actors[actor.forced_position] = actor
party.delete(actor)
end}
$game_party.actors.each_index {|i|
$game_party.actors[i] = party.shift if $game_party.actors[i] == nil}
$game_party.actors += party.compact
end
def swap_parties
$game_party.actors.compact!
temp_actors = $game_party.actors
temp_actors.each {|actor| actor.not_available = true}
$game_system.stored_party.compact!
$game_system.stored_party.each {|actor| actor.not_available = false}
$game_party.actors = $game_system.stored_party
$game_system.stored_party = (@store == 1 ? temp_actors : nil)
end
def call_warning?(index, actor2)
return (BlizzCFG::ALLOW_EMPTY_PARTY || $game_party.actors[index] == nil ||
actor2 != nil || $game_party.actors.nitems > 1)
end
def warning(flag = false)
$game_system.se_play($data_system.buzzer_se)
@warning_window = Window_Warning.new(flag, @reserve_window.get_number)
loop do
Graphics.update
Input.update
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se) if flag
[@current_window, @reserve_window].each {|win| win.refresh}
@warning_window.dispose
@warning_window = nil
break
$game_temp.common_event_id = 11
end
end
end
end
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle
alias update_phase2_eps_later update_phase2
def update_phase2
update_phase2_eps_later
if Input.trigger?(Input::C) && @party_command_window.index == 2
$game_system.se_play($data_system.decision_se)
@spriteset.dispose
$scene = Scene_PartySwitcher.new
$scene.main
$scene = self
@spriteset = Spriteset_Battle.new
15.times {@spriteset.update}
@status_window.refresh
Graphics.transition(0)
end
end
alias start_phase5_eps_later start_phase5
def start_phase5
start_phase5_eps_later
(1...$data_actors.size).each {|i|
unless $game_party.actors.include?($game_actors[i])
if $game_actors[i].not_available
$game_actors[i].exp += @result_window.exp * BlizzCFG::EXP_NOT_AVAILABLE/100
elsif $game_actors[i].disabled_for_party
$game_actors[i].exp += @result_window.exp * BlizzCFG::EXP_DISABLED_FOR_PARTY/100
else
$game_actors[i].exp += @result_window.exp * BlizzCFG::EXP_RESERVE/100
end
end}
end
end
if BlizzCFG::BATTLE_SWITCH
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# EPS Battle Switch Mod by Blizzard
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle
alias start_phase1_esp_mod_later start_phase1
def start_phase1
start_phase1_esp_mod_later
@switch_pos = @actor_command_window.commands.size
@actor_command_window.add_command('Pokemon')
end
alias update_phase3_basic_command_eps_mod_later update_phase3_basic_command
def update_phase3_basic_command
update_phase3_basic_command_eps_mod_later
if Input.trigger?(Input::C) && @actor_command_window.index == @switch_pos
$game_system.se_play($data_system.decision_se)
@spriteset.dispose
$scene = Scene_PartySwitcher.new
$scene.main
$scene = self
@spriteset = Spriteset_Battle.new
15.times {@spriteset.update}
@status_window.refresh
@active_battler.blink = false if @active_battler != nil
@actor_index = 0
start_phase3
@actor_command_window.index = @switch_pos
Graphics.transition(10)
end
end
end
end
The main problem I have is, if you enter more than 1 of the same actor, even if they have different moves/level/stats, anything, the first one dissapares, I would like it to keep the actor no matter how many copies there are.
The second is more of an edit which is not really needed so please don't spend too much time on it, I asked for an edit so you could switch in battle but not get the pokemon from the pc while in battle, just move around the pokemon that are in your party, but at this time, it still shows the pc, just dimmed out, I was wondering if you could just expand the party box to cover that when accessing it in battle?
Thanks to all that help.
Quote from: jcsnider on April 23, 2009, 05:33:52 pm
Lol, yes there is, but, it is not compatible with netplay which I want more than the extra features of the starter kit so this is one of my only options.