#===============================================================================
# * [ACE] Party Switcher Addon
#===============================================================================
# * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
# * Version: 1.3
# * Released: 21/01/2015
# * Requires: Tsukihime's Party Manager script
#-------------------------------------------------------------------------------
# * < Change Log >
#-------------------------------------------------------------------------------
# * Version 1.0 (07/12/2014)
# - Initial release.
# * Version 1.1 (10/12/2014)
# - Fixed a crash issue that happened when the current party ID got into the
# reserved party list. Switching the party afterwards resulted in a crash.
# No idea why would anyone do this, but it is crash-proof now for sure.
# - The reserve party script call will no longer add party IDs to the list
# which are already included in the reserved list. This messed up the correct
# order of party switching in certain cases.
# * Version 1.2 (14/12/2014)
# - Fixed the check for Falcao's Interactive Tools System.
# There won't be any more crash because of that check! Sorry about those!
# * Version 1.3 (21/01/2015)
# - Fixed the initialization of the reserved party list.
#-------------------------------------------------------------------------------
# * < Description >
#-------------------------------------------------------------------------------
# * This script makes party switching as easy as a button press.
# Separate button triggers for switching to the previous and next party!
# * Reserved parties option, to prevent changing party to some specific parties
# you reserved for whatever reason(s)!
# * Enable/disable party switching on the fly whenever you want!
# * Add/remove parties to/from the reserved parties list on the fly!
#-------------------------------------------------------------------------------
# * < Script Calls >
#-------------------------------------------------------------------------------
# * To enable/disable the button trigger for the party switching, you can use
# the following script calls:
#
# pm_party_switcher(true) # Enables the party switching.
# pm_party_switcher(false) # Disables the party switching.
#
# * To add/remove parties to/from the reserved parties list, you can use the
# following script calls:
#
# pm_reserve_party([party_ids]) # Adds the parties to reserve.
# pm_release_party([party_ids]) # Removes the parties from reserve.
#
# Replace 'party_ids' with any number of party IDs.
# Examples:
#
# pm_reserve_party([2,3]) # Adds the parties with ID 2 and 3 to reserve.
# pm_release_party([4]) # Removes the party with ID 4 from reserve.
#
# NOTE: Do not ever add the same party ID as your current party's ID to the
# reserve party list! Make sure that never happens or you will get an
# error coming your way when you want to change parties!
#
# No more script calls! o.o
#-------------------------------------------------------------------------------
# * < Installation >
#-------------------------------------------------------------------------------
# * In the script editor, place this script below Tsukihime's Party Manager and
# above Main.
#-------------------------------------------------------------------------------
# * < Compatibility Info >
#-------------------------------------------------------------------------------
# * This script isn't compatible with "Khas Pixel Movement" script...
# At least when I last checked, this was the case.
# If this has been changed since then, please let me know!
# * Includes compatibility with the following scripts:
# - FA: Interactive Tools
# - CSCA: Dungeon Tools
# You won't be able to switch parties when the player uses a hook or has
# something picked up, for example.
#-------------------------------------------------------------------------------
# * < Known Issues >
#-------------------------------------------------------------------------------
# * No known issues that I know of.
#-------------------------------------------------------------------------------
# * < Terms of Use >
#-------------------------------------------------------------------------------
# * Free to use for whatever purposes you want.
# * Credit me (Sixth) in your game, pretty please! :P
# * Posting modified versions of this script is allowed as long as you notice me
# about it with a link to it!
#===============================================================================
$imported = {} if $imported.nil?
$imported["SixthPartySwitcher"] = true
#===============================================================================
# Settings:
#===============================================================================
module Party_Switcher_S
Next_Button = :L # Button for switching to the next available party.
Prev_Button = :R # Button for switching to the previous available party.
# Reserved parties. The numbers in the array represent party IDs.
# Parties with these IDs can never get selected with the party switcher buttons.
# It is recommended to have at least one reserved party, which can act as a
# placeholder in case all of your other parties are at maximum party member
# capacity. If this ever happens, the remaining party members can stay in these
# parties and are available at a later point in the game to be synchronized
# with the other parties. These parties will hold their inventory as well, so
# you can bring up the party trade menu anytime if you ever need to get some
# items from these parties.
Reserved_Parties = [1]
end
#===============================================================================
# End of Settings! You can modify things below too if you don't mind the risk
# of flaming potatoes dropping down on your PC...
#===============================================================================
#==============================================================================
# Game_Interpreter
#------------------------------------------------------------------------------
# Adding the new script call here.
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# Enable/Disable Party Switcher Script Call
#--------------------------------------------------------------------------
def pm_party_switcher(enable)
$game_system.button_party_switcher = enable
end
#--------------------------------------------------------------------------
# Reserve Party Script Call
#--------------------------------------------------------------------------
def pm_reserve_party(party_id)
party_id.each do |id|
$game_system.reserved_parties.push(id) if !$game_system.reserved_parties.include?(id)
end
end
#--------------------------------------------------------------------------
# Release Party Script Call
#--------------------------------------------------------------------------
def pm_release_party(party_id)
party_id.each do |id|
$game_system.reserved_parties.delete(id) if $game_system.reserved_parties.include?(id)
end
end
end
#==============================================================================
# Game_System
#------------------------------------------------------------------------------
# Adding the party switch enable flag here.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# New Public Instance Variable
#--------------------------------------------------------------------------
attr_accessor :button_party_switcher, :reserved_parties
#--------------------------------------------------------------------------
# Alias Method: Initialize
#--------------------------------------------------------------------------
alias sixth_party_switcher123 initialize
def initialize
sixth_party_switcher123
@button_party_switcher = true
@reserved_parties = Party_Switcher_S::Reserved_Parties
end
end
#==============================================================================
# Module: Graphics
#------------------------------------------------------------------------------
# Adding the new button switch effect here.
#==============================================================================
module Graphics
class << self
alias :sixth_party_update122 :update
end
#---------------------------------------------------------------------------
# alias method: update
#---------------------------------------------------------------------------
def self.update(*args)
sixth_party_update122(*args)
if SceneManager.scene_is?(Scene_Map) && $game_system.button_party_switcher == true
# Switch to next party if the defined button is pressed
if Input.trigger?(Party_Switcher_S::Next_Button)
return if $game_party.in_battle
return if $game_player.moving? || $game_player.jumping?
return if $game_player.party_switching?
if defined?(FalInt) # checking for FA - Interactive Tools script
return if $game_player.grabing != nil
return if $game_player.showing_hook || $game_player.showing_fire
return if $game_player.gamebarrel.picked || $game_player.gamebomb.picked
for event in $game_map.events.values
return if event.picked
end
end
if $imported["CSCA-DungeonTools"] # checking for CSCA: Dungeon Tools script
return if $game_map.using_tool? && ($game_map.tooltype? == :hookshot || $game_map.tooltype? == :boomarang)
end
# starting switch next process
@total_p = Array.new
$game_parties.each do |party|
if !$game_system.reserved_parties.include?(party.id) && party.members.size > 0
@total_p.push(party.id)
end
end
@id = @total_p.index($game_party.id)
@done = false
@total_p.each do |pid|
if !@id.nil? && @total_p.index(pid) > @id && @done == false
$game_parties.switch_party(pid)
@done = true
end
end
if @done == false && $game_parties[@total_p[0]] && $game_party.id != @total_p[0] && $game_parties[@total_p[0]].members.size > 0
$game_parties.switch_party(@total_p[0])
end
end # next press check end
# Switch to previous party if the defined button is pressed
if Input.trigger?(Party_Switcher_S::Prev_Button)
return if $game_party.in_battle
return if $game_player.moving? || $game_player.jumping?
return if $game_player.party_switching?
if defined?(FalInt) # checking for FA - Interactive Tools script
return if $game_player.grabing != nil
return if $game_player.showing_hook || $game_player.showing_fire
return if $game_player.gamebarrel.picked || $game_player.gamebomb.picked
for event in $game_map.events.values
return if event.picked
end
end
if $imported["CSCA-DungeonTools"] # checking for CSCA: Dungeon Tools script
return if $game_map.using_tool? && ($game_map.tooltype? == :hookshot || $game_map.tooltype? == :boomarang)
end
# starting switch previous process
@total_p = Array.new
$game_parties.each do |party|
if !$game_system.reserved_parties.include?(party.id) && party.members.size > 0
@total_p.push(party.id)
end
end
@id = @total_p.index($game_party.id)
@done = false
@total_p.reverse.each do |pid|
if !@id.nil? && @total_p.index(pid) < @id && @done == false
$game_parties.switch_party(pid)
@done = true
end
end
if @done == false && $game_parties[@total_p[-1]] && $game_party.id != @total_p[-1] && $game_parties[@total_p[-1]].members.size > 0
$game_parties.switch_party(@total_p[-1])
end
end # prev press check end
end # Scene_Map check end
end # def update end
end # module end
#==============================================================================
# !!END OF SCRIPT!!
#==============================================================================