I'm using this script to bring up a party changer menu.
It works wonderfully. The problem is this: I want Hero 1 to always be first. This is due to text that wouldnt make sense (eg Hero 2 is in front, but Hero 1's lines are said) and a caterpillar script, which I'd like Hero 1 to lead.
So, is there a way to completely disable the "Arrange" feature on this Party Changer? I have no use for it. That, or make it so that Hero 1 can NOT be placed anywhere else but first.
Thanks for the help in advance!
#==============================================================================
# ** Party Changer
#------------------------------------------------------------------------------
# Author: Dargor
# Version 2.2.6
# 25/06/2007
#==============================================================================
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# Refer to "$game_temp" for the instance of this class.
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
# To call the menu: $scene = Scene_Party.new(max_members, [forced members])
#--------------------------------------------------------------------------
attr_accessor :selected_members # selected members
attr_accessor :party_members # party members
attr_accessor :members_gain_exp # members can gain exp
attr_accessor :members_exp_rate # exp % gained
attr_accessor :party_changer_in_battle # party changer in battle
attr_accessor :battle_party_args # in-battle party changer args
attr_accessor :menu_party_args # in-menu party changer args
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias party_changer_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@selected_members = []
@party_members = []
@members_gain_exp = true
@members_exp_rate = 40
@party_changer_in_battle = false
@battle_party_args = [4,[],false]
@menu_party_args = [9,[],false]
party_changer_initialize
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base
#--------------------------------------------------------------------------
# * Draw Graphic
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_graphic(actor, x, y, selected = false)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
src_rect = Rect.new(0, 0, cw, ch)
opacity = selected ? 160 : 255
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect,opacity)
end
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :position # position
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias party_changer_setup setup
#--------------------------------------------------------------------------
# * Setup (actor_id)
#--------------------------------------------------------------------------
def setup(actor_id)
party_changer_setup(actor_id)
actor = $data_actors[actor_id]
@position = $data_classes[actor.class_id].position
end
end
#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
# This window deals with general command choices.
#==============================================================================
class Window_Command
#--------------------------------------------------------------------------
# * Enable Item
# index : item number
#--------------------------------------------------------------------------
def enable_item(index)
draw_item(index, normal_color)
end
end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles the party. It includes information on amount of gold
# and items. Refer to "$game_party" for the instance of this class.
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :members # members
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias party_changer_initialize initialize
alias party_changer_refresh refresh
alias party_changer_add_actor add_actor
alias party_changer_remove_actor remove_actor
alias party_changer_setup_starting_members setup_starting_members
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
party_changer_initialize
@members = []
end
#--------------------------------------------------------------------------
# * Initial Party Setup
#--------------------------------------------------------------------------
def setup_starting_members
party_changer_setup_starting_members
for i in $data_system.party_members
actor = $game_actors
if not @members.include?(actor)
@members.push(actor)
end
end
end
#--------------------------------------------------------------------------
# * Refresh Party Members
#--------------------------------------------------------------------------
def refresh
# Actor objects split from $game_actors right after loading game data
# Avoid this problem by resetting the actors each time data is loaded.
party_changer_refresh
new_members = []
for i in 0...@members.size
if $data_actors[@members.id] != nil
new_members.push($game_actors[@members.id])
end
end
@members = new_members
end
#--------------------------------------------------------------------------
# * Add Actor
# actor_id : actor ID
#--------------------------------------------------------------------------
def add_actor(actor_id)
party_changer_add_actor(actor_id)
add_member(actor_id)
end
#--------------------------------------------------------------------------
# * Remove Actor
# actor_id : actor ID
#--------------------------------------------------------------------------
def remove_actor(actor_id)
party_changer_remove_actor(actor_id)
remove_member(actor_id)
end
#--------------------------------------------------------------------------
# * Add a Member
# actor_id : actor ID
#--------------------------------------------------------------------------
def add_member(actor_id)
# Get actor
actor = $game_actors[actor_id]
# If this actor is not in the party
if not @members.include?(actor)
# Add member
@members.push(actor)
# Refresh player
$game_player.refresh
end
end
#--------------------------------------------------------------------------
# * Remove Member
# actor_id : actor ID
#--------------------------------------------------------------------------
def remove_member(actor_id)
# Delete member
@members.delete($game_actors[actor_id])
# Refresh player
$game_player.refresh
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Actor Position
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_position(actor, x, y)
position = actor.position
case position
when 0
text = 'Front'
when 1
text = 'Middle'
when 2
text = 'Rear'
end
cx = contents.text_size(text).width
self.contents.draw_text(x,y,cx,32,text)
end
end
#==============================================================================
# ** Window_MemberStatus
#------------------------------------------------------------------------------
# This window displays a member's status on the party screen.
#==============================================================================
class Window_MemberStatus < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :actor # actor
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 64, 640, 160)
self.contents = Bitmap.new(width - 32, height - 32)
if $game_temp.in_battle
self.back_opacity = 160
end
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(current = 1, max = 1)
self.contents.clear
draw_actor_name(@actor, 0, 0)
draw_actor_class(@actor, 144, 0)
draw_actor_position(@actor, 300, 0)
draw_actor_level(@actor, 0, 32)
draw_actor_state(@actor, 90, 32)
draw_actor_exp(@actor, 0, 64)
draw_actor_hp(@actor, 236, 32)
draw_actor_sp(@actor, 236, 64)
draw_actor_parameter(@actor, 396, 0, 0)
draw_actor_parameter(@actor, 396, 32, 1)
draw_actor_parameter(@actor, 396, 64, 2)
if $game_temp.selected_members.include?(@actor)
self.contents.draw_text(0,96,640,32,"- #{@actor.name} is already in the party")
else
self.contents.draw_text(0,96,640,32,"- #{@actor.name} is available")
end
self.contents.draw_text(480,96,160,32,"Page #{current} of #{max}")
end
end
#==============================================================================
# ** Window_PartyMembers
#------------------------------------------------------------------------------
# This window displays the party members on the party screen.
#==============================================================================
class Window_PartyMembers < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :members # members
attr_accessor :selected_members # selected members
attr_accessor :forced_members # forced members
#--------------------------------------------------------------------------
# * Oject Initialization
#--------------------------------------------------------------------------
def initialize(forced_members=[])
@members = $game_party.members
height = 78 + (@members.size/4) * 50
super(0,224,640,height)
self.contents = Bitmap.new(width - 32, height - 32)
self.active = true
if $game_temp.in_battle
self.back_opacity = 160
end
@index = 0
@item_max = @members.size
@column_max = 4
@row_max = @members.size / 4
@selected_members = []
@forced_members = forced_members
reset
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@members.size
x = (i % 4) * 160
y = (i/4) * 50
actor = @members
selected = @selected_members
# A1
draw_actor_graphic($game_actors[actor.id], x+60, y+48, selected)
end
end
#--------------------------------------------------------------------------
# * Reset
#--------------------------------------------------------------------------
def reset
for i in 0...@members.size
@selected_members = false
if @forced_members.include?(@members)
@selected_members = true
end
end
refresh
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
self.oy = (@index/8) * 100
x = (@index % 4) * 160
y = ((@index/4)% 2) * 50
self.cursor_rect.set(x, y, 128, 50)
end
end
#==============================================================================
# ** Window_Party
#------------------------------------------------------------------------------
# This window displays the current party on the party screen.
#==============================================================================
class Window_Party < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :item_max # item max
attr_accessor :members # members
attr_accessor :forced_members # forces members
attr_accessor :selected_members # selected members
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(forced_members=[])
super(0,352,320,128)
self.contents = Bitmap.new(width - 32, height - 32)
self.active = false
@index = 0
@column_max = 2
@row_max = 2
@members = []
@forced_members = forced_members
@selected_members = []
@item_max = @members.size
reset_selection
reset_members
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
height = 128 + ((@members.size-1)/4) * 100
self.contents = Bitmap.new(width - 32, height - 32)
self.height = 128
for i in 0...@members.size
x = (i % 2) * 160
y = (i/2) * 50
actor = @members
opacity = @selected_members
# A2
draw_actor_graphic($game_actors[actor.id], x+60, y+48,opacity)
end
end
#--------------------------------------------------------------------------
# * Reset Selection
#--------------------------------------------------------------------------
def reset_selection
for i in 0...@members.size
@selected_members = false
end
refresh
end
#--------------------------------------------------------------------------
# * Reset Members
#--------------------------------------------------------------------------
def reset_members
@members = []
@forced_members.each do |member|
@members << member
end
refresh
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
return unless self.active
self.oy = (@index/4) * 100
x = (@index % 2) * 160
y = ((@index/2)% 2) * 50
self.cursor_rect.set(x, y, 128, 50)
end
end
#==============================================================================
# ** Window_PartyCommand
#------------------------------------------------------------------------------
# This window is used to select whether to fight or escape on the battle
# screen.
#==============================================================================
class Window_PartyCommand < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
if $game_temp.party_changer_in_battle
@commands = ["Fight", "Escape", "Party"]
@item_max = 3
@column_max = 3
else
@commands = ["Fight", "Escape"]
@item_max = 2
@column_max = 2
end
# Draw Fight and Escape
draw_item(0, normal_color)
draw_item(1, $game_temp.battle_can_escape ? normal_color : disabled_color)
# Draw Party if $game_temp.party_changer_in_battle is true
draw_item(2, normal_color) if $game_temp.party_changer_in_battle
self.active = false
self.visible = false
self.index = 0
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text character color
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
if $game_temp.party_changer_in_battle
rect = Rect.new(106 + index * 106 + 4, 0, 128 - 10, 32)
else
rect = Rect.new(160 + index * 160 + 4, 0, 128 - 10, 32)
end
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if $game_temp.party_changer_in_battle
self.cursor_rect.set(106 + index * 106, 0, 128, 32)
else
self.cursor_rect.set(160 + index * 160, 0, 128, 32)
end
end
end
#==============================================================================
# ** Scene_Battle (part 2)
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias party_changer_update_phase2 update_phase2
alias party_changer_start_phase5 start_phase5
alias party_changer_update update
#--------------------------------------------------------------------------
# * Frame Update (party command phase)
#--------------------------------------------------------------------------
def update_phase2
party_changer_update_phase2
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by party command window cursor position
case @party_command_window.index
when 2 # escape
# If it's not possible to escape
if $game_temp.party_changer_in_battle == false
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Escape processing
start_party_changer
end
return
end
end
#--------------------------------------------------------------------------
# * Start After Battle Phase
#--------------------------------------------------------------------------
def start_phase5
party_changer_start_phase5
exp = 0
# Loop
for enemy in $game_troop.enemies
# If enemy is not hidden
unless enemy.hidden
# Add EXP obtained
exp += enemy.exp
end
end
# Obtaining EXP
for i in 0...$game_party.members.size
return if $game_temp.members_gain_exp == false
member = $game_party.members
next if $game_party.actors.include?(member)
if member.cant_get_exp? == false
member.exp += (exp/100) * $game_temp.members_exp_rate
end
end
end
#--------------------------------------------------------------------------
# * Start Party Changer Phase
#--------------------------------------------------------------------------
def start_party_changer
# Get actor
@actor = $game_party.members[0]
@max_actors = $game_temp.battle_party_args[0]
@forced_members = []
forced_members = $game_temp.battle_party_args[1]
for i in 0...$game_temp.battle_party_args[1].size
@forced_members << $game_actors[$game_temp.battle_party_args[1]]
end
@lock_leader = $game_temp.battle_party_args[2]
# Make windows
@party_status_window = Window_MemberStatus.new(@actor)
@members_window = Window_PartyMembers.new(@forced_members)
page_id = ((@members_window.index/8)+1).round
max_page = (@members_window.members.size.to_f/8.0)
max_page = 1 if max_page == 0
@party_status_window.refresh(page_id, max_page.ceil)
# Defined the height to make the window scroll
@members_window.height = 128
@party_window = Window_Party.new(@forced_members)
@party_command_window2 = Window_Command.new(320,['Reset','Confirm','Arrange'])
@party_command_window2.x = 320
@party_command_window2.y = 352
# Hide @status_window contents
@status_window.hide_battlers = true
for i in @spriteset.actor_sprites
i.visible = false
end
@members_window.active = true
@party_command_window.active = false
@party_command_window.visible = false
# Shift phase
@phase = 6
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Original method
party_changer_update
case @phase
when 6
update_party_changer
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (Party Changer)
#--------------------------------------------------------------------------
def update_party_changer
@party_window.update
@members_window.update
@party_command_window2.update
$game_temp.selected_members = @party_window.members.dup
if @party_window.members.size == 0
@party_command_window2.disable_item(1)
@party_command_window2.disable_item(2)
else
@party_command_window2.enable_item(1)
@party_command_window2.enable_item(2)
end
if @party_command_window2.active
update_party_changer_command
end
if @party_window.active
update_party
end
if @members_window.active
update_members
end
end
#--------------------------------------------------------------------------
# * Frame Update (if party changer's command window is active)
#--------------------------------------------------------------------------
def update_party_changer_command
@party_window.cursor_rect.empty
case @party_command_window2.index
when 0
@help_window.set_text('Reset party members')
when 1
@help_window.set_text('Confirm party selection')
when 2
@help_window.set_text('Arrange party members')
end
if Input.trigger?(Input::C)
case @party_command_window2.index
when 0
@members_window.reset
@party_window.reset_selection
@party_window.reset_members
@party_command_window2.active = false
@members_window.active = true
$game_temp.selected_members.clear
@reset = true
return
when 1
if @party_window.members.size == 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
$game_party.actors.clear
@party_window.members.each do |actor|
$game_party.add_actor(actor.id)
end
@members_window.active = false
@party_command_window2.active = false
@party_status_window.active = false
@party_window.active = false
@members_window.visible = false
@party_command_window2.visible = false
@party_status_window.visible = false
@party_window.visible = false
@party_command_window.visible = true
@party_command_window.active = true
for i in @spriteset.actor_sprites
i.visible = true
end
@help_window.visible = false
@status_window.refresh
@status_window.hide_battlers = false
@phase = 2
return
when 2
if @party_window.members.size == 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
@party_command_window2.active = false
@party_window.active = true
@party_window.index = 0
@reset = true
return
end
end
end
#--------------------------------------------------------------------------
# * Frame Update (if party window is active)
#--------------------------------------------------------------------------
def update_party
@party_window.item_max = @party_window.members.size
if @reset
@reset = false
return
end
if Input.trigger?(Input::B)
@party_command_window2.active = true
@party_window.active = false
@party_window.index = -3
@change1 = nil
@change2 = nil
@party_window.reset_selection
return
end
@help_window.set_text('Change members position')
if @party_status_window.actor != @party_window.members[@party_window.index]
@party_status_window.actor = @party_window.members[@party_window.index]
@party_status_window.refresh
end
if Input.trigger?(Input::C) and @change1 == nil
if @lock_leader and @party_window.index == 0
$game_system.se_play($data_system.buzzer_se)
return
end
@change1 = @party_window.members[@party_window.index]
@old_index = @party_window.index
@party_window.selected_members[@party_window.index] = true
@party_window.refresh
elsif Input.trigger?(Input::C) and @change1 != nil
if @lock_leader and @party_window.index == 0
$game_system.se_play($data_system.buzzer_se)
return
end
@change2 = @party_window.members[@party_window.index]
@party_window.members[@party_window.index] = @change1
@party_window.members[@old_index] = @change2
@change1 = nil
@change2 = nil
@party_window.reset_selection
end
end
#--------------------------------------------------------------------------
# * Frame Update (party members)
#--------------------------------------------------------------------------
def update_members
@party_window.cursor_rect.empty
if @reset
@reset = false
return
end
@help_window.set_text('Form your party')
if @party_status_window.actor != @members_window.members[@members_window.index]
@party_status_window.actor = @members_window.members[@members_window.index]
page_id = ((@members_window.index/8)+1).round
max_page = (@members_window.members.size.to_f/8.0)
max_page = 1 if max_page == 0
@party_status_window.refresh(page_id, max_page.ceil)
end
if @party_window.members.size == @max_actors
@party_command_window2.active = true
@members_window.active = false
return
end
if Input.trigger?(Input::B)
@party_command_window2.active = true
@members_window.active = false
return
end
if Input.trigger?(Input::C)
if @party_window.members.size < @max_actors and
not @party_window.members.include?(@members_window.members[@members_window.index])
@members_window.selected_members[@members_window.index] = true
@members_window.refresh
@party_status_window.refresh
@party_window.members.push(@members_window.members[@members_window.index])
@party_window.refresh
return
end
end
end
end
#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
# This window displays the status of all party members on the battle screen.
#==============================================================================
class Window_BattleStatus < Window_Base
attr_accessor :hide_battlers
alias hide_battlers_initialize initialize
def initialize
@hide_battlers = false
hide_battlers_initialize
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if @hide_battlers
self.contents_opacity = 0
return
end
# Slightly lower opacity level during main phase
if $game_temp.battle_main_phase
self.contents_opacity -= 4 if self.contents_opacity > 191
else
self.contents_opacity += 4 if self.contents_opacity < 255
end
end
end
#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
# This class brings together battle screen sprites. It's used within
# the Scene_Battle class.
#==============================================================================
class Spriteset_Battle
attr_accessor :actor_sprites
end
#==============================================================================
# ** Scene_Party
#------------------------------------------------------------------------------
# This class performs party menu screen processing.
#==============================================================================
class Scene_Party
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : command cursor's initial position
# forced_members : members forced to be in the party
#--------------------------------------------------------------------------
def initialize(max_actors = 4, forced_members = [], lock_leader = false, from_menu=false)
@max_actors = max_actors
@forced_members = []
@lock_leader = lock_leader
@from_menu = from_menu
forced_members.each do |member|
$game_party.add_member(member)
@forced_members << $game_actors[member]
end
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Get actor
@actor = $game_party.members[0]
# Make help window, status window, and skill window
@help_window = Window_Help.new
@status_window = Window_MemberStatus.new(@actor)
@members_window = Window_PartyMembers.new(@forced_members)
page_id = ((@members_window.index/8)+1).round
max_page = (@members_window.members.size.to_f/8.0)
max_page = 1 if max_page == 0
@status_window.refresh(page_id, max_page.ceil)
# Defined the height to make the window scroll
@members_window.height = 128
@party_window = Window_Party.new(@forced_members)
@command_window = Window_Command.new(320,['Reset','Confirm','Arrange'])
@command_window.x = 320
@command_window.y = 352
@command_window.active = false
@reset = false
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@help_window.dispose
@status_window.dispose
@party_window.dispose
@members_window.dispose
@command_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@party_window.update
@members_window.update
@command_window.update
$game_temp.selected_members = @party_window.members.dup
if @party_window.members.size == 0
@command_window.disable_item(1)
@command_window.disable_item(2)
else
@command_window.enable_item(1)
@command_window.enable_item(2)
end
if @command_window.active
update_command
end
if @party_window.active
update_party
end
if @members_window.active
update_members
end
end
#--------------------------------------------------------------------------
# * Frame Update (if command window is active)
#--------------------------------------------------------------------------
def update_command
@party_window.cursor_rect.empty
case @command_window.index
when 0
@help_window.set_text('Reset party members')
when 1
@help_window.set_text('Confirm party selection')
when 2
@help_window.set_text('Arrange party members')
end
if Input.trigger?(Input::C)
case @command_window.index
when 0
@members_window.reset
@party_window.reset_selection
@party_window.reset_members
@command_window.active = false
@members_window.active = true
$game_temp.selected_members.clear
@reset = true
return
when 1
if @party_window.members.size == 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
$game_party.actors.clear
@party_window.members.each do |actor|
$game_party.add_actor(actor.id)
end
if @from_menu
$scene = Scene_Menu.new
else
$scene = Scene_Map.new
end
return
when 2
if @party_window.members.size == 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
@command_window.active = false
@party_window.active = true
@party_window.index = 0
@reset = true
return
end
end
end
#--------------------------------------------------------------------------
# * Frame Update (if party window is active)
#--------------------------------------------------------------------------
def update_party
@party_window.item_max = @party_window.members.size
if @reset
@reset = false
return
end
if Input.trigger?(Input::B)
@command_window.active = true
@party_window.active = false
@party_window.index = -1
@party_window.oy = 0
@change1 = nil
@change2 = nil
@party_window.reset_selection
return
end
@help_window.set_text('Change members position')
if @status_window.actor != @party_window.members[@party_window.index]
@status_window.actor = @party_window.members[@party_window.index]
@status_window.refresh
end
if Input.trigger?(Input::C) and @change1 == nil
if @lock_leader and @party_window.index == 0
$game_system.se_play($data_system.buzzer_se)
return
end
@change1 = @party_window.members[@party_window.index]
@old_index = @party_window.index
@party_window.selected_members[@party_window.index] = true
@party_window.refresh
elsif Input.trigger?(Input::C) and @change1 != nil
if @lock_leader and @party_window.index == 0
$game_system.se_play($data_system.buzzer_se)
return
end
@change2 = @party_window.members[@party_window.index]
@party_window.members[@party_window.index] = @change1
@party_window.members[@old_index] = @change2
@change1 = nil
@change2 = nil
@party_window.reset_selection
end
end
#--------------------------------------------------------------------------
# * Frame Update (party members)
#--------------------------------------------------------------------------
def update_members
@party_window.cursor_rect.empty
if @reset
@reset = false
return
end
@help_window.set_text('Form your party')
if @status_window.actor != @members_window.members[@members_window.index]
@status_window.actor = @members_window.members[@members_window.index]
page_id = ((@members_window.index/8)+1).round
max_page = (@members_window.members.size.to_f/8.0)
max_page = 1 if max_page == 0
@status_window.refresh(page_id, max_page.ceil)
end
if @party_window.members.size == @max_actors
@command_window.active = true
@members_window.active = false
return
end
if Input.trigger?(Input::B)
@command_window.active = true
@members_window.active = false
return
end
if Input.trigger?(Input::C)
if @party_window.members.size < @max_actors and
not @party_window.members.include?(@members_window.members[@members_window.index])
@members_window.selected_members[@members_window.index] = true
@members_window.refresh
@status_window.refresh
@party_window.members.push(@members_window.members[@members_window.index])
@party_window.refresh
return
end
end
end
end
# ** Party Changer
#------------------------------------------------------------------------------
# Author: Dargor
# Version 2.2.6
# 25/06/2007
#==============================================================================
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# Refer to "$game_temp" for the instance of this class.
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
# To call the menu: $scene = Scene_Party.new(max_members, [forced members])
#--------------------------------------------------------------------------
attr_accessor :selected_members # selected members
attr_accessor :party_members # party members
attr_accessor :members_gain_exp # members can gain exp
attr_accessor :members_exp_rate # exp % gained
attr_accessor :party_changer_in_battle # party changer in battle
attr_accessor :battle_party_args # in-battle party changer args
attr_accessor :menu_party_args # in-menu party changer args
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias party_changer_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@selected_members = []
@party_members = []
@members_gain_exp = true
@members_exp_rate = 40
@party_changer_in_battle = false
@battle_party_args = [4,[],false]
@menu_party_args = [9,[],false]
party_changer_initialize
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base
#--------------------------------------------------------------------------
# * Draw Graphic
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_graphic(actor, x, y, selected = false)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
src_rect = Rect.new(0, 0, cw, ch)
opacity = selected ? 160 : 255
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect,opacity)
end
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :position # position
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias party_changer_setup setup
#--------------------------------------------------------------------------
# * Setup (actor_id)
#--------------------------------------------------------------------------
def setup(actor_id)
party_changer_setup(actor_id)
actor = $data_actors[actor_id]
@position = $data_classes[actor.class_id].position
end
end
#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
# This window deals with general command choices.
#==============================================================================
class Window_Command
#--------------------------------------------------------------------------
# * Enable Item
# index : item number
#--------------------------------------------------------------------------
def enable_item(index)
draw_item(index, normal_color)
end
end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles the party. It includes information on amount of gold
# and items. Refer to "$game_party" for the instance of this class.
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :members # members
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias party_changer_initialize initialize
alias party_changer_refresh refresh
alias party_changer_add_actor add_actor
alias party_changer_remove_actor remove_actor
alias party_changer_setup_starting_members setup_starting_members
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
party_changer_initialize
@members = []
end
#--------------------------------------------------------------------------
# * Initial Party Setup
#--------------------------------------------------------------------------
def setup_starting_members
party_changer_setup_starting_members
for i in $data_system.party_members
actor = $game_actors
if not @members.include?(actor)
@members.push(actor)
end
end
end
#--------------------------------------------------------------------------
# * Refresh Party Members
#--------------------------------------------------------------------------
def refresh
# Actor objects split from $game_actors right after loading game data
# Avoid this problem by resetting the actors each time data is loaded.
party_changer_refresh
new_members = []
for i in 0...@members.size
if $data_actors[@members.id] != nil
new_members.push($game_actors[@members.id])
end
end
@members = new_members
end
#--------------------------------------------------------------------------
# * Add Actor
# actor_id : actor ID
#--------------------------------------------------------------------------
def add_actor(actor_id)
party_changer_add_actor(actor_id)
add_member(actor_id)
end
#--------------------------------------------------------------------------
# * Remove Actor
# actor_id : actor ID
#--------------------------------------------------------------------------
def remove_actor(actor_id)
party_changer_remove_actor(actor_id)
remove_member(actor_id)
end
#--------------------------------------------------------------------------
# * Add a Member
# actor_id : actor ID
#--------------------------------------------------------------------------
def add_member(actor_id)
# Get actor
actor = $game_actors[actor_id]
# If this actor is not in the party
if not @members.include?(actor)
# Add member
@members.push(actor)
# Refresh player
$game_player.refresh
end
end
#--------------------------------------------------------------------------
# * Remove Member
# actor_id : actor ID
#--------------------------------------------------------------------------
def remove_member(actor_id)
# Delete member
@members.delete($game_actors[actor_id])
# Refresh player
$game_player.refresh
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Actor Position
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_position(actor, x, y)
position = actor.position
case position
when 0
text = 'Front'
when 1
text = 'Middle'
when 2
text = 'Rear'
end
cx = contents.text_size(text).width
self.contents.draw_text(x,y,cx,32,text)
end
end
#==============================================================================
# ** Window_MemberStatus
#------------------------------------------------------------------------------
# This window displays a member's status on the party screen.
#==============================================================================
class Window_MemberStatus < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :actor # actor
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 64, 640, 160)
self.contents = Bitmap.new(width - 32, height - 32)
if $game_temp.in_battle
self.back_opacity = 160
end
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(current = 1, max = 1)
self.contents.clear
draw_actor_name(@actor, 0, 0)
draw_actor_class(@actor, 144, 0)
draw_actor_position(@actor, 300, 0)
draw_actor_level(@actor, 0, 32)
draw_actor_state(@actor, 90, 32)
draw_actor_exp(@actor, 0, 64)
draw_actor_hp(@actor, 236, 32)
draw_actor_sp(@actor, 236, 64)
draw_actor_parameter(@actor, 396, 0, 0)
draw_actor_parameter(@actor, 396, 32, 1)
draw_actor_parameter(@actor, 396, 64, 2)
if $game_temp.selected_members.include?(@actor)
self.contents.draw_text(0,96,640,32,"- #{@actor.name} is already in the party")
else
self.contents.draw_text(0,96,640,32,"- #{@actor.name} is available")
end
self.contents.draw_text(480,96,160,32,"Page #{current} of #{max}")
end
end
#==============================================================================
# ** Window_PartyMembers
#------------------------------------------------------------------------------
# This window displays the party members on the party screen.
#==============================================================================
class Window_PartyMembers < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :members # members
attr_accessor :selected_members # selected members
attr_accessor :forced_members # forced members
#--------------------------------------------------------------------------
# * Oject Initialization
#--------------------------------------------------------------------------
def initialize(forced_members=[])
@members = $game_party.members
height = 78 + (@members.size/4) * 50
super(0,224,640,height)
self.contents = Bitmap.new(width - 32, height - 32)
self.active = true
if $game_temp.in_battle
self.back_opacity = 160
end
@index = 0
@item_max = @members.size
@column_max = 4
@row_max = @members.size / 4
@selected_members = []
@forced_members = forced_members
reset
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@members.size
x = (i % 4) * 160
y = (i/4) * 50
actor = @members
selected = @selected_members
# A1
draw_actor_graphic($game_actors[actor.id], x+60, y+48, selected)
end
end
#--------------------------------------------------------------------------
# * Reset
#--------------------------------------------------------------------------
def reset
for i in 0...@members.size
@selected_members = false
if @forced_members.include?(@members)
@selected_members = true
end
end
refresh
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
self.oy = (@index/8) * 100
x = (@index % 4) * 160
y = ((@index/4)% 2) * 50
self.cursor_rect.set(x, y, 128, 50)
end
end
#==============================================================================
# ** Window_Party
#------------------------------------------------------------------------------
# This window displays the current party on the party screen.
#==============================================================================
class Window_Party < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :item_max # item max
attr_accessor :members # members
attr_accessor :forced_members # forces members
attr_accessor :selected_members # selected members
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(forced_members=[])
super(0,352,320,128)
self.contents = Bitmap.new(width - 32, height - 32)
self.active = false
@index = 0
@column_max = 2
@row_max = 2
@members = []
@forced_members = forced_members
@selected_members = []
@item_max = @members.size
reset_selection
reset_members
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
height = 128 + ((@members.size-1)/4) * 100
self.contents = Bitmap.new(width - 32, height - 32)
self.height = 128
for i in 0...@members.size
x = (i % 2) * 160
y = (i/2) * 50
actor = @members
opacity = @selected_members
# A2
draw_actor_graphic($game_actors[actor.id], x+60, y+48,opacity)
end
end
#--------------------------------------------------------------------------
# * Reset Selection
#--------------------------------------------------------------------------
def reset_selection
for i in 0...@members.size
@selected_members = false
end
refresh
end
#--------------------------------------------------------------------------
# * Reset Members
#--------------------------------------------------------------------------
def reset_members
@members = []
@forced_members.each do |member|
@members << member
end
refresh
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
return unless self.active
self.oy = (@index/4) * 100
x = (@index % 2) * 160
y = ((@index/2)% 2) * 50
self.cursor_rect.set(x, y, 128, 50)
end
end
#==============================================================================
# ** Window_PartyCommand
#------------------------------------------------------------------------------
# This window is used to select whether to fight or escape on the battle
# screen.
#==============================================================================
class Window_PartyCommand < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
if $game_temp.party_changer_in_battle
@commands = ["Fight", "Escape", "Party"]
@item_max = 3
@column_max = 3
else
@commands = ["Fight", "Escape"]
@item_max = 2
@column_max = 2
end
# Draw Fight and Escape
draw_item(0, normal_color)
draw_item(1, $game_temp.battle_can_escape ? normal_color : disabled_color)
# Draw Party if $game_temp.party_changer_in_battle is true
draw_item(2, normal_color) if $game_temp.party_changer_in_battle
self.active = false
self.visible = false
self.index = 0
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text character color
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
if $game_temp.party_changer_in_battle
rect = Rect.new(106 + index * 106 + 4, 0, 128 - 10, 32)
else
rect = Rect.new(160 + index * 160 + 4, 0, 128 - 10, 32)
end
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if $game_temp.party_changer_in_battle
self.cursor_rect.set(106 + index * 106, 0, 128, 32)
else
self.cursor_rect.set(160 + index * 160, 0, 128, 32)
end
end
end
#==============================================================================
# ** Scene_Battle (part 2)
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias party_changer_update_phase2 update_phase2
alias party_changer_start_phase5 start_phase5
alias party_changer_update update
#--------------------------------------------------------------------------
# * Frame Update (party command phase)
#--------------------------------------------------------------------------
def update_phase2
party_changer_update_phase2
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by party command window cursor position
case @party_command_window.index
when 2 # escape
# If it's not possible to escape
if $game_temp.party_changer_in_battle == false
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Escape processing
start_party_changer
end
return
end
end
#--------------------------------------------------------------------------
# * Start After Battle Phase
#--------------------------------------------------------------------------
def start_phase5
party_changer_start_phase5
exp = 0
# Loop
for enemy in $game_troop.enemies
# If enemy is not hidden
unless enemy.hidden
# Add EXP obtained
exp += enemy.exp
end
end
# Obtaining EXP
for i in 0...$game_party.members.size
return if $game_temp.members_gain_exp == false
member = $game_party.members
next if $game_party.actors.include?(member)
if member.cant_get_exp? == false
member.exp += (exp/100) * $game_temp.members_exp_rate
end
end
end
#--------------------------------------------------------------------------
# * Start Party Changer Phase
#--------------------------------------------------------------------------
def start_party_changer
# Get actor
@actor = $game_party.members[0]
@max_actors = $game_temp.battle_party_args[0]
@forced_members = []
forced_members = $game_temp.battle_party_args[1]
for i in 0...$game_temp.battle_party_args[1].size
@forced_members << $game_actors[$game_temp.battle_party_args[1]]
end
@lock_leader = $game_temp.battle_party_args[2]
# Make windows
@party_status_window = Window_MemberStatus.new(@actor)
@members_window = Window_PartyMembers.new(@forced_members)
page_id = ((@members_window.index/8)+1).round
max_page = (@members_window.members.size.to_f/8.0)
max_page = 1 if max_page == 0
@party_status_window.refresh(page_id, max_page.ceil)
# Defined the height to make the window scroll
@members_window.height = 128
@party_window = Window_Party.new(@forced_members)
@party_command_window2 = Window_Command.new(320,['Reset','Confirm','Arrange'])
@party_command_window2.x = 320
@party_command_window2.y = 352
# Hide @status_window contents
@status_window.hide_battlers = true
for i in @spriteset.actor_sprites
i.visible = false
end
@members_window.active = true
@party_command_window.active = false
@party_command_window.visible = false
# Shift phase
@phase = 6
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Original method
party_changer_update
case @phase
when 6
update_party_changer
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (Party Changer)
#--------------------------------------------------------------------------
def update_party_changer
@party_window.update
@members_window.update
@party_command_window2.update
$game_temp.selected_members = @party_window.members.dup
if @party_window.members.size == 0
@party_command_window2.disable_item(1)
@party_command_window2.disable_item(2)
else
@party_command_window2.enable_item(1)
@party_command_window2.enable_item(2)
end
if @party_command_window2.active
update_party_changer_command
end
if @party_window.active
update_party
end
if @members_window.active
update_members
end
end
#--------------------------------------------------------------------------
# * Frame Update (if party changer's command window is active)
#--------------------------------------------------------------------------
def update_party_changer_command
@party_window.cursor_rect.empty
case @party_command_window2.index
when 0
@help_window.set_text('Reset party members')
when 1
@help_window.set_text('Confirm party selection')
when 2
@help_window.set_text('Arrange party members')
end
if Input.trigger?(Input::C)
case @party_command_window2.index
when 0
@members_window.reset
@party_window.reset_selection
@party_window.reset_members
@party_command_window2.active = false
@members_window.active = true
$game_temp.selected_members.clear
@reset = true
return
when 1
if @party_window.members.size == 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
$game_party.actors.clear
@party_window.members.each do |actor|
$game_party.add_actor(actor.id)
end
@members_window.active = false
@party_command_window2.active = false
@party_status_window.active = false
@party_window.active = false
@members_window.visible = false
@party_command_window2.visible = false
@party_status_window.visible = false
@party_window.visible = false
@party_command_window.visible = true
@party_command_window.active = true
for i in @spriteset.actor_sprites
i.visible = true
end
@help_window.visible = false
@status_window.refresh
@status_window.hide_battlers = false
@phase = 2
return
when 2
if @party_window.members.size == 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
@party_command_window2.active = false
@party_window.active = true
@party_window.index = 0
@reset = true
return
end
end
end
#--------------------------------------------------------------------------
# * Frame Update (if party window is active)
#--------------------------------------------------------------------------
def update_party
@party_window.item_max = @party_window.members.size
if @reset
@reset = false
return
end
if Input.trigger?(Input::B)
@party_command_window2.active = true
@party_window.active = false
@party_window.index = -3
@change1 = nil
@change2 = nil
@party_window.reset_selection
return
end
@help_window.set_text('Change members position')
if @party_status_window.actor != @party_window.members[@party_window.index]
@party_status_window.actor = @party_window.members[@party_window.index]
@party_status_window.refresh
end
if Input.trigger?(Input::C) and @change1 == nil
if @lock_leader and @party_window.index == 0
$game_system.se_play($data_system.buzzer_se)
return
end
@change1 = @party_window.members[@party_window.index]
@old_index = @party_window.index
@party_window.selected_members[@party_window.index] = true
@party_window.refresh
elsif Input.trigger?(Input::C) and @change1 != nil
if @lock_leader and @party_window.index == 0
$game_system.se_play($data_system.buzzer_se)
return
end
@change2 = @party_window.members[@party_window.index]
@party_window.members[@party_window.index] = @change1
@party_window.members[@old_index] = @change2
@change1 = nil
@change2 = nil
@party_window.reset_selection
end
end
#--------------------------------------------------------------------------
# * Frame Update (party members)
#--------------------------------------------------------------------------
def update_members
@party_window.cursor_rect.empty
if @reset
@reset = false
return
end
@help_window.set_text('Form your party')
if @party_status_window.actor != @members_window.members[@members_window.index]
@party_status_window.actor = @members_window.members[@members_window.index]
page_id = ((@members_window.index/8)+1).round
max_page = (@members_window.members.size.to_f/8.0)
max_page = 1 if max_page == 0
@party_status_window.refresh(page_id, max_page.ceil)
end
if @party_window.members.size == @max_actors
@party_command_window2.active = true
@members_window.active = false
return
end
if Input.trigger?(Input::B)
@party_command_window2.active = true
@members_window.active = false
return
end
if Input.trigger?(Input::C)
if @party_window.members.size < @max_actors and
not @party_window.members.include?(@members_window.members[@members_window.index])
@members_window.selected_members[@members_window.index] = true
@members_window.refresh
@party_status_window.refresh
@party_window.members.push(@members_window.members[@members_window.index])
@party_window.refresh
return
end
end
end
end
#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
# This window displays the status of all party members on the battle screen.
#==============================================================================
class Window_BattleStatus < Window_Base
attr_accessor :hide_battlers
alias hide_battlers_initialize initialize
def initialize
@hide_battlers = false
hide_battlers_initialize
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if @hide_battlers
self.contents_opacity = 0
return
end
# Slightly lower opacity level during main phase
if $game_temp.battle_main_phase
self.contents_opacity -= 4 if self.contents_opacity > 191
else
self.contents_opacity += 4 if self.contents_opacity < 255
end
end
end
#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
# This class brings together battle screen sprites. It's used within
# the Scene_Battle class.
#==============================================================================
class Spriteset_Battle
attr_accessor :actor_sprites
end
#==============================================================================
# ** Scene_Party
#------------------------------------------------------------------------------
# This class performs party menu screen processing.
#==============================================================================
class Scene_Party
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : command cursor's initial position
# forced_members : members forced to be in the party
#--------------------------------------------------------------------------
def initialize(max_actors = 4, forced_members = [], lock_leader = false, from_menu=false)
@max_actors = max_actors
@forced_members = []
@lock_leader = lock_leader
@from_menu = from_menu
forced_members.each do |member|
$game_party.add_member(member)
@forced_members << $game_actors[member]
end
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Get actor
@actor = $game_party.members[0]
# Make help window, status window, and skill window
@help_window = Window_Help.new
@status_window = Window_MemberStatus.new(@actor)
@members_window = Window_PartyMembers.new(@forced_members)
page_id = ((@members_window.index/8)+1).round
max_page = (@members_window.members.size.to_f/8.0)
max_page = 1 if max_page == 0
@status_window.refresh(page_id, max_page.ceil)
# Defined the height to make the window scroll
@members_window.height = 128
@party_window = Window_Party.new(@forced_members)
@command_window = Window_Command.new(320,['Reset','Confirm','Arrange'])
@command_window.x = 320
@command_window.y = 352
@command_window.active = false
@reset = false
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@help_window.dispose
@status_window.dispose
@party_window.dispose
@members_window.dispose
@command_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@party_window.update
@members_window.update
@command_window.update
$game_temp.selected_members = @party_window.members.dup
if @party_window.members.size == 0
@command_window.disable_item(1)
@command_window.disable_item(2)
else
@command_window.enable_item(1)
@command_window.enable_item(2)
end
if @command_window.active
update_command
end
if @party_window.active
update_party
end
if @members_window.active
update_members
end
end
#--------------------------------------------------------------------------
# * Frame Update (if command window is active)
#--------------------------------------------------------------------------
def update_command
@party_window.cursor_rect.empty
case @command_window.index
when 0
@help_window.set_text('Reset party members')
when 1
@help_window.set_text('Confirm party selection')
when 2
@help_window.set_text('Arrange party members')
end
if Input.trigger?(Input::C)
case @command_window.index
when 0
@members_window.reset
@party_window.reset_selection
@party_window.reset_members
@command_window.active = false
@members_window.active = true
$game_temp.selected_members.clear
@reset = true
return
when 1
if @party_window.members.size == 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
$game_party.actors.clear
@party_window.members.each do |actor|
$game_party.add_actor(actor.id)
end
if @from_menu
$scene = Scene_Menu.new
else
$scene = Scene_Map.new
end
return
when 2
if @party_window.members.size == 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
@command_window.active = false
@party_window.active = true
@party_window.index = 0
@reset = true
return
end
end
end
#--------------------------------------------------------------------------
# * Frame Update (if party window is active)
#--------------------------------------------------------------------------
def update_party
@party_window.item_max = @party_window.members.size
if @reset
@reset = false
return
end
if Input.trigger?(Input::B)
@command_window.active = true
@party_window.active = false
@party_window.index = -1
@party_window.oy = 0
@change1 = nil
@change2 = nil
@party_window.reset_selection
return
end
@help_window.set_text('Change members position')
if @status_window.actor != @party_window.members[@party_window.index]
@status_window.actor = @party_window.members[@party_window.index]
@status_window.refresh
end
if Input.trigger?(Input::C) and @change1 == nil
if @lock_leader and @party_window.index == 0
$game_system.se_play($data_system.buzzer_se)
return
end
@change1 = @party_window.members[@party_window.index]
@old_index = @party_window.index
@party_window.selected_members[@party_window.index] = true
@party_window.refresh
elsif Input.trigger?(Input::C) and @change1 != nil
if @lock_leader and @party_window.index == 0
$game_system.se_play($data_system.buzzer_se)
return
end
@change2 = @party_window.members[@party_window.index]
@party_window.members[@party_window.index] = @change1
@party_window.members[@old_index] = @change2
@change1 = nil
@change2 = nil
@party_window.reset_selection
end
end
#--------------------------------------------------------------------------
# * Frame Update (party members)
#--------------------------------------------------------------------------
def update_members
@party_window.cursor_rect.empty
if @reset
@reset = false
return
end
@help_window.set_text('Form your party')
if @status_window.actor != @members_window.members[@members_window.index]
@status_window.actor = @members_window.members[@members_window.index]
page_id = ((@members_window.index/8)+1).round
max_page = (@members_window.members.size.to_f/8.0)
max_page = 1 if max_page == 0
@status_window.refresh(page_id, max_page.ceil)
end
if @party_window.members.size == @max_actors
@command_window.active = true
@members_window.active = false
return
end
if Input.trigger?(Input::B)
@command_window.active = true
@members_window.active = false
return
end
if Input.trigger?(Input::C)
if @party_window.members.size < @max_actors and
not @party_window.members.include?(@members_window.members[@members_window.index])
@members_window.selected_members[@members_window.index] = true
@members_window.refresh
@status_window.refresh
@party_window.members.push(@members_window.members[@members_window.index])
@party_window.refresh
return
end
end
end
end
It works wonderfully. The problem is this: I want Hero 1 to always be first. This is due to text that wouldnt make sense (eg Hero 2 is in front, but Hero 1's lines are said) and a caterpillar script, which I'd like Hero 1 to lead.
So, is there a way to completely disable the "Arrange" feature on this Party Changer? I have no use for it. That, or make it so that Hero 1 can NOT be placed anywhere else but first.
Thanks for the help in advance!