skulldragon3200
Member
Hello guys,
I am trying to edit Dargor's Party Changer script.
Found here: viewtopic.php?f=156&t=23508
(The scripts are only in the demo, and can be seen at the end of the post)
Anyways, I only have 5 characters in my project and using this script allows all 5 characters to be in the party and battle. The only problem (or not problem, just something that annoys me) is that during battle and on the menu screen, when scrolling through the characters, you have to scroll to a new page. (in this case only has one character)
Is there anyway to edit it so that all 5 characters show up in the same window without having to go to another 'page' of characters during battle and in the menu.
Also, if no direct solutions, any hints would be helpful to where the problem can be solved.
Here are the scripts involved with Dargor's Party Changer: (put in one big spoiler tag to make the initial post seem cleaner)
Thanks for any help guys! :biggrin:
EDIT:
A friend of mien sat down with me earlier and I sorted it all out and it works great. IF anyone is interested in what needed to be changed, throw me a PM. :D
I am trying to edit Dargor's Party Changer script.
Found here: viewtopic.php?f=156&t=23508
(The scripts are only in the demo, and can be seen at the end of the post)
Anyways, I only have 5 characters in my project and using this script allows all 5 characters to be in the party and battle. The only problem (or not problem, just something that annoys me) is that during battle and on the menu screen, when scrolling through the characters, you have to scroll to a new page. (in this case only has one character)
Is there anyway to edit it so that all 5 characters show up in the same window without having to go to another 'page' of characters during battle and in the menu.
Also, if no direct solutions, any hints would be helpful to where the problem can be solved.
Here are the scripts involved with Dargor's Party Changer: (put in one big spoiler tag to make the initial post seem cleaner)
Interpreter Fix
Commands Manager
Party Changer
Party Changer(Main Menu)
Party Arrange
Large Party Script
Code:
#==============================================================================
# ** Interpreter (part 7)
#------------------------------------------------------------------------------
# This interpreter runs event commands. This class is used within the
# Game_System class and the Game_Event class.
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# * Script (Fix an oddity: Game freezes when setting a boolean to false)
#--------------------------------------------------------------------------
def command_355
# Set first line to script
script = @list[@index].parameters[0] + "\n"
# Loop
loop do
# If next event command is second line of script or after
if @list[@index+1].code == 655
# Add second line or after to script
script += @list[@index+1].parameters[0] + "\n"
# If event command is not second line or after
else
# Abort loop
break
end
# Advance index
@index += 1
end
# Evaluation
result = eval(script)
# If return value is false
if result == false
# End
return true
end
# Continue
return true
end
end
Commands Manager
Code:
#==============================================================================
# ** Commands Manager
#------------------------------------------------------------------------------
# Author: Dargor
# Version 1.2
# 20/09/2007
#==============================================================================
# * Instructions
#------------------------------------------------------------------------------
# - To add a command to the command window use:
# @command_window.add_command("command")
# - To remove a command to the command window use:
# @command_window.remove_command("command")
# - To rearrange the commands in the command window use:
# @command_window.set_commands(["cmd1","cmd2","cmd3"...])
# - You can also rearrange the default menu commands using:
# $game_system.menu_commands = ["cmd1","cmd2","cmd3"...]
#------------------------------------------------------------------------------
# * Note
#------------------------------------------------------------------------------
# - This script rewrites the update_command and update_status methods
# in Scene_Menu.
#==============================================================================
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :default_commands # default commands
attr_accessor :menu_commands # menu commands
attr_accessor :commands_max # commands max
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias dargor_menu_commands_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@default_commands = ["Item","Skill","Equip","Status","Save","End Game"]
@menu_commands = ["Item","Skill","Equip","Status","Save","End Game"]
@commands_max = 6
dargor_menu_commands_initialize
end
end
#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
# This window deals with general command choices.
#==============================================================================
class Window_Command < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :commands # commands
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias dargor_index_update update
alias dargor_disable_item disable_item
alias dargor_draw_item draw_item
#--------------------------------------------------------------------------
# * Add Command (command)
#--------------------------------------------------------------------------
def add_command(command)
return if @commands.include?(command)
@commands.push(command)
set_commands(@commands)
end
#--------------------------------------------------------------------------
# * Remove Command (command)
#--------------------------------------------------------------------------
def remove_command(command)
@commands.delete(command)
set_commands(@commands)
end
#--------------------------------------------------------------------------
# * Set Commands (commands)
#--------------------------------------------------------------------------
def set_commands(commands)
return if commands == [] or commands == nil
@commands = commands
@item_max = @commands.size
self.contents = Bitmap.new(width - 32, @item_max * 32)
refresh
self.height = 32 + (32 * $game_system.commands_max)
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text color
#--------------------------------------------------------------------------
def draw_item(index, color)
return if index.nil?
dargor_draw_item(index, color)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
dargor_index_update
update_index
end
#--------------------------------------------------------------------------
# * Frame Update (index)
#--------------------------------------------------------------------------
def update_index
if self.index >= @commands.size
self.index = @commands.size-1
return
end
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number / item string
#--------------------------------------------------------------------------
def disable_item(index)
if index.is_a?(String)
new_index = @commands.index(index)
draw_item(new_index, disabled_color)
else
draw_item(index, disabled_color)
end
end
#--------------------------------------------------------------------------
# * Enable Item
# index : item number
#--------------------------------------------------------------------------
def enable_item(index)
draw_item(index, normal_color)
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Alias listing
#--------------------------------------------------------------------------
alias add_remove_command_main main
alias add_remove_command_update update
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Default menu commands
@default_commands = $game_system.default_commands
# Create an empty array of command
@commands = []
# Call the original main method
add_remove_command_main
end
#--------------------------------------------------------------------------
# * Set Commands Access
#--------------------------------------------------------------------------
def set_commands_access
# Reinitialize menu commands
unless @command_window.commands == @commands
@command_window.set_commands($game_system.menu_commands)
end
# Se basic commands name
s1 = @default_commands[0]
s2 = @default_commands[1]
s3 = @default_commands[2]
s4 = @default_commands[3]
s5 = @default_commands[4]
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(s1)
@command_window.disable_item(s2)
@command_window.disable_item(s3)
@command_window.disable_item(s4)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(s5)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Set commands access
set_commands_access
# Set the array equal to the current commands
@commands = @command_window.commands
# Set commands access
# Call the original update method
add_remove_command_update
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# Assign @command_window.index to its strings
command = @commands[@command_window.index]
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If command other than save or end game, and party members = 0
if $game_party.actors.size == 0 and @command_window.index < 4
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Branch by command window cursor position
case command
when @default_commands[0]
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to item screen
$scene = Scene_Item.new
when @default_commands[1]
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when @default_commands[2]
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when @default_commands[3]
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when @default_commands[4]
# If saving is forbidden
if $game_system.save_disabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to save screen
$scene = Scene_Save.new
when @default_commands[5]
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to end game screen
$scene = Scene_End.new
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when status window is active)
#--------------------------------------------------------------------------
def update_status
# Assign @command_window.index to its strings
command = @commands[@command_window.index]
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Make command window active
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case command
when @default_commands[1]
# If this actor's action limit is 2 or more
if $game_party.actors[@status_window.index].restriction >= 2
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to skill screen
$scene = Scene_Skill.new(@status_window.index)
when @default_commands[2]
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to equipment screen
$scene = Scene_Equip.new(@status_window.index)
when @default_commands[3]
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to status screen
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
Party Changer
Code:
#==============================================================================
# ** Party Changer
#------------------------------------------------------------------------------
# Author: Dargor
# Version 3.3
# 16/12/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
#--------------------------------------------------------------------------
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 arguments
attr_accessor :menu_party_args # in-menu party changer arguments
attr_accessor :multiple_party_battle # open party changer when all actors collapse
attr_accessor :multiple_teams_args
attr_accessor :multiple_teams
attr_accessor :teams_destination
attr_accessor :current_team
attr_accessor :use_custom_graphic
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias party_changer_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@selected_members = []
@party_members = []
@members_gain_exp = true
@members_exp_rate = 30
@party_changer_in_battle = false
@battle_party_args = [1, 4,[],[]]
@menu_party_args = [1, 4,[],[]]
@multiple_teams = false
@multiple_teams_args = [
[1, 2,[2],[2]],
[1, 2,[5],[5]],
[1, 4,[3],[3]]
]
@teams_destination = [
[10,7,1,2],
[9,8,1,2],
[11,8,1,2]
]
@current_team = [0, []]
@multiple_party_battle = true
@use_custom_graphic = true
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
attr_accessor :locked # locked in the reserve
#--------------------------------------------------------------------------
# * 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
@locked = false
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
attr_accessor :team_members
attr_accessor :team_location
#--------------------------------------------------------------------------
# * 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 = []
@team_members = []
@team_gold = []
@team_items = []
@team_armors = []
@team_weapons = []
@team_location = []
end
def setup_teams(id, members, location)
@team_members[id] = members
if @team_location[id].nil?
@team_location[id] = []
end
@team_location[id][0] = location[0]
@team_location[id][1] = location[1]
@team_location[id][2] = location[2]
@team_location[id][3] = location[3]
end
def save_team_data
team_id = $game_temp.current_team[0]
@team_members[team_id] = $game_party.actors.dup
if @team_location[team_id].nil?
@team_location[team_id] = []
end
@team_location[team_id][0] = $game_player.x
@team_location[team_id][1] = $game_player.y
@team_location[team_id][2] = $game_map.map_id
@team_location[team_id][3] = $game_player.direction
end
def switch(team_id)
if $scene.is_a?(Scene_Map)
$game_party.actors.clear
for i in 0...@team_members[team_id].size
$game_party.add_actor(@team_members[team_id][i].id)
end
$game_temp.player_new_x = @team_location[team_id][0]
$game_temp.player_new_y = @team_location[team_id][1]
$game_temp.player_new_map_id = @team_location[team_id][2]
$game_temp.player_new_direction = @team_location[team_id][3]
end
end
#--------------------------------------------------------------------------
# * Initial Party Setup
#--------------------------------------------------------------------------
def setup_starting_members
party_changer_setup_starting_members
for i in $data_system.party_members
actor = $game_actors[i]
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[i].id] != nil
new_members.push($game_actors[@members[i].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
#--------------------------------------------------------------------------
# * Determine Every Members are Dead
#--------------------------------------------------------------------------
def members_all_dead?
available_members = []
for i in 0...@members.size
next if @members[i].locked
available_members << @members[i]
end
# If number of party members is 0
if $game_party.members.size == 0
return false
end
# If an actor is in the party with 0 or more HP
for member in available_members
if member.hp > 0
return false
end
end
# All members dead
return true
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
return if @actor.nil?
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")
elsif $game_actors[@actor.id].locked
self.contents.draw_text(0,96,640,32,"- #{@actor.name} is not available")
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[i]
selected = @selected_members[i]
# A1
opacity = selected == true ? 128 : 255
if $game_temp.use_custom_graphic
bitmap = RPG::Cache.picture("Actor_#{actor.name}")
src_rect = bitmap.rect
dest_rect = Rect.new(x+2, y+2, 124, 46)
self.contents.stretch_blt(dest_rect, bitmap, src_rect, opacity)
else
draw_actor_graphic($game_actors[actor.id], x+60, y+48, selected)
end
end
end
#--------------------------------------------------------------------------
# * Reset
#--------------------------------------------------------------------------
def reset
if $game_temp.multiple_teams
team_id = $game_temp.current_team[0]
members = $game_temp.current_team[1]
forced_members = []
for i in 0...$game_temp.multiple_teams_args.size
forced_members += $game_temp.multiple_teams_args[i][2]
end
for i in 0...@members.size
if members.include?(@members[i])
@selected_members[i] = false
end
if forced_members.include?(@members[i].id)
@selected_members[i] = true
end
if @members[i].locked
@selected_members[i] = true
end
end
else
for i in 0...@members.size
@selected_members[i] = false
if @forced_members.include?(@members[i])
@selected_members[i] = true
end
if @members[i].locked
@selected_members[i] = true
end
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[i]
next if actor.nil?
# A2
if $game_temp.use_custom_graphic
opacity = @selected_members[i] == true ? 128 : 255
bitmap = RPG::Cache.picture("Actor_#{actor.name}")
src_rect = bitmap.rect
dest_rect = Rect.new(x+2, y+2, 124, 46)
self.contents.stretch_blt(dest_rect, bitmap, src_rect, opacity)
else
opacity = @selected_members[i]
draw_actor_graphic($game_actors[actor.id], x+60, y+48,opacity)
end
end
end
#--------------------------------------------------------------------------
# * Reset Selection
#--------------------------------------------------------------------------
def reset_selection
for i in 0...@members.size
@selected_members[i] = false
end
refresh
end
#--------------------------------------------------------------------------
# * Reset Members
#--------------------------------------------------------------------------
def reset_members
@members = []
@forced_members.each do |member|
# NIL M
#next if member.nil?
@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
#--------------------------------------------------------------------------
# * Determine Battle Win/Loss Results
#--------------------------------------------------------------------------
def judge
# If all dead determinant is true, or number of members in party is 0
if $game_party.all_dead? or $game_party.actors.size == 0
if $game_party.members_all_dead?
# If possible to lose
if $game_temp.battle_can_lose
# Return to BGM before battle starts
$game_system.bgm_play($game_temp.map_bgm)
# Battle ends
battle_end(2)
# Return true
return true
end
# Set game over flag
$game_temp.gameover = true
# Return true
return true
else
if $game_temp.party_changer_in_battle
start_party_changer
return false
else
# Set game over flag
$game_temp.gameover = true
# Return true
return true
end
end
end
# Return false if even 1 enemy exists
for enemy in $game_troop.enemies
if enemy.exist?
return false
end
end
# Start after battle phase (win)
start_phase5
# Return true
return true
end
#--------------------------------------------------------------------------
# * 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[i]
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]
@min_actors = $game_temp.battle_party_args[0]
@max_actors = $game_temp.battle_party_args[1]
@forced_members = []
forced_members = $game_temp.battle_party_args[2]
for i in 0...$game_temp.battle_party_args[2].size
member = $game_temp.battle_party_args[2][i]
if member.nil?
@forced_members << member
else
@forced_members << $game_actors[member]
end
end
@lock_members = $game_temp.battle_party_args[3]
# 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 .active = false
@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 < @min_actors
# 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 0...$game_party.actors.size
@spriteset.actor_sprites[i].visible = true
end
@help_window.visible = false
@status_window.hide_battlers = false
@status_window.refresh
@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
@temp_change1 = @party_window.members[@party_window.index]
if @lock_members.include?(@temp_change1.id)# 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
@temp_change2 = @party_window.members[@party_window.index]
if @lock_members.include?(@temp_change2.id)# 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)
return if @members_window.members[@members_window.index].locked
if @party_window.members.size < @max_actors and
not @party_window.members.include?(@members_window.members[@members_window.index])
for i in 0...@max_actors
actor = @members_window.members[@members_window.index]
next if @party_window.members[i] != nil
next if @party_window.members.include?(actor)
@members_window.selected_members[@members_window.index] = true
@members_window.refresh
@status_window.refresh
@party_window.members[i] = actor
@party_window.refresh
end
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
else
self.contents_opacity = 255
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(min_actors = 1, max_actors = 4, forced_members = [], lock_members = [], from_menu=false)
@min_actors = []
@max_actors = []
@forced_members = []
@lock_members = []
@from_menu = from_menu
if $game_temp.multiple_teams and not @from_menu
for i in 0...$game_temp.multiple_teams_args.size
@forced_members[i] = []
@min_actors[i] = $game_temp.multiple_teams_args[i][0]
@max_actors[i] = $game_temp.multiple_teams_args[i][1]
forced_members = $game_temp.multiple_teams_args[i][2]
@lock_members[i] = $game_temp.multiple_teams_args[i][3]
forced_members.each do |member|
if member.nil?
@forced_members[i] << member
else
$game_party.add_member(member)
@forced_members[i] << $game_actors[member]
end
end
end
else
@min_actors[0] = min_actors
@max_actors[0] = max_actors
@forced_members[0] = []
@lock_members[0] = lock_members
forced_members.each do |member|
if member.nil?
@forced_members[0] << member
else
$game_party.add_member(member)
@forced_members[0] << $game_actors[member]
end
end
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[0])
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)
teams = []
for i in 0...$game_temp.multiple_teams_args.size
teams << "Team #{i+1}"
end
# Defined the height to make the window scroll
@members_window.height = 128
@team_windows = []
@team_windows << Window_Party.new(@forced_members[0])
if $game_temp.multiple_teams and not @from_menu
for i in 1...$game_temp.multiple_teams_args.size
@team_windows << Window_Party.new(@forced_members[i])
@team_windows[i].visible = false
end
end
commands = ['Reset','Confirm','Arrange']
commands << 'Change Team' if $game_temp.multiple_teams and not @from_menu
@command_window = Window_Command.new(320,commands)
@command_window.x = 320
@command_window.y = 352
@command_window.height = 3 * 32 + 32
@command_window.active = false
@reset = false
teams = [''] if teams.empty?
@team_selection_window = Window_Command.new(160, teams)
@team_selection_window.x = 480
@team_selection_window.height = 64
@team_selection_window.active = false
@team_selection_window.visible = $game_temp.multiple_teams
# 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
@members_window.dispose
@command_window.dispose
@team_selection_window.dispose
for window in @team_windows
window.dispose
end
end
def active_team_window
return @team_windows[team_index]
end
def team_index
return @team_selection_window.index
end
def confirmation_enabled?
i = 0
for team_window in @team_windows
temp_members = team_window.members.dup
temp_members.delete(nil)
if temp_members.size < @min_actors[i]
return false
end
if temp_members[0].nil?
return false
end
if temp_members.empty?
return false
else
i += 1
next
end
return true
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@party_window = active_team_window
@members_window.update
@command_window.update
@team_selection_window.update
for i in 0...@team_windows.size
@team_windows[i].update
@team_windows[i].visible = false
if i == team_index
@team_windows[i].visible = true
end
end
$game_temp.current_team = [team_index, active_team_window.members]
$game_temp.selected_members = []
for team_window in @team_windows
$game_temp.selected_members += team_window.members.dup
end
if $game_temp.multiple_teams and not @from_menu
if confirmation_enabled?
@command_window.enable_item(1)
else
@command_window.disable_item(1)
end
else
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
end
if @team_selection_window.active
update_teams
return
end
if @command_window.active
update_command
return
end
if @party_window.active
update_party
return
end
if @members_window.active
update_members
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if command team is active)
#--------------------------------------------------------------------------
def update_teams
@help_window.set_text('Choose a team.')
if Input.trigger?(Input::C)
@team_selection_window.active = false
@members_window.active = true
return
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')
when 3
@help_window.set_text('Choose an other team.')
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 < @min_actors[team_index]
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
for team_window in @team_windows
temp_members = team_window.members.dup
temp_members.delete(nil)
if temp_members.empty?
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
@help_window.set_text("You must form #{@team_windows.size} teams!")
return
end
end
unless confirmation_enabled?
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
$game_party.actors.clear
if $game_temp.multiple_teams and not @from_menu
@team_windows[0].members.each do |actor|
$game_party.add_actor(actor.id)
end
for i in 0...@team_windows.size
location = $game_temp.teams_destination[i]
members = @team_windows[i].members.dup
$game_party.setup_teams(i, members, location)
end
$game_temp.current_team = [0, @team_windows[0].members]
else
@party_window.members.each do |actor|
$game_party.add_actor(actor.id)
end
$game_temp.current_team = [0, @party_window.members]
end
if $game_temp.multiple_teams
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
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
when 3
@command_window.active = false
@team_selection_window.active = 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
@temp_change1 = @party_window.members[@party_window.index]
if @lock_members[team_index].include?(@temp_change1.id)# 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
@temp_change2 = @party_window.members[@party_window.index]
if @lock_members[team_index].include?(@temp_change2.id)# 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[team_index]
@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)
member = @members_window.members[@members_window.index]
return if member.locked
if @party_window.members.size < @max_actors[team_index] and
not @party_window.members.include?(member) and
not $game_temp.selected_members.include?(member)
for i in 0...@max_actors[team_index]
actor = @members_window.members[@members_window.index]
next if @party_window.members[i] != nil
next if @party_window.members.include?(actor)
@members_window.selected_members[@members_window.index] = true
@members_window.refresh
@status_window.refresh
@party_window.members[i] = actor
@party_window.refresh
end
return
end
end
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
alias multiple_teams_update update
def update
multiple_teams_update
if $game_temp.multiple_teams
if Input.trigger?(Input::L)
$game_party.save_team_data
$game_temp.current_team[0] += 1
$game_temp.current_team[0] %= $game_temp.multiple_teams_args.size
$game_party.switch($game_temp.current_team[0])
# Prepare for transition
Graphics.freeze
# Set transition processing flag
$game_temp.transition_processing = true
$game_temp.transition_name = ""
transfer_player
elsif Input.trigger?(Input::R)
$game_party.save_team_data
$game_temp.current_team[0] += $game_temp.multiple_teams_args.size - 1
$game_temp.current_team[0] %= $game_temp.multiple_teams_args.size
$game_party.switch($game_temp.current_team[0])
# Prepare for transition
Graphics.freeze
# Set transition processing flag
$game_temp.transition_processing = true
$game_temp.transition_name = ""
transfer_player
end
end
end
#--------------------------------------------------------------------------
# * Player Place Move
#--------------------------------------------------------------------------
alias mp_transfer_player transfer_player
def transfer_player
if $game_map.map_id == $game_temp.player_new_map_id
# Set up a new map
$game_map.setup_parties
end
$game_map.setup_parties
mp_transfer_player
end
end
#==============================================================================
# ** Game_Character (part 1)
#------------------------------------------------------------------------------
# This class deals with characters. It's used as a superclass for the
# Game_Player and Game_Event classes.
#==============================================================================
class Game_Character
alias dargor_multiple_parties_passable? passable?
#--------------------------------------------------------------------------
# * Determine if Passable
# x : x-coordinate
# y : y-coordinate
# d : direction (0,2,4,6,8)
# * 0 = Determines if all directions are impassable (for jumping)
#--------------------------------------------------------------------------
def passable?(x, y, d)
# Get new coordinates
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
# Loop all events
for event in $game_map.party_leaders
next if event.nil?
# If event coordinates are consistent with move destination
if event.x == new_x and event.y == new_y
# If through is OFF
unless event.through
# If self is event
if self != $game_player
# impassable
return false
end
# With self as the player and partner graphic as character
if event.character_name != ""
# impassable
return false
end
end
end
end
dargor_multiple_parties_passable?(x, y, d)
end
end
#============================================================================
# ** Game_Character
#----------------------------------------------------------------------------
# This class deals with characters. It's used as a superclass for the
# Game_Player and Game_Event classes.
#============================================================================
class Game_PartyLeader < Game_Character
def initialize(team_id)
super()
@team_id = team_id
# Get lead actor
actor = $game_party.team_members[@team_id][0]
x = $game_party.team_location[@team_id][0]
y = $game_party.team_location[@team_id][1]
# Set character file name and hue
@character_name = actor.character_name
@character_hue = actor.character_hue
moveto(x,y)
end
def update
@direction = $game_party.team_location[@team_id][3]
super
end
end
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# This class handles the map. It includes scrolling and passable determining
# functions. Refer to "$game_map" for the instance of this class.
#==============================================================================
class Game_Map
attr_accessor :party_leaders
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias dargor_multiple_parties_setup setup
#--------------------------------------------------------------------------
# * Setup
# map_id : map ID
#--------------------------------------------------------------------------
def setup(map_id)
dargor_multiple_parties_setup(map_id)
setup_parties
end
def setup_parties
# Set map parties data
@party_leaders = []
for i in 0...$game_temp.multiple_teams_args.size
next if i == $game_temp.current_team[0]
next if $game_party.team_location[i].nil?
unless $game_party.team_location.empty?
if $game_party.team_location[i][2] == @map_id
@party_leaders[i] = Game_PartyLeader.new(i)
end
end
end
end
end
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
# This class brings together map screen sprites, tilemaps, etc.
# It's used within the Scene_Map class.
#==============================================================================
class Spriteset_Map
alias dargor_multiple_parties_initialize initialize
alias dargor_multiple_parties_update update
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@initialized = false
dargor_multiple_parties_initialize
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
unless @initialized
@new_character_sprites = []
# Make viewports
for i in 0...$game_map.party_leaders.size
next if $game_map.party_leaders[i].nil?
sprite = Sprite_Character.new(@viewport1, $game_map.party_leaders[i])
@new_character_sprites.push(sprite)
end
@initialized = true
end
dargor_multiple_parties_update
for sprite in @new_character_sprites
sprite.update
end
end
end
Party Changer(Main Menu)
Code:
#==============================================================================
# ** Party Changer (Main Menu)
#------------------------------------------------------------------------------
# Author: Dargor
# Version 1.5
# 20/09/2007
#==============================================================================
# * Note
#------------------------------------------------------------------------------
# - This script requires the Commands Manager version 1.2 or higher.
#==============================================================================
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :party_disabled # party menu forbidden
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias dargor_party_commands_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@party_disabled = true
dargor_party_commands_initialize
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Alias listing
#--------------------------------------------------------------------------
alias menu_party_set_commands_access set_commands_access
alias menu_party_changer_update update
alias menu_party_changer_update_command update_command
#--------------------------------------------------------------------------
# * Set Commands Access
#--------------------------------------------------------------------------
def set_commands_access
# Call the original method
menu_party_set_commands_access
# Disable party command if $game_system.party_disabled is true
if $game_system.party_disabled or $game_party.actors.size == 0 or
$game_temp.multiple_teams
$game_system.party_disabled = true
@command_window.disable_item("Party")
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
if $game_system.party_disabled = false
# Add the "Party" commande once
@command_window.add_command("Party")
# Set commands access
set_commands_access
end
# Call the original update method
menu_party_changer_update
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# Call the original update command method
menu_party_changer_update_command
# Assign @command_window.index to it strings
command = @commands[@command_window.index]
# If C button is pressed
if Input.trigger?(Input::C)
case command
# When "Party" is selected
when "Party"
# If party command is disabled
if $game_system.party_disabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
args = $game_temp.menu_party_args
$scene = Scene_Party.new(args[0],args[1],args[2],args[3],true)
end
return
end
end
end
Party Arrange
Code:
#==============================================================================
# ** Party Arrange
#------------------------------------------------------------------------------
# Author: Dargor
# Requested by: Chessplayer
# Version 1.2
# 20/09/2007
#==============================================================================
# * Note
#------------------------------------------------------------------------------
# - This script requires the Commands Manager script.
#==============================================================================
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :arrange_disabled # party menu forbidden
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias dargor_arrange_commands_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
dargor_arrange_commands_initialize
@arrange_disabled = true
end
end
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#==============================================================================
class Window_MenuStatus
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(where=nil)
# Clear the window
self.contents.clear
# If an actor's position is changing, draw a dark grey rectangle
if where != nil
# Set the y position
y = where*116
# Set the rectangle color
color = Color.new(65,65,65,200)
# Draw the rectangle
self.contents.fill_rect(0,y,480,96,color)
end
# Set the maximum number of actors in the party
@item_max = $game_party.actors.size
# Draw actors informations (above the rectangle)
for i in 0...$game_party.actors.size
x = 64
y = i * 116
actor = $game_party.actors[i]
draw_actor_graphic(actor, x - 40, y + 80)
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 144, y)
draw_actor_level(actor, x, y + 32)
draw_actor_state(actor, x + 90, y + 32)
draw_actor_exp(actor, x, y + 64)
draw_actor_hp(actor, x + 236, y + 32)
draw_actor_sp(actor, x + 236, y + 64)
end
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Alias listing
#--------------------------------------------------------------------------
alias party_arrange_set_commands_access set_commands_access
alias party_arrange_update update
alias party_arrange_update_command update_command
alias party_arrange_update_status update_status
#--------------------------------------------------------------------------
# * Set Commands Access
#--------------------------------------------------------------------------
def set_commands_access
# Call the original method
party_arrange_set_commands_access
# Disable party command if $game_system.arrange_disabled is true
if $game_system.arrange_disabled or $game_party.actors.size == 0
@command_window.disable_item("Arrange")
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
if $game_system.arrange_disabled = false
# Add the "Party" commande once
@command_window.add_command("Arrange")
end
# Call the original update method
party_arrange_update
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# Call the original update command method
party_arrange_update_command
# Assign @command_window.index to it strings
command = @commands[@command_window.index]
# If C button is pressed
if Input.trigger?(Input::C)
case command
# When "Party" is selected
when "Arrange"
# If party command is disabled
if $game_system.arrange_disabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
@checker = 0
@command_window.active = false
@status_window.active = true
@status_window.index = 0
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when status window is active)
#--------------------------------------------------------------------------
def update_status
# Call the original update status method
party_arrange_update_status
# Assign @command_window.index to it strings
command = @commands[@command_window.index]
# If B button is pressed
if Input.trigger?(Input::B)
@status_window.refresh
end
# If C button is pressed
if Input.trigger?(Input::C)
case command
# When "Party" is selected
when "Arrange"
# Play decision SE
$game_system.se_play($data_system.decision_se)
if @checker == 0
# If selected actor is not dead, prepare the changes,
# display a selection box
unless $game_party.actors[@status_window.index].dead?
@changer = $game_party.actors[@status_window.index]
@where = @status_window.index
@status_window.refresh(@where)
$game_player.refresh
@checker = 1
else
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
else
# If selected actor is not dead, change its position
unless $game_party.actors[@status_window.index].dead?
$game_party.actors[@where] = $game_party.actors[@status_window.index]
$game_party.actors[@status_window.index] = @changer
@checker = 0
@status_window.refresh
$game_player.refresh
else
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
end
end
return
end
end
end
Large Party Script
Code:
#==============================================================================
# ** Large Party
#------------------------------------------------------------------------------
# Author: Dargor
# Version 1.3
# 02/08/2007
#==============================================================================
#==============================================================================
# ** Large Party Customization Module
#==============================================================================
module Dargor
module Large_Party
# Maximum number of actors allowed in the party
Max_Size = 5
# Battle status window refresh rate (used in phase5)
Battle_Refresh_Rate = 32
end
end
#==============================================================================
# ** 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
#--------------------------------------------------------------------------
attr_accessor :battle_actor_index # @actor_index in battle scene
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias large_party_temp_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
large_party_temp_initialize
@battle_actor_index = 0
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 :max_size # Max number of actors allowed in the party
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias large_party_initialize initialize
alias large_party_add_actor add_actor
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
large_party_initialize
@max_size = Dargor::Large_Party::Max_Size
end
#--------------------------------------------------------------------------
# * Add an Actor
# actor_id : actor ID
#--------------------------------------------------------------------------
def add_actor(actor_id)
# Original method
large_party_add_actor(actor_id)
# Get actor
actor = $game_actors[actor_id]
# If the party has less than 4 members and this actor is not in the party
if @actors.size < @max_size and not @actors.include?(actor)
# Add actor
@actors.push(actor)
# Refresh player
$game_player.refresh
end
end
end
#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
# This sprite is used to display the battler.It observes the Game_Character
# class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias large_party_sprite_update update
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Original method
large_party_sprite_update
# Set sprite coordinates
if @battler.is_a?(Game_Actor)
self.x = @battler.screen_x - ($game_temp.battle_actor_index / 4) * 640
end
end
end
#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
# This class brings together battle screen sprites. It's used within
# the Scene_Battle class.
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias large_party_spriteset_update update
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Cycle through all extra actors (4+)
# Create/update sprites
for i in 4...$game_party.actors.size
if @actor_sprites[i].nil?
@actor_sprites.push(Sprite_Battler.new(@viewport2))
end
@actor_sprites[i].battler = $game_party.actors[i]
end
# Original method
large_party_spriteset_update
end
end
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias large_party_menu_status_initialize initialize
alias large_party_menu_status_refresh refresh
alias large_party_menu_status_update_cursor_rect update_cursor_rect
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Original method
large_party_menu_status_initialize
# Adjust contents height
@item_max = $game_party.actors.size
height = @item_max * 120
self.contents = Bitmap.new(width - 32, height - 32)
# Refresh
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(*args)
# Original method
large_party_menu_status_refresh(*args)
# Adjust default height
self.height = 480
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
large_party_menu_status_update_cursor_rect
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
cursor_width = self.width / @column_max - 32
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 116 - self.oy
self.cursor_rect.set(x, y, cursor_width, 96)
end
#--------------------------------------------------------------------------
# * Top Row
#--------------------------------------------------------------------------
def top_row
return self.oy / 116
end
#--------------------------------------------------------------------------
# * Set Top Row
# row : new row
#--------------------------------------------------------------------------
def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 116
end
#--------------------------------------------------------------------------
# * Page Row Max
#--------------------------------------------------------------------------
def page_row_max
return 4
end
end
#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
# This window displays the status of all party members on the battle screen.
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias large_party_battle_status_initialize initialize
alias large_party_battle_status_refresh refresh
alias large_party_battle_status_update update
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@column_max = 4
large_party_battle_status_initialize
width = $game_party.actors.size * 160
self.contents = Bitmap.new(width - 32, height - 32)
self.width = 640
@level_up_flags = []
for i in 0...$game_party.actors.size
@level_up_flags << false
end
@item_max = $game_party.actors.size
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Refresh contents when actors are added/removed in-battle
if $game_party.actors.size != @item_max
@item_max = $game_party.actors.size
width = @item_max * 160
self.contents = Bitmap.new(width - 32, height - 32)
self.width = 640
end
large_party_battle_status_refresh
column = $game_temp.battle_actor_index / 4
self.ox = column * 640
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
alias large_party_phase3_setup_command_window phase3_setup_command_window
alias large_party_update_phase4_step2 update_phase4_step2
alias large_party_start_phase5 start_phase5
alias large_party_update_phase5 update_phase5
#--------------------------------------------------------------------------
# * Actor Command Window Setup
#--------------------------------------------------------------------------
def phase3_setup_command_window
$game_temp.battle_actor_index = @actor_index
@status_window.refresh
large_party_phase3_setup_command_window
@actor_command_window.x = (@actor_index%4) * 160
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 2 : start action)
#--------------------------------------------------------------------------
def update_phase4_step2
if @active_battler.is_a?(Game_Actor)
$game_temp.battle_actor_index = @active_battler.index
@status_window.refresh
end
large_party_update_phase4_step2
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 4 : animation for target)
#--------------------------------------------------------------------------
def update_phase4_step4
if @target_battlers[0] != nil
$game_temp.battle_actor_index = @target_battlers[0].index
@status_window.refresh
end
# Animation for target
for target in @target_battlers
target.animation_id = @animation2_id
target.animation_hit = (target.damage != "Miss")
end
# Animation has at least 8 frames, regardless of its length
@wait_count = 8
# Shift to step 5
@phase4_step = 5
end
#--------------------------------------------------------------------------
# * Start After Battle Phase
#--------------------------------------------------------------------------
def start_phase5
@actor_index = 0
@status_wait = Graphics.frame_count
large_party_start_phase5
end
#--------------------------------------------------------------------------
# * Frame Update (after battle phase)
#--------------------------------------------------------------------------
def update_phase5
refresh_rate = Dargor::Large_Party::Battle_Refresh_Rate
if Graphics.frame_count >= @status_wait + refresh_rate
$game_temp.battle_actor_index = @actor_index
@status_window.refresh
@status_wait = Graphics.frame_count
max = ($game_party.actors.size.to_f/4).ceil * 4
@actor_index = (@actor_index+1) % max
end
large_party_update_phase5
end
end
Thanks for any help guys! :biggrin:
EDIT:
A friend of mien sat down with me earlier and I sorted it all out and it works great. IF anyone is interested in what needed to be changed, throw me a PM. :D