Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: Blizzard on January 09, 2008, 04:30:52 pm

Title: [XP] Easy Party Switcher
Post by: Blizzard on January 09, 2008, 04:30:52 pm
Easy Party Switcher
Authors: Blizzard
Version: 2.6
Type: Party Changing System
Key Term: Player / Party / Troop Add-on

Introduction

This script allows a more advanced switching of parties, disabling party members and fast switch between the current and a stored party.

This work is licensed under BSD License 2.0:
QuoteCopyright (c) Boris "Blizzard" Mikić
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1.  Redistributions of source code must retain the above copyright notice,
    this list of conditions and the following disclaimer.

2.  Redistributions in binary form must reproduce the above copyright notice,
    this list of conditions and the following disclaimer in the documentation
    and/or other materials provided with the distribution.

3.  Neither the name of the copyright holder nor the names of its contributors
    may be used to endorse or promote products derived from this software
    without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

You may use this script for both non-commercial and commercial products without limitations as long as you fulfill the conditions presented by the above license. The "complete" way to give credit is to include the license somewhere in your product (e.g. in the credits screen), but a "simple" way is also acceptable. The "simple" way to give credit is as follows:
QuoteEasy Party Switcher licensed under BSD License 2.0, Copyright (c) Boris "Blizzard" Mikić

Alternatively, if your font doesn't support diacritic characters, you may use this variant:
QuoteEasy Party Switcher licensed under BSD License 2.0, Copyright (c) Boris "Blizzard" Mikic

In general other similar variants are allowed as long as it is clear who the creator is (e.g. "Easy Party Switcher created by Blizzard" is acceptable). But if possible, prefer to use one of the two variants listed above.

If you fail to give credit and/or claim that this work was created by you, this may result in legal action and/or payment of damages even though this work is free of charge to use normally.


Features

v1.1
v1.2b
v1.21b
v1.7b
v1.8b
v2.0b
v2.1b
v2.11b
v2.3b
v2.32b
v2.4b
v2.41b
v2.42b
v2.43b
v2.5b
v2.51b
v2.6


Screenshots

(http://img528.imageshack.us/img528/871/snap239km0.th.png) (http://img528.imageshack.us/img528/871/snap239km0.png)

Demo

Easy Party Switcher (https://downloads.chaos-project.com/scripts/Easy Party Switcher.zip)
If you can't start the demo, Search for the RMXP FAQ and see what to do.

Script

Just make a new script above main and paste this code into it.
Script Download (https://downloads.chaos-project.com/scripts/Easy Party Switcher.txt)

Instructions

Inside the script in the first comment.

Compatibility

98% compatible with SDK v1.x. 90% compatible with SDK 2.x. Can cause incompatibility issued with other Party Change Systems. WILL corrupt your old savegames.

Credits and Thanks


Author's Notes

For your own sake, do not apply the attribute "must_be_in_party" to a character at the same time with "not_available" or "disabled_for_party" as this WILL disrupt your party and party switch system. Use "forced_position" together with "must_be_in_party" to avoid bugs. Be careful when using "forced_position" with "$game_party.forced_size". Add actors at the very end to be sure the player can't put others after them if the "forced_size" is smaller than the maximum party size.

Character faces go into the "Characters" folder and they have the same name as the character spritesets have with _face added.

If you find any bugs, please report them here:
http://forum.chaos-project.com

That's it! N-Joy! =D
Title: Re: Easy Party Switcher
Post by: Musicmuse on January 10, 2008, 12:17:08 am
Just a quick question...

Is there a way to incorporate a button in the main status menu that can call this script as well?  I'd like the player to be able to change the party whenever they'd like, given of course that the members are available.  I love the script, but this little tweak would really make it perfect for my situation :)

(I'd like a button like "Items", "Save", "Equip", but it would say "Party" or something  similar)
Title: Re: Easy Party Switcher
Post by: Nortos on January 10, 2008, 12:22:22 am
so what you want is just the default menu system but party added to it??? I can do it pretty quickly if that's what u want
EDIT: Here's a quick edit of the default menu, if you want/wanted an edit of someone elses menu just say
http://www.megaupload.com/?d=AUA41NYF (http://www.megaupload.com/?d=AUA41NYF)
Title: Re: Easy Party Switcher
Post by: Musicmuse on January 10, 2008, 01:54:15 pm
That's PERFECT!  Exactly what I'm looking for! ;D

I'm sure these things aren't particularly difficult, but without scripting knowledge all I can really do is read through directions to implement them myself, haha.

So is what I need in the script database for the demo?

EDIT:

It looks like it's in Scene_Menu and you added an option to call the party changer script when you select that option?  If so, I imagine I just have to copy and paste the Scene_Menu script into my own game and add (or rename) the scene_partyswitcher script so that when it calls the script there's actually somewhere to go... ?

EDIT 2:

I got it to work, and now I'm trying to figure out how to implement the same thing as a selectable option in the battle menu (in case a character is dead and needs to be replaced)

... it looks like I'll need to somehow edit the Scene_Battle scripts?
Title: Re: Easy Party Switcher
Post by: Nortos on January 10, 2008, 07:54:14 pm
I don't think it's implemented in this script to change party members in battle I haven't used his easy party script much he'll be able to give better answer but I don't think you can swap in battle
EDIT: You'll also want to use the scene party switcher from my demo as I had to make an edit when press B or "Esc" it goes back to menu and not the map
2nd EDIT: Looking at it it would be hard to implement it into battle not calling it just exiting it, I can think of an easy way to change party members but once you go to screen than exit the battle would start again, you would have to edit this pretty heavily to put it into scene_battle to implement that I think...Blizz will know better though
Title: Re: Easy Party Switcher
Post by: Blizzard on January 11, 2008, 10:54:56 am
I was going to release another version which allowed optional party change during battle. Many people seem to want that feature. I'll do it as soon as I have the time.
Title: Re: Easy Party Switcher
Post by: Fantasist on January 11, 2008, 02:42:48 pm
Yeah! And it's not that difficult, is it?
Title: Re: Easy Party Switcher
Post by: Musicmuse on January 11, 2008, 05:28:35 pm
Thanks for all of the help Nortos!

I'll be looking forward to the update, Blizz

You all are ridiculously nice here, haha.
Title: Re: Easy Party Switcher
Post by: Nortos on January 12, 2008, 12:13:47 am
it's cool Musicmuse and I think it wouldn't be too hard especially for Blizz
Title: Re: Easy Party Switcher
Post by: Blizzard on January 12, 2008, 10:42:52 am
Quote from: FTSYeah! And it's not that difficult, is it?

Scene-in-scene with stuff disposal to prevent too much lag. :3
It should be less than 50 lines of extra code.
Title: Re: Easy Party Switcher
Post by: Vell on January 12, 2008, 11:30:15 am
wow, that'll be pretty awesome. I thought it would be pretty much very very difficult...

however, it was done in GS2, so yeah, i knew it was possible.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on January 26, 2008, 05:38:27 pm
As I said, I only need to make an interruption in the battle scene. All the working code for the extra scene can be called there afterwards without problems.

I have to live up to the title you gave me. ^_^ *points to personal text*

EDIT:

*updates to v2.3b*

EDIT:

*updates to v2.32b*

EDIT:

*updates to v2.4b*
Title: Re: [XP] Easy Party Switcher
Post by: Calintz on January 30, 2008, 03:58:15 pm
Psshh, didn;t want to give it away yet, but in my CMS, I used this feature from the main menu allowing the user to switch his party at any given time ;)
Title: Re: [XP] Easy Party Switcher
Post by: Megansunfire on February 19, 2008, 02:23:09 pm
Hey all.
I was planning on using this script, but did some testing and came up with an error.

It appears that the party switcher gives an error about experience for the reserve and the only way I seem to NOT get the error, is if I set the reserve to recieve 100% experience.

I've tried setting it to 0%, 50% (which I want to do) and it gives me an error that points to this line:

$game_actors.exp += @result_window.exp * EXP_RESERVE/100

I've tried changing that number too, but nothing. :(
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on February 20, 2008, 06:16:48 am
You might be using an older version. In the current version (2.4b) the line says
$game_actors[i].exp += @result_window.exp * BlizzCFG::EXP_RESERVE/100


Try upgrading first.
Title: Re: [XP] Easy Party Switcher
Post by: Megansunfire on February 26, 2008, 07:20:50 pm
Yeah. I upgraded it but I still get an error.
It says this:

' (*)Scene_PartySwitcher' ? 994  NoMethodError
undefined method 'exp' for nil:NilClass

And this is line 994:
$game_actors.exp += @result_window.exp * BlizzCFG::EXP_RESERVE/100

Any ideas?  ???
Title: Re: [XP] Easy Party Switcher
Post by: Quan on February 27, 2008, 12:40:06 am
Man, I might just be a total idiot, but whenever I try to call the script to set characters as disabled_from_party I get a Syntax Error...
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on February 27, 2008, 04:21:00 am
Keep in mind that you have to use

$game_party.actors[0].disabled_for_party =
true


or

$game_party.actors[0].
disabled_for_party = true


and not

$game_party.actors[0].disabled_for_party = true

Title: Re: [XP] Easy Party Switcher
Post by: Quan on February 27, 2008, 08:24:34 am
First of all, thanks for the fast response.  I'm really impressed with your scriptwork and it's awesome that you're so willing to help people get it working.

Now, just to clarify, should I be using the full ID # (001) or just the ultimate value (1)?

I was also gonna say, I don't know how difficult it would be, but it would be nasty if setting the FACESETS option to true replaced the sprites on the regular menu screen as well.  It'd just look so much better!
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on February 27, 2008, 08:57:57 am
The ultimate value without the leading zeroes. My Tons of Add-ons has a faceset add-on that allows that. :)
Title: Re: [XP] Easy Party Switcher
Post by: Quan on February 27, 2008, 09:00:41 am
... I'm obviously going to have to sign up now because Chaos Project is the shiznite.

Yeah, word, I managed to get the party-switching system working, and I actually found and installed the Tons of Add-Ons script.  The one problem with the menu facesets option is that it appears to use a different sized image..  is there any way it could be universalized?
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on February 27, 2008, 09:11:53 am
Actually they should replace the character spriteset. You can easily modify the position. Find the line that says draw_actor_face(actor, x, y) and simply change the values X and Y to adjust the position like draw_actor_face(actor, x+16, y+8) or something like that.
Title: Re: [XP] Easy Party Switcher
Post by: Quan on February 27, 2008, 11:15:47 am
Decided to move my line of inquisition to its own thread, since it's not even about the party switcher anymore:

http://forum.chaos-project.com/index.php?topic=591.msg9365 (http://forum.chaos-project.com/index.php?topic=591.msg9365)
Title: Re: [XP] Easy Party Switcher
Post by: Sin86 on March 19, 2008, 12:09:44 pm
I got a question, so far I like this script but would it be safe to use it along with Blizz ABS?
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on March 19, 2008, 12:54:38 pm
I think yes. I see no reason why it should cause problems with Blizz-ABS. All the system does is to change the actors' positions. I will test it and make it compatible if it isn't.
Title: Re: [XP] Easy Party Switcher
Post by: Sin86 on March 19, 2008, 03:15:08 pm
Just to confirm, no problems while using it with the ABS.

EDIT: Never mind, I found some.

If I use "$game_actors[ID(any)].forced_position" or "Syntax: $scene = Scene_PartySwitcher.new(XXX[be a 0 or a 1 or a 2), 1)" I get an error talking about line 933.

The error is:

"Script 'Scene Party Switcher' line 933: NoMethodError occurred

undefined method `compact!' for nil:NilClass"

Also, how do I do this? Ok, I put in "$scene = Scene_PartySwitcher.new(sometimes I'll either use 1, 2 or 10, doesn't matter)" and all the characters in my party appear. However, I want to make it where none of them will appear on that screen unless I come accross an event that adds characters to my party rather than have all them appear at once. I could use the "$game_actors[ID].disabled_for_party = true/false" but lets say that I am late in my project where I want to go back there and then access all the remaining characters. If I used that syntax, the characters won't appear in there at all and I want them to appear only after any add actor events are done.

For example, on Map001, I got an event on the left which is the party switch and an event on the right, which is the character I wish to add after I talk to him. I go to the left event and the character I wish to add is already in the reserves when of course, he shouldn't be there unless I talk to him(I put up the add character event on his tile). I would like to have this character be in the reserve once I offically get him and not have him automatically be there. If I use that "$game_actors[ID].disabled_for_party = true/false" command after talking to him, he won't be in the reserve regardless if I talk to him or not.
Title: Re: [XP] Easy Party Switcher
Post by: Sase on March 22, 2008, 12:34:47 am
My game freezes if I set not_available to false after setting it to true, but can this be caused with Not_available and Disabled_for_party at the same time? Because I used disabled first and then changed it to not available but I haven't removed the old skript calls.

// oke that wasn't the problem. The problem is, that I can still see the NAMES of the other party members when I move the cursor over an empty slot...... and I don't want that :F

well wtf idk what I did wrong, but now it works -.-
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on March 25, 2008, 10:30:44 am
@ Sin86:

I know, I found the problems myself. Blizz-ABS 1.97 will have it fixed.
You have to turn all characters' disabled_for_party on (set them to true) at the beginning of the game and then progressively set the value for a character to false if you want him to be enabled for party switching.

@Tsurara:
Use
bla.not_available =
true

instead of
bla.not_available = true

Use my Ultimate Font Override from Tons of Add-ons to fix the name problem.
Title: [XP] Easy Party Switcher
Post by: Blizzard on March 31, 2008, 12:25:33 pm
A couple of posts were lost...

Quote from: Schwarzer Frost on March 31, 2008, 10:45:47 am
Ok, thanks. Now the Hero can not be changed. And i have make it that all otther Party Members are not to see in the Party Changer.

But now another Problem. Ich have bind the Party Changer in the Menue with this Code:
when 4# Party Changer
        $game_system.se_play($data_system.decision_se)
      $game_actors[1].must_be_in_party = true
$game_actors[2].disabled_for_party = true
  $game_actors[3].disabled_for_party = true
    $game_actors[4].disabled_for_party = true
$game_actors[5].disabled_for_party = true

        $scene = Scene_PartySwitcher.new


But when the Hero a new Person meet and she tell him that she will come with him. What have i do that in the Party Changer the Girl appear?


No, this will disable the characters each time you enter the party changer. Use only:

when 4# Party Changer
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_PartySwitcher.new


When you start the game, use an event. There is a command on the 3rd tab, bottom right which says "Call Script". In there you should add this:

$game_actors[1].must_be_in_party = true
$game_actors[2].disabled_for_party = true
$game_actors[3].disabled_for_party = true
$game_actors[4].disabled_for_party = true
$game_actors[5].disabled_for_party = true


to disable those party members at the beginning of the game. Then, when you want to unlock somebody in your game, just use another Call Script command in an event with:

$game_actors[ID].must_be_in_party =
false

Title: Glitch with "Easy Party Switcher" (by blizzard)
Post by: evil1357 on August 04, 2008, 12:38:09 am
Hey guys, I found a weird glitch with "Easy Party Switcher", if you have a dead actor and you switch the party around so that only person in the party is the dead actor, it lets you continue with only dead actor's in the group, then the game runs fine until you enter battle then you get a instant game over, is this fixable?

EDIT: oops I didn't see the "post in the database thread instead", should I post the bug there or is that necroposting? :S

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Easy Party Switcher by Blizzard
# Version 2.4b
# Type: Party Changing System
# Date: 21.05.2006
# Date v1.1: 25.05.2006
# Date v1.2b: 27.05.2006
# Date v1.5b: 3.11.2006
# Date v1.51b: 29.11.2006
# Date v1.52b: 6.12.2006
# Date v1.7b: 23.2.2007
# Date v1.8b: 30.4.2007
# Date v2.0b: 7.8.2007
# Date v2.1b: 24.8.2007
# Date v2.11b: 24.9.2007
# Date v2.3b: 26.1.2008
# Date v2.32b: 28.1.2008
# Date v2.4b: 29.1.2008
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#   
#  This work is protected by the following license:
# #----------------------------------------------------------------------------
# # 
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# # 
# #  You are free:
# # 
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# # 
# #  Under the following conditions:
# # 
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# # 
# #  Noncommercial. You may not use this work for commercial purposes.
# # 
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# # 
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# # 
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# # 
# #  - Nothing in this license impairs or restricts the author's moral rights.
# # 
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Special Thanks to:
#
#   Zeriab for pointing out a few glitches and shortening the code in an
#   earlier version. =D
#
#
# IMPORTANT NOTE:
#
#   Be sure to set the MAX_PARTY to the maximum size of your party. There is
#   already a preconfiguration of 4.
#
#
# Compatibility:
#
#   98% compatible with SDK v1.x. 90% compatible with SDK 2.x. Can cause
#   incompatibility issued with other Party Change Systems. Can cause problems
#   with CBS-es if you use the battle switch feature. WILL corrupt your old
#   savegames.
#
#
# Features:
#
#   - set party members for "not _available" (shown transparent in the reserve)
#   - remove party members from the reserve list ("disabled_for_party")
#   - set party members, who MUST be in the party (shown transparent in the
#     current party, "must_be_in_party")
#   - set up forced positions for party members
#   - set up forced party size
#   - option either to wipe the party (for multi-party use) or only remove
#     every member (except 1) from the party.
#   - easy to use and easy to switch party members
#   - also supports small parties (2 or 3 members) and large parties (5 or
#     more)
#   - uses facesets optionally
#
# v1.5b:
#   - better, shorter and more efficient code (less memory use, less CPU use)
#   - fixed potential bugs
#
# v1.7b:
#   - improved coding
#   - facesets now optional
#   - no extra bitmap files needed anymore
#   - works now with Tons of Add-ons
#
# v1.8b:
#   - added "forced position"
#   - added "forced party size"
#
# v2.0b:
#   - fixed the bug where you could empty the party... again...
#   - fixed the bug that appeared when you pressed SHIFT
#   - added option to allow an empty party
#   - added "EXP for party members in reserve" option
#   - made the forced_size for party work more convenient
#   - improved coding
#   - slightly decreased lag
#
# v2.1b:
#   - fixed a bug
#   - improved coding
#   - rewritten conditions using classic syntax to avoid RGSS conditioning bug
#   - now can serve as enhancement for CP Debug System
#
# v2.11b:
#   - improved coding and performance
#
# v2.3b:
#   - optional feature to call the Party Switcher during battle
#
# v2.32b:
#   - fixed crash problem with SDK 2.x when using the BATTLE_SWITCH option
#   - fixed SP display glitch when using BARS from Tons of Add-ons
#
# v2.4b:
#   - now you can activate party order change only in the party switcher
#   - add option for automatic party order change only in battle
#
#
# How to use:
#
#   To call this script, make a "Call script" command in an event.
#
#   1. Syntax: $scene = Scene_PartySwitcher.new
#      No extra feature will be applied and you can switch the party as you
#      wish.
#
#   2. Syntax: $scene = Scene_PartySwitcher.new(XXX)
#      You can replace XXX for 1 to remove all party members except one (either
#      one, who must be in the party or a random one), or replace XXX with 2,
#      to cause a wipe party. Wiping a party will disable the of the current
#      members and a NEW party of the remaining members must be formed. If you
#      replace it with 3, the current party configuration will be stored for a
#      later fast switch-back. If XXX is 10, all actors will be available for
#      party switching no matter if the are "not_available" or
#      "disabled_for_party". This feature if used by the CP Debug System. No
#      faceset will be used in this case for a more convenient working.
#
#   3. Syntax: $scene = Scene_PartySwitcher.new(XXX, 1)
#      You can use the XXX as described above or just set it to 0 to disable
#      it. Also the "1" in the syntax will reset any disabled_for_party and is
#      made to be used after multi-party use.
#
#   4. Syntax: $scene = Scene_PartySwitcher.new(XXX, YYY, ZZZ)
#      You can replace ZZZ with 1 to replace the party with a stored one AND
#      store the current or replace it with 2 to replace the party with a
#      stored one, but without storing the current. USE THIS ONLY IF YOU ASSUME
#      TO HAVE A STORED PARTY READY! You can simply test if there is a store
#      party by putting this code into the conditional branch script:
#
#      $game_system.stored_party != nil
#
#      This syntax will not open the Party Switcher and it will override the
#      commands XXX and YYY, so you can replace these with any number.
#   
#   5. To activate/deactivate the option of order change only, simply use the
#      event command "Call Script" with following syntax:
#     
#      $game_system.order_only = true/false
#     
#      If the setting is set to true, the switcher will allow only party order
#      change. The same goes for battle change (if you are using the
#      BATTLE_SWITCH option), but the syntax is different:
#     
#      $game_system.battle_order_only = true/false
#     
#   Character faces go into the "Characters" folder and they have the same name
#   as the character spritesets have with _face added
#
#   Example:
#
#     sprite - Marlen.png
#     face   - Marlen_face.png
#
#   Other syntaxes:
#     $game_actors[ID].not_available = true/false
#     $game_actors[ID].disabled_for_party = true/false
#     $game_actors[ID].must_be_in_party = true/false
#     $game_actors[ID].forced_position = nil/0/1/2/...
#   OR
#     $game_party.actors[POS].not_available = true/false
#     $game_party.actors[POS].disabled_for_party = true/false
#     $game_party.actors[POS].must_be_in_party = true/false
#     $game_party.actors[POS].forced_position = nil/0/1/2/...
#
#   ID  - the actor's ID in the database
#   POS - the actor's position in the party (STARTS FROM 0, not 1!)
#
#   not_available
#   - will disable the possibility of an already unlocked character to be in
#     the current party
#
#   disabled_for_party
#   - will cause the character NOT to appear in the party switch screen at all
#
#   must_be_in_party
#   - will cause the character to be automatically moved into the current party
#     and he also cannot be put in the reserve
#
#   forced_position
#   - will enforce the player to be at a specific position in the party, set
#     this value to nil to disable this feature, use it in combination with
#     must_be_in_party and $game_party.forced_size or you might experience
#     bugs,
#
#   $game_party.forced_size = nil/0/1/2/...
#
#   Using this syntax will enforce a specific party size. The EPS won't exit
#   until this size is filled up or there are no more in the reserve. EPS will
#   automatically "correct" this number if there are not enough characters in
#   the reserve to fill up a party of forced_size. Set this value to nil to
#   disable the size requirement. Note that the actor DO NOT HAVE TO be set in
#   normal order without any empty position like in version 1.x.
#
#
# Additional note:
#
#   For your own sake, do not apply the attribute "must_be_in_party" to a
#   character at the same time with "not_available" or "disabled_for_party" as
#   this WILL disrupt your party and party switch system. Use "forced_position"
#   together with "must_be_in_party" to avoid bugs. Be careful when using
#   "forced_position" with "$game_party.forced_size". Add actors at the very
#   end to be sure the player can't put others after them if the "forced_size"
#   is smaller than the maximum party size.
#
#
# If you find any bugs, please report them here:
# http://www.chaosproject.co.nr
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#==============================================================================
# module BlizzCFG
#==============================================================================

module BlizzCFG

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Conficuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  # how many party members do you use
  MAX_PARTY = 4
  # set to true to use facesets instead of spritesets
  FACESETS = true
  # allows a party with 0 members
  ALLOW_EMPTY_PARTY = false
  # allows switching the party in battle
  BATTLE_SWITCH = false
  # gives all other characters EXP (specify in %)
  EXP_RESERVE = 50
  # gives "not available" characters EXP (specify in %)
  EXP_NOT_AVAILABLE = 0
  # gives "disabled for party" characters EXP (specify in %)
  EXP_DISABLED_FOR_PARTY = 0
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Conficuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

end

# recognition variable for plug-ins
$easy_party_switcher = 2.4

#==============================================================================
# Game_Actor
#==============================================================================

class Game_Actor < Game_Battler

  attr_accessor :must_be_in_party
  attr_accessor :disabled_for_party
  attr_accessor :not_available
  attr_accessor :forced_position
 
  alias setup_eps_later setup
  def setup(actor_id)
    setup_eps_later(actor_id)
    @must_be_in_party = @disabled_for_party = @not_available = false
  end
 
end

#==============================================================================
# Game_System
#==============================================================================

class Game_System

  attr_accessor :stored_party
  attr_accessor :order_only
  attr_accessor :battle_order_only
 
  alias init_eps_later initialize
  def initialize
    init_eps_later
    @order_only = @battle_order_only = false
  end
 
end

#==============================================================================
# Game_Party
#==============================================================================

class Game_Party

  attr_accessor :actors
  attr_accessor :forced_size
 
  def any_forced_position
    return (@actors.any? {|actor| actor != nil && actor.forced_position != nil})
  end
 
end

#==============================================================================
# Window_Base
#==============================================================================

class Window_Base

  alias draw_actor_graphic_eps_later draw_actor_graphic
  def draw_actor_graphic(actor, x, y)
    if actor != nil && actor.character_name != ''
      classes = [Window_Current, Window_Reserve, Window_HelpStatus]
      if BlizzCFG::FACESETS && !$all_available && classes.include?(self.class)
        draw_actor_face_eps(actor, x, y)
      else
        if classes.include?(self.class)
          bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
          x += bitmap.width / 8 + 24
          y += bitmap.height / 4 + 16
        end
        draw_actor_graphic_eps_later(actor, x, y)
      end
    end
  end

  def draw_actor_face_eps(actor, x, y)
    if $tons_version == nil || $tons_version < 3.71 || !FACE_HUE
      hue = 0
    else
      hue = actor.character_hue
    end
    bitmap = RPG::Cache.character("#{actor.character_name}_face", hue)
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    if actor.not_available || actor.must_be_in_party
      self.contents.blt(x, y, bitmap, src_rect, 128)
    else
      self.contents.blt(x, y, bitmap, src_rect)
    end
  end
 
end

#==============================================================================
# Window_BattleResult
#==============================================================================

class Window_BattleResult
 
  attr_reader :exp
 
end

#==============================================================================
# Window_Current
#==============================================================================

class Window_Current < Window_Selectable

  def initialize
    super(0, 0, 240 + 32, (BlizzCFG::MAX_PARTY > 4 ? 480 : BlizzCFG::MAX_PARTY * 120))
    self.contents = Bitmap.new(width - 32, 448 + (BlizzCFG::MAX_PARTY-4) * 120)
    @item_max = BlizzCFG::MAX_PARTY
    if $fontface != nil
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
    end
    self.contents.font.size = 24
    refresh
    self.active, self.index, self.z = false, -1, 5000
  end
 
  def refresh
    self.contents.clear
    $game_party.actors.each_index {|i|
        if $game_party.actors[i] != nil
          draw_actor_graphic($game_party.actors[i], 4, i*120+4)
          draw_actor_name($game_party.actors[i], 152, i*120-4)
          draw_actor_level($game_party.actors[i], 88, i*120-4)
          draw_actor_hp($game_party.actors[i], 88, i*120+24)
          draw_actor_sp($game_party.actors[i], 88, i*120+52)
        end}
  end

  def setactor(index_1, index_2)
    $game_party.actors[index_2], $game_party.actors[index_1] =
        $game_party.actors[index_1], $game_party.actors[index_2]
    refresh
  end

  def getactor(index)
    return $game_party.actors[index]
  end
 
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
      return
    end
    row = @index / @column_max
    self.top_row = row if row < self.top_row
    self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
    y = (@index / @column_max) * 120 - self.oy
    self.cursor_rect.set(0, y, self.width - 32, 88)
  end

  def clone_cursor
    row = @index / @column_max
    self.top_row = row if row < self.top_row
    self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
    y = (@index / @column_max) * 120
    src_rect = Rect.new(0, 0, self.width, 88)
    bitmap = Bitmap.new(self.width-32, 88)
    bitmap.fill_rect(0, 0, self.width-32, 88, Color.new(255, 255, 255, 192))
    bitmap.fill_rect(2, 2, self.width-36, 84, Color.new(255, 255, 255, 80))
    self.contents.blt(0, y, bitmap, src_rect, 192)
  end
 
  def top_row
    return self.oy / 116
  end

  def top_row=(row)
    self.oy = (row % row_max) * 120
  end

  def page_row_max
    return (self.height / 120)
  end

end

#==============================================================================
# Window_Reserve
#==============================================================================

class Window_Reserve < Window_Selectable
 
  attr_reader :actors
 
  def initialize(scene)
    super(0, 0, 368, 320)
    setup
    @column_max, rows = 3, @item_max / @column_max
    self.contents = Bitmap.new(width - 32, (rows >= 3 ? rows * 96 : height - 32))
    if $fontface != nil
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
    end
    self.contents.font.size = 24
    self.active, self.index, self.z = false, -1, 5000
    refresh
    if scene == Scene_Map && $game_system.order_only ||
        scene == Scene_Battle && $game_system.battle_order_only
      self.opacity = 128
    end
  end
 
  def setup
    @actors = []
    (1...$data_actors.size).each {|i|
        unless $game_party.actors.include?($game_actors[i]) ||
            $game_actors[i].disabled_for_party && !$all_available
          @actors.push($game_actors[i])
        end}
    @item_max = (@actors.size + $game_party.actors.size + 3) / 3 * 3
  end
 
  def refresh
    self.contents.clear
    @actors.each_index {|i| draw_actor_graphic(@actors[i], i%3*112+16, i/3*96+8)}
  end
 
  def getactor(index)
    return @actors[index]
  end
 
  def get_number
    return (@actors.find_all {|actor| actor != nil}).size if $all_available
    return (@actors.find_all {|actor| actor != nil && !actor.not_available}).size
  end
 
  def setactor(index_1, index_2)
    @actors[index_1], @actors[index_2] = @actors[index_2], @actors[index_1]
    refresh
  end

  def setparty(index_1, index_2)
    @actors[index_1], $game_party.actors[index_2] =
        $game_party.actors[index_2], @actors[index_1]
    refresh
  end

  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
      return
    end
    row = @index / @column_max
    self.top_row = row if row < self.top_row
    self.top_row = row - (page_row_max-1) if row > top_row + (page_row_max-1)
    x, y = (@index % @column_max)*112 + 8, (@index / @column_max)*96 - self.oy
    self.cursor_rect.set(x, y, 96, 96)
  end

  def clone_cursor
    row = @index / @column_max
    self.top_row = row if row < self.top_row
    self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
    x, y = (@index % @column_max) * 112 + 8, (@index / @column_max) * 96
    src_rect = Rect.new(0, 0, 96, 96)
    bitmap = Bitmap.new(96, 96)
    bitmap.fill_rect(0, 0, 96, 96, Color.new(255, 255, 255, 192))
    bitmap.fill_rect(2, 2, 92, 92, Color.new(255, 255, 255, 80))
    self.contents.blt(x, y, bitmap, src_rect, 192)
  end
 
  def top_row
    return self.oy / 96
  end

  def top_row=(row)
    row = row % row_max
    self.oy = row * 96
  end

  def page_row_max
    return (self.height - 32) / 96
  end

end

#==============================================================================
# Window_HelpStatus
#==============================================================================

class Window_HelpStatus < Window_Base

  def initialize(gotactor, scene)
    super(0, 0, 400 - 32, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    if $fontface != nil
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
    end
    self.contents.font.size = 24
    refresh(gotactor)
    self.active, self.z = false, 5000
    if scene == Scene_Map && $game_system.order_only ||
        scene == Scene_Battle && $game_system.battle_order_only
      self.opacity = 128
    end
  end
 
  def refresh(actor)
    self.contents.clear
    if actor != nil
      self.contents.font.color = normal_color
      if actor.not_available && !$all_available
        self.contents.draw_text(8, 0, 160, 32, 'not available', 0)
      end
      draw_actor_graphic(actor, 0, 40)
      draw_actor_name(actor, 160, 32)
      draw_actor_level(actor, 96, 32)
      draw_actor_hp(actor, 96, 64)
      draw_actor_sp(actor, 96, 96)
    end
  end

end

#==============================================================================
# Window_Warning
#==============================================================================

class Window_Warning < Window_Base

  def initialize(mode, members)
    super(0, 0, 320, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    if $fontface != nil
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
    end
    self.contents.font.size = 24
    self.x, self.y, self.z = 320 - width/2, 240 - height/2, 9999
    self.contents.font.color = normal_color
    if mode
      self.contents.draw_text(0, 0, 288, 32, 'You need a party', 1)
      num = [$game_party.forced_size, members + $game_party.actors.nitems].min
      self.contents.draw_text(0, 32, 288, 32, "of #{num} members!", 1)
    else
      self.contents.draw_text(0, 0, 288, 32, 'You cannot remove', 1)
      self.contents.draw_text(0, 32, 288, 32, 'the last party member!', 1)
    end
  end

end

if BlizzCFG::BATTLE_SWITCH
#==============================================================================
# Window_PartyCommand
#==============================================================================

class Window_PartyCommand < Window_Selectable
 
  def initialize
    super(0, 0, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 160
    @commands = ['Fight', 'Escape', 'Switch']
    @item_max = @column_max = 3
    draw_item(0, normal_color)
    draw_item(1, $game_temp.battle_can_escape ? normal_color : disabled_color)
    draw_item(2, normal_color)
    self.active, self.visible, self.index = false, false, 0
  end
 
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(80 + index * 160 + 4, 0, 128 - 10, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index], 1)
  end
 
  def update_cursor_rect
    self.cursor_rect.set(80 + index * 160, 0, 128, 32)
  end
 
  def command(index = self.index)
    return @commands[index]
  end
 
end
end

#==============================================================================
# Scene_PartySwitcher
#==============================================================================

class Scene_PartySwitcher
 
  def initialize(wipe_party = 0, reset = 0, store = 0)
    @wipe_party, @store, @reset = store, reset, wipe_party
    @current_window_temp = @reserve_window_temp = 0
    @scene_flag, @temp_window = false, ''
    @scene = $scene.class
  end
 
  def main
    if @store != 0
      swap_parties
      $scene = Scene_Map.new
      $game_player.refresh
      return
    end
    case @wipe_party
    when 1 then setup_forced_party
    when 2 then wipe_party
    when 3
      $game_system.stored_party = $game_party.actors
      wipe_party
    when 10 then $all_available = true
    end
    if @reset == 1
      (1...$data_actors.size).each {|i| $game_actors[i].not_available = false}
    end
    @current_window = Window_Current.new
    @current_window.index, @current_window.active = 0, true
    @reserve_window = Window_Reserve.new(@scene)
    @reserve_window.x, @reserve_window.y = 272, 160
    @help_window = Window_HelpStatus.new(@reserve_window.getactor(0), @scene)
    @help_window.x = 240 + 32
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    Graphics.freeze
    [@current_window, @reserve_window, @help_window].each {|win| win.dispose}
    $game_party.actors.compact!
    $game_player.refresh
    $all_available = nil
  end
 
  def update
    check = @reserve_window.index
    if @reserve_window.active
      reserve_update
      @reserve_window.update
    end
    if check != @reserve_window.index
      if @reserve_window.active
        actor = @reserve_window.getactor(@reserve_window.index)
      elsif @current_window.active
        actor = @reserve_window.getactor(@reserve_window_temp)
      end
      @help_window.refresh(actor) if ['', 'Current'].include?(@temp_window)
    end
    current_update if @current_window.active
    if Input.trigger?(Input::B)
      if @scene_flag
        $game_system.se_play($data_system.cancel_se)
        @scene_flag, @temp_window = false, ''
        if @reserve_window.active
          actor = @reserve_window.getactor(@reserve_window.index)
        elsif @current_window.active
          actor = @reserve_window.getactor(@reserve_window_temp)
        end
        @help_window.refresh(actor) if ['', 'Current'].include?(@temp_window)
        [@current_window, @reserve_window].each {|win| win.refresh}
        return
      end
      if $game_party.forced_size != nil &&
          ($game_party.forced_size < $game_party.actors.nitems ||
          ($game_party.forced_size > $game_party.actors.nitems &&
          @reserve_window.get_number != 0))
        $game_system.se_play($data_system.buzzer_se)
        warning(true)
        return
      end
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::A)
      if $game_party.any_forced_position
        $game_system.se_play($data_system.buzzer_se)
      else
        $game_system.se_play($data_system.decision_se)
        $game_party.actors.compact!
        @current_window.refresh
      end
    end
  end
   
  def current_update
    @current_window.update
    if Input.trigger?(Input::C)
      actor = @current_window.getactor(@current_window.index)
      if actor != nil && actor.forced_position != nil
        $game_system.se_play($data_system.buzzer_se)
      else
        if @scene_flag
          switch_members
        else
          $game_system.se_play($data_system.decision_se)
          @scene_flag, @temp_window = true, 'Current'
          @temp_actor_index = @current_window.index
          @current_window.clone_cursor
        end
      end
    elsif Input.trigger?(Input::RIGHT)
      if @scene == Scene_Map && $game_system.order_only ||
          @scene == Scene_Battle && $game_system.battle_order_only
        $game_system.se_play($data_system.buzzer_se)
      else
        $game_system.se_play($data_system.cursor_se)
        @current_window.active = false
        @reserve_window.active = true
        @current_window_temp = @current_window.index
        actor = @reserve_window.getactor(@reserve_window_temp)
        @current_window.index = -1
        @reserve_window.index = @reserve_window_temp
        @help_window.refresh(actor) unless @scene_flag
      end
    end
  end
 
  def reserve_update
    if Input.trigger?(Input::C)
      if @scene_flag
        switch_members
      else
        $game_system.se_play($data_system.decision_se)
        @scene_flag, @temp_window = true, 'Reserve'
        @temp_actor_index = @reserve_window.index
        @reserve_window.clone_cursor
      end
    elsif @reserve_window.index % 3 == 0 && Input.repeat?(Input::LEFT)
      $game_system.se_play($data_system.cursor_se)
      @reserve_window.active = false
      @current_window.active = true
      @reserve_window_temp = @reserve_window.index
      @reserve_window.index = -1
      @current_window.index = @current_window_temp
    end
  end
 
  def switch_members
    if @temp_window == 'Reserve' && @reserve_window.active
      @reserve_window.setactor(@temp_actor_index, @reserve_window.index)
      actor = @reserve_window.getactor(@reserve_window.index)
      @help_window.refresh(actor)
    end
    if @temp_window == 'Current' && @current_window.active
      @current_window.setactor(@temp_actor_index, @current_window.index)
    end
    if @temp_window == 'Reserve' && @current_window.active
      actor1 = @current_window.getactor(@current_window.index)
      actor2 = @reserve_window.getactor(@temp_actor_index)
      if call_warning?(@current_window.index, actor2)
        if actor1 != nil && actor1.must_be_in_party
          $game_system.se_play($data_system.buzzer_se)
          @scene_flag, @temp_window = false, ''
          actor = @reserve_window.getactor(@reserve_window_temp)
          [@current_window, @reserve_window].each {|win| win.refresh}
          @help_window.refresh(actor)
          return
        end
        if actor2 != nil && actor2.not_available && !$all_available
          $game_system.se_play($data_system.buzzer_se)
          @scene_flag, @temp_window = false, ''
          actor = @reserve_window.getactor(@reserve_window_temp)
          [@current_window, @reserve_window].each {|win| win.refresh}
          @help_window.refresh(actor)
          return
        end
        @reserve_window.setparty(@temp_actor_index, @current_window.index)
        @current_window.refresh
        actor = @reserve_window.getactor(@reserve_window_temp)
        @help_window.refresh(actor)
      else
        warning
      end
    end
    if @temp_window == 'Current' && @reserve_window.active
      actor1 = @current_window.getactor(@temp_actor_index)
      actor2 = @reserve_window.getactor(@reserve_window.index)
      if call_warning?(@temp_actor_index, actor2)
        if actor1 != nil && actor1.must_be_in_party
          $game_system.se_play($data_system.buzzer_se)
          @scene_flag, @temp_window = false, ''
          actor = @reserve_window.getactor(@reserve_window.index)
          [@current_window, @reserve_window].each {|win| win.refresh}
          @help_window.refresh(actor)
          return
        end
        if actor2 != nil && actor2.not_available && !$all_available
          $game_system.se_play($data_system.buzzer_se)
          @scene_flag, @temp_window = false, ''
          actor = @reserve_window.getactor(@reserve_window.index)
          [@current_window, @reserve_window].each {|win| win.refresh}
          @help_window.refresh(actor)
          return
        end
        @reserve_window.setparty(@reserve_window.index, @temp_actor_index)
        @current_window.refresh
        actor = @reserve_window.getactor(@reserve_window.index)
        @help_window.refresh(actor)
      else
        warning
      end
    end
    $game_system.se_play($data_system.decision_se)
    @scene_flag, @temp_window = false, ''
  end
   
  def wipe_party
    $game_party.actors.each {|actor| actor.not_available = true if actor != nil}
    setup_forced_party(true)
    if $game_party.actors == []
      (1...$data_actors.size).each {|i|
          unless $game_actors[i].not_available ||
              $game_actors[i].disabled_for_party
            $game_party.actors.push($game_actors[i])
            return
          end}
    end
  end
 
  def setup_forced_party(flag = false)
    $game_party.actors, party = [], []
    (1...$data_actors.size).each {|i|
        if $game_actors[i] != nil && $game_actors[i].must_be_in_party &&
             (!$game_actors[i].disabled_for_party || flag) &&
             !$game_actors[i].not_available
          party.push($game_actors[i])
        end}
    party.clone.each {|actor|
        if actor.forced_position != nil
          $game_party.actors[actor.forced_position] = actor
          party.delete(actor)
        end}
    $game_party.actors.each_index {|i|
        $game_party.actors[i] = party.shift if $game_party.actors[i] == nil}
    $game_party.actors += party.compact
  end 
 
  def swap_parties
    $game_party.actors.compact!
    temp_actors = $game_party.actors
    temp_actors.each {|actor| actor.not_available = true}
    $game_system.stored_party.compact!
    $game_system.stored_party.each {|actor| actor.not_available = false}
    $game_party.actors = $game_system.stored_party
    $game_system.stored_party = (@store == 1 ? temp_actors : nil)
  end
 
  def call_warning?(index, actor2)
    return (BlizzCFG::ALLOW_EMPTY_PARTY || $game_party.actors[index] == nil ||
        actor2 != nil || $game_party.actors.nitems > 1)
  end
 
  def warning(flag = false)
    $game_system.se_play($data_system.buzzer_se)
    @warning_window = Window_Warning.new(flag, @reserve_window.get_number)
    loop do
      Graphics.update
      Input.update
      if Input.trigger?(Input::C)
        $game_system.se_play($data_system.decision_se) if flag
        [@current_window, @reserve_window].each {|win| win.refresh}
        @warning_window.dispose
        @warning_window = nil
        break
      end
    end
  end
 
end

#==============================================================================
# Scene_Battle
#==============================================================================
 
class Scene_Battle
 
  alias update_phase2_eps_later update_phase2
  def update_phase2
    update_phase2_eps_later
    if Input.trigger?(Input::C) && @party_command_window.index == 2
      $game_system.se_play($data_system.decision_se)
      @spriteset.dispose
      $scene = Scene_PartySwitcher.new
      $scene.main
      $scene = self
      @spriteset = Spriteset_Battle.new
      15.times {@spriteset.update}
      @status_window.refresh
      Graphics.transition(0)
    end
  end
 
  alias start_phase5_eps_later start_phase5
  def start_phase5
    start_phase5_eps_later
    (1...$data_actors.size).each {|i|
        unless $game_party.actors.include?($game_actors[i])
          if $game_actors[i].not_available
            $game_actors[i].exp += @result_window.exp * BlizzCFG::EXP_NOT_AVAILABLE/100
          elsif $game_actors[i].disabled_for_party
            $game_actors[i].exp += @result_window.exp * BlizzCFG::EXP_DISABLED_FOR_PARTY/100
          else
            $game_actors[i].exp += @result_window.exp * BlizzCFG::EXP_RESERVE/100
          end
        end}
  end
 
end
Title: Re: Glitch with "Easy Party Switcher" (by blizzard)
Post by: Starrodkirby86 on August 04, 2008, 01:03:54 am
Hi.

I decided to try out your problem by setting Aluxes to an instant death. I then had some more party members, that usual stuff. I let Aluxes stay alone, and that problem has arisen, yes. I'm sure you can do a little bit eventing or scripting to make sure you'll get a Gameover when you have something like that, but that should be in the next version of the Easy Party Switcher...Indeed.

By the way, it's okay to necropost! Check out the rules, as long as your posts are constructive, then you are perfectly okay to gravedig up a thread.
Title: Re: Glitch with "Easy Party Switcher" (by blizzard)
Post by: GAX on August 04, 2008, 01:12:31 am
It's not a glitch, but it should be looked at.  Here's pretty much how it is.  In RMXP, Game Over due to character death normally only happens in battle.  I know because I've personally killed my entire party and done these tests.  So, this isn't a glitch really, but EPS should have a check for these kinds of things.

Should this topic be closed?
Title: Re: Glitch with "Easy Party Switcher" (by blizzard)
Post by: Starrodkirby86 on August 04, 2008, 01:17:14 am
I wouldn't mind either solution, but for me, my gut instinct is to wait for Blizzard's answer. He might have devised some intricate scripting for his answer, you know? But it's okay to lock this up, since Blizzard can unlock it anyway. xD
Title: Re: Glitch with "Easy Party Switcher" (by blizzard)
Post by: Blizzard on August 04, 2008, 05:58:34 am
Yes, that is a problem in the script. I'll fix that in the next release.

EDIT: There you go.
Title: Re: [XP] Easy Party Switcher
Post by: evil1357 on August 06, 2008, 10:36:24 pm
Yay no more dead people!  :haha:
Title: Re: [XP] Easy Party Switcher
Post by: TheHackMan on August 14, 2008, 09:38:40 pm
Just put this in there and I appear to have a problem where the main character is now frozen.

I have it set to disable every other party member at first as I don't want them accessing the any other characters right off the bat until they complete the quests and other requirements to access the other characters using:
$game_actors[ID].disabled_for_party = true (replacing ID with the numbers of all the other characters available)

Later on when lets say I complete quest A and talk to person C then I want to enable character number two so in the event menu I use a conditional branch and since Quest A is complete now I have it call the script:
$game_actors[2].disabled_for_party = false

Now when this happens the main character freezes and no longer moves. I can access the party change menu just fine, all other events move and act as they should but no matter what I do I am unable to move my character after this.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on August 15, 2008, 05:36:28 am
Quote from: Blizzard on March 25, 2008, 10:30:44 am
@Tsurara:
Use
bla.not_available =
true

instead of
bla.not_available = true

Title: Re: [XP] Easy Party Switcher
Post by: TheHackMan on August 15, 2008, 02:33:50 pm
Awesome, everything works 100% now. Amazing script btw it helps out a ton
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on August 15, 2008, 04:19:38 pm
I personally use it in my game only as extension for the debugger.
Title: Re: [XP] Easy Party Switcher
Post by: praifust on September 06, 2008, 05:19:38 am
now i wanna add some information in hero's status such as age, weigh, height, systemic pix and instead of hero's face i only wanna  display the name rustle place for status     
i need help even though it is simple cuz i am not a exped scriper ^"^ on fact im teaching myself ruby ^^!
help me
anyway thanks cuz read ^^!
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on September 06, 2008, 05:38:11 am
I suggest that you ask somebody to do the edits for you.
Title: Re: [XP] Easy Party Switcher
Post by: praifust on September 06, 2008, 06:04:48 am
r u spam ^"^ it is not a helpful suggestion ^"^
who i can ask V_+
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on September 06, 2008, 08:40:16 am
I meant that you should ask somebody else to do the edit because I will not. And script requests are posted here (http://forum.chaos-project.com/index.php?board=30.0) and not in the topics of the scripts.
Title: Need help with blizz's party switcher
Post by: omegapirate2000 on October 12, 2008, 02:00:38 pm
So I want to get this script to work in battle as well as on the map, because when I call this in battle and exit it just brings me back to the map rather than in battle. :/

Also, I'm using the SDK, sooooo...

Easy Party Switcher: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Easy Party Switcher by Blizzard
# Version 2.0b
# Date: 21.05.2006
# Date v1.1: 25.05.2006
# Date v1.2b: 27.05.2006
# Date v1.5b: 3.11.2006
# Date v1.51b: 29.11.2006
# Date v1.52b: 6.12.2006
# Date v1.7b: 23.2.2007
# Date v1.8b: 30.4.2007
# Date v2.0b: 7.8.2007
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Special Thanks to:
# Zeriab for pointing out a few glitches and shortening the code. =D
#
#
# IMPORTANT NOTE:
#
# Be sure to set the MAX_PARTY to the maximum size of your party.
# There is already a preconfiguration of 4.
#
#
# Compatibility:
#
# 98% compatible with SDK v1.x. 90% compatible with SDK 2.x. Can cause
# incompatibility issued with other Party Change Systems. WILL corrupt your old
# savegames.
#
#
# Features:
#
# - set party members for "not _available" (shown transparent in the reserve)
# - remove party members from the reserve list ("disabled_for_party")
# - set party members, who MUST be in the party (shown transparent in the
#   current party, "must_be_in_party")
# - set up forced positions for party members
# - set up forced party size
# - option either to wipe the party (for multi-party use) or only remove every
#   member (except 1) from the party.
# - easy to use and easy to switch party members
# - also supports small parties (2 or 3 members) and large parties (5 or more)
# - uses facesets optionally
#
# v1.5b:
# - better, shorter and more efficient code (less memory use, less CPU use)
# - fixed potential bugs
#
# v1.7b:
# - improved coding
# - facesets now optional
# - no extra bitmap files needed anymore
# - works now with Tons of Add-ons
#
# v1.8b:
# - added "forced position"
# - added "forced party size"
#
# v2.0b:
# - fixed the bug where you could empty the party... again...
# - fixed the bug that appeared when you pressed SHIFT
# - added option to allow an empty party
# - added "EXP for party members in reserve" option
# - made the forced_size for party work more convenient
# - improved coding
# - slightly decreased lag
#
#
# How to use:
#
# To call this script, make a "Call script" command in an event.
#
# 1. Syntax: $scene = Scene_PartySwitcher.new
#    No extra feature will be applied and you can switch the party as you wish.
#
# 2. Syntax: $scene = Scene_PartySwitcher.new(XXX)
#    You can replace XXX for 1 to remove all party members except one (either
#    one, who must be in the party or a random one), or replace XXX with 2, to
#    cause a wipe party. Wiping a party will disable the of the current members
#    and a NEW party of the remaining members must be formed. If you replace it
#    with 3, the current party configuration will be stored for a later fast
#    switch-back.
#
# 3. Syntax: $scene = Scene_PartySwitcher.new(XXX, 1)
#    You can use the XXX as described above or just set it to 0 to disable it.
#    Also the "1" in the syntax will reset any disabled_for_party and is made
#    to be used after multi-party use.
#
# 4. Syntax: $scene = Scene_PartySwitcher.new(XXX, YYY, ZZZ)
#    You can replace ZZZ with 1 to replace the party with a stored one AND
#    store the current or replace it with 2 to replace the party with a stored
#    one, but without storing the current. USE THIS ONLY IF YOU ASSUME TO HAVE
#    A STORED PARTY READY! You can simply test if there is a store party by
#    putting this code into the conditional branch script:
#
# $game_system.stored_party != nil
#
# This syntax will not open the Party Switcher and it will override the
# commands XXX and YYY, so you can replace these with any number.
#
# - Character faces go into the "Characters" folder and they have the same name
# as the character spritesets have with _face added
#
# Example:
#
# sprite - Marlen.png
# face   - Marlen_face.png
#
# Other syntaxes:
# $game_actors[ID].not_available = true/false
# $game_actors[ID].disabled_for_party = true/false
# $game_actors[ID].must_be_in_party = true/false
# $game_actors[ID].forced_position = nil/0/1/2/...
# OR
# $game_party.actors[POS].not_available = true/false
# $game_party.actors[POS].disabled_for_party = true/false
# $game_party.actors[POS].must_be_in_party = true/false
# $game_party.actors[POS].forced_position = nil/0/1/2/...
#
# ID - the actor's ID in the database
# POS - the actor's position in the party (STARTS FROM 0, not 1!)
#
# not_available
# - will disable the possibility of an already unlocked character to be in the
#   current party
#
# disabled_for_party
# - will cause the character NOT to appear in the party switch screen at all
#
# must_be_in_party
# - will cause the character to be automatically moved into the current party
#   and he also cannot be put in the reserve
#
# forced_position
# - will enforce the player to be at a specific position in the party, set this
#   value to nil to disable this feature, use it in combination with
#   must_be_in_party and $game_party.forced_size or you might experience bugs,
#   set to nil to disable
#
# $game_party.forced_size = nil/0/1/2/...
#
# Using this syntax will enforce a specific party size. The EPS won't exit
# until this size is filled up or there are no more in the reserve. EPS will
# automatically "correct" this number if there are not enough characters in the
# reserve to fill up a party of forced_size. Set this value to nil to disable
# the size requirement. Note that the actor DO NOT HAVE TO be set in normal
# order without any empty position like in version 1.x.
#
#
# Additional note:
#
# For your own sake, do not apply the attribute "must_be_in_party" to a
# character at the same time with "not_available" or "disabled_for_party" as
# this WILL disrupt your party and party switch system. Use "forced_position"
# together with "must_be_in_party" to avoid bugs. Be careful when using
# "forced_position" with "$game_party.forced_size". Add actors at the very end
# to be sure the player can't put others after them if the "forced_size" is
# smaller than the maximum party size.
#
#
# If you find any bugs, please report them here:
# http://www.chaosproject.co.nr
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Conficuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

# how many party members do you use
MAX_PARTY = 2
# set to true to use facesets instead of spritesets
FACESETS = true
# allows a party with 0 members
ALLOW_EMPTY_PARTY = false
# gives all other characters EXP (specify in %)
EXP_RESERVE = 100
# gives "not available" characters EXP (specify in %)
EXP_NOT_AVAILABLE = 100
# gives "disabled for party" characters EXP (specify in %)
EXP_DISABLED_FOR_PARTY = 100

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Conficuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

# recognition variable for plug-ins
$easy_party_switcher = true

#==============================================================================
# Game_Actor
#==============================================================================

class Game_Actor < Game_Battler

  attr_accessor :must_be_in_party
  attr_accessor :disabled_for_party
  attr_accessor :not_available
  attr_accessor :forced_position
 
  alias setup_eps_later setup
  def setup(actor_id)
    setup_eps_later(actor_id)
    @must_be_in_party = false
    @disabled_for_party = false
    @not_available = false
  end
 
end

#==============================================================================
# Game_System
#==============================================================================

class Game_System

  attr_accessor :stored_party
 
end

#==============================================================================
# Game_Party
#==============================================================================

class Game_Party

  attr_accessor :actors
  attr_accessor :forced_size
 
  def any_forced_position
    for actor in @actors
      return true if actor != nil and actor.forced_position != nil
    end
    return false
  end
 
end

#==============================================================================
# Window_Base
#==============================================================================

class Window_Base

  alias draw_actor_graphic_eps_later draw_actor_graphic
  def draw_actor_graphic(actor, x, y)
    if actor != nil and actor.character_name != ''
      if FACESETS and
          [Window_Current, Window_Reserve, Window_HelpStatus].include?(self.class)
        draw_actor_face_eps(actor, x, y)
      else
        if [Window_Current, Window_Reserve, Window_HelpStatus].include?(self.class)
          bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
          x += bitmap.width / 8 + 24
          y += bitmap.height / 4 + 16
        end
        draw_actor_graphic_eps_later(actor, x, y)
      end
    end
  end

  def draw_actor_face_eps(actor, x, y)
    if $tons_version == nil or $tons_version < 3.71 or not FACE_HUE
      hue = 0
    else
      hue = actor.character_hue
    end
    bitmap = RPG::Cache.character("#{actor.character_name}_face", hue)
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    if actor.not_available or actor.must_be_in_party
      self.contents.blt(x, y, bitmap, src_rect, 128)
    else
      self.contents.blt(x, y, bitmap, src_rect)
    end
  end
 
end

#==============================================================================
# Window_BattleResult
#==============================================================================

class Window_BattleResult
 
  attr_reader :exp
 
end

#==============================================================================
# Window_Current
#==============================================================================

class Window_Current < Window_Selectable

  def initialize
    super(0, 0, 240 + 32, (MAX_PARTY > 4 ? 480 : MAX_PARTY * 120))
    self.contents = Bitmap.new(width - 32, 448 + (MAX_PARTY-4) * 120)
    @item_max = MAX_PARTY
    if $fontface != nil
      self.contents.font.name = $fontface
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
    end
    self.contents.font.size = 24
    refresh
    self.active = false
    self.index = -1
  end
 
  def refresh
    self.contents.clear
    for i in 0...$game_party.actors.size
      y = i * 120 - 4
      self.contents.font.color = normal_color
      if $game_party.actors[i] != nil
        draw_actor_graphic($game_party.actors[i], 4, y + 8)
        draw_actor_name_new($game_party.actors[i], 152, y)
        #draw_actor_level($game_party.actors[i], 88, y)
        draw_actor_hp_new($game_party.actors[i], 88, y + 32)
        #draw_actor_bar(88, y+40,"horizontal",30,5, $game_party.actors[i].hp, $game_party.actors[i].maxhp,Color.new(150, 0, 0, 200) ,Color.new(255, 255, 60, 200))
        #draw_actor_sp_new($game_party.actors[i], 88, y + 64)
      end
    end
  end

  def setactor(index_1, index_2)
    temp = $game_party.actors[index_1]
    $game_party.actors[index_1] = $game_party.actors[index_2]
    $game_party.actors[index_2] = temp
    refresh
  end

  def getactor(index)
    return $game_actors[$game_party.actors[index].id]
  end
 
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
      return
    end
    row = @index / @column_max
    self.top_row = row if row < self.top_row
    self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
    y = (@index / @column_max) * 120 - self.oy
    self.cursor_rect.set(0, y, self.width - 32, 88)
  end

  def clone_cursor
    row = @index / @column_max
    self.top_row = row if row < self.top_row
    self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
    y = (@index / @column_max) * 120
    src_rect = Rect.new(0, 0, self.width, 88)
    bitmap = Bitmap.new(self.width-32, 88)
    bitmap.fill_rect(0, 0, self.width-32, 88, Color.new(255, 255, 255, 192))
    bitmap.fill_rect(2, 2, self.width-36, 84, Color.new(255, 255, 255, 80))
    self.contents.blt(0, y, bitmap, src_rect, 192)
  end
 
  def top_row
    return self.oy / 116
  end

  def top_row=(row)
    row = row % row_max
    self.oy = row * 120
  end

  def page_row_max
    return (self.height / 120)
  end

end

#==============================================================================
# Window_Reserve
#==============================================================================

class Window_Reserve < Window_Selectable
 
  attr_reader :actors
 
  def initialize
    super(0, 0, 368, 320)
    setup
    @column_max = 3
    rows = @item_max / @column_max
    self.contents = Bitmap.new(width - 32, (rows >= 3 ? rows * 96 : height - 32))
    if $fontface != nil
      self.contents.font.name = $fontface
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
    end
    self.contents.font.size = 24
    self.active = false
    self.index = -1
    refresh
  end
 
  def setup
    @actors = []
    for i in 1...$data_actors.size
      unless $game_party.actors.include?($game_actors[i]) or
          $game_actors[i].disabled_for_party
        @actors.push($game_actors[i])
      end
    end
    @item_max = (@actors.size + $game_party.actors.size + 3) / 3 * 3
  end
 
  def refresh
    self.contents.clear
    for i in 0...@actors.size
      draw_actor_graphic(@actors[i], i%3*112 + 16, i/3*96 + 8)
    end
  end
 
  def getactor(index)
    return @actors[index]
  end
 
  def get_number
    count = 0
    for actor in @actors
      count += 1 unless actor == nil or actor.not_available
    end
    return count
  end
 
  def setactor(index_1, index_2)
    temp = @actors[index_1]
    @actors[index_1] = @actors[index_2]
    @actors[index_2] = temp
    refresh
  end

  def setparty(index_1, index_2)
    temp = @actors[index_1]
    @actors[index_1] = $game_party.actors[index_2]
    $game_party.actors[index_2] = temp
    refresh
  end

  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
      return
    end
    row = @index / @column_max
    self.top_row = row if row < self.top_row
    self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
    x = (@index % @column_max) * 112 + 8
    y = (@index / @column_max) * 96 - self.oy
    self.cursor_rect.set(x, y, 96, 96)
  end

  def clone_cursor
    row = @index / @column_max
    self.top_row = row if row < self.top_row
    self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
    x = (@index % @column_max) * 112 + 8
    y = (@index / @column_max) * 96
    src_rect = Rect.new(0, 0, 96, 96)
    bitmap = Bitmap.new(96, 96)
    bitmap.fill_rect(0, 0, 96, 96, Color.new(255, 255, 255, 192))
    bitmap.fill_rect(2, 2, 92, 92, Color.new(255, 255, 255, 80))
    self.contents.blt(x, y, bitmap, src_rect, 192)
  end
 
  def top_row
    return self.oy / 96
  end

  def top_row=(row)
    row = row % row_max
    self.oy = row * 96
  end

  def page_row_max
    return (self.height - 32) / 96
  end

end

#==============================================================================
# Window_HelpStatus
#==============================================================================

class Window_HelpStatus < Window_Base

  def initialize(gotactor)
    super(0, 0, 400 - 32, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    if $fontface != nil
      self.contents.font.name = $fontface
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
    end
    self.contents.font.size = 24
    refresh(gotactor)
    self.active = false
  end
 
  def refresh(actor)
    self.contents.clear
    if actor != nil
      x = y = 0
      self.contents.font.color = normal_color
      if actor.not_available
        self.contents.draw_text(x + 8, y, 160, 32, 'not available', 0)
      end
      draw_actor_graphic(actor, x, y + 40)
      draw_actor_name_new(actor, x + 160, y + 32)
      #draw_actor_level(actor, x + 96, y + 32)
      draw_actor_hp_new(actor, x + 96, y + 64)
      #draw_actor_sp(actor, x + 96, y + 96)
    end
  end

end

#==============================================================================
# Window_Warning
#==============================================================================

class Window_Warning < Window_Base

  def initialize(mode, members)
    super(0, 0, 320, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    if $fontface != nil
      self.contents.font.name = $fontface
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
    end
    self.contents.font.size = 24
    self.x = 320 - width/2
    self.y = 240 - height/2
    self.z = 9999
    self.contents.font.color = normal_color
    if mode
      self.contents.draw_text(0, 0, 288, 32, 'You need a party', 1)
      num = [$game_party.forced_size, members + $game_party.actors.nitems].min
      self.contents.draw_text(0, 32, 288, 32, "of #{num} members!", 1)
    else
      self.contents.draw_text(0, 0, 288, 32, 'You cannot remove', 1)
      self.contents.draw_text(0, 32, 288, 32, 'the last party member!', 1)
    end
  end

end

#==============================================================================
# Scene_PartySwitcher
#==============================================================================

class Scene_PartySwitcher
 
  def initialize(wipe_party = 0, reset = 0, store = 0)
    @wipe_party = wipe_party
    @store = store
    @reset = reset
    @current_window_temp = 0
    @reserve_window_temp = 0
    @scene_flag = false
    @temp_window = ''
  end
 
  def main
    if @store != 0
      swap_parties
      $scene = Scene_Map.new
      $game_player.refresh
      return
    end
    case @wipe_party
    when 1 then setup_forced_party
    when 2 then wipe_party
    when 3
      $game_system.stored_party = $game_party.actors
      wipe_party
    end
    if @reset == 1
      for i in 1...$data_actors.size
        $game_actors[i].not_available = false
      end
    end
    @current_window = Window_Current.new
    @current_window.index = 0
    @current_window.active = true
    @reserve_window = Window_Reserve.new
    @reserve_window.x = 240 + 32
    @reserve_window.y = 160
    @help_window = Window_HelpStatus.new(@reserve_window.getactor(0))
    @help_window.x = 240 + 32
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    Graphics.freeze
    @current_window.dispose
    @reserve_window.dispose
    @help_window.dispose
    $game_party.actors.compact!
    $game_player.refresh
  end
 
  def update
    check = @reserve_window.index
    if @reserve_window.active
      reserve_update
      @reserve_window.update
    end
    if check != @reserve_window.index
      if @reserve_window.active
        actor = @reserve_window.getactor(@reserve_window.index)
      elsif @current_window.active
        actor = @reserve_window.getactor(@reserve_window_temp)
      end
      @help_window.refresh(actor) if ['', 'Current'].include?(@temp_window)
    end
    current_update if @current_window.active
    if Input.trigger?(Input::B)
      if @scene_flag
        $game_system.se_play($data_system.cancel_se)
        @temp_window = ''
        @scene_flag = false
        if @reserve_window.active
          actor = @reserve_window.getactor(@reserve_window.index)
        elsif @current_window.active
          actor = @reserve_window.getactor(@reserve_window_temp)
        end
        @help_window.refresh(actor) if ['', 'Current'].include?(@temp_window)
        @current_window.refresh
        @reserve_window.refresh
        return
      end
      if $game_party.forced_size != nil
        if $game_party.forced_size < $game_party.actors.nitems or
           ($game_party.forced_size > $game_party.actors.nitems and
            @reserve_window.get_number != 0)
          $game_system.se_play($data_system.buzzer_se)
          warning(true)
          return
        end
      end
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::A)
      if $game_party.any_forced_position
        $game_system.se_play($data_system.buzzer_se)
      else
        $game_system.se_play($data_system.decision_se)
        $game_party.actors.compact!
        @current_window.refresh
      end
    end
  end
   
  def current_update
    @current_window.update
    if Input.trigger?(Input::C)
      actor = @current_window.getactor(@current_window.index)
      if actor != nil and actor.forced_position != nil
        $game_system.se_play($data_system.buzzer_se)
      else
        if @scene_flag
          switch_members
        else
          $game_system.se_play($data_system.decision_se)
          @scene_flag = true
          @temp_actor_index = @current_window.index
          @temp_window = 'Current'
          @current_window.clone_cursor
        end
      end
      return
    end
    if Input.trigger?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      @current_window.active = false
      @reserve_window.active = true
      @current_window_temp = @current_window.index
      actor = @reserve_window.getactor(@reserve_window_temp)
      @current_window.index = -1
      @reserve_window.index = @reserve_window_temp
      @help_window.refresh(actor) unless @scene_flag
      return
    end
  end
 
  def reserve_update
    if Input.trigger?(Input::C)
      unless @scene_flag
        $game_system.se_play($data_system.decision_se)
        @scene_flag = true
        @temp_actor_index = @reserve_window.index
        @temp_window = 'Reserve'
        @reserve_window.clone_cursor
      else
        switch_members
      end
      return
    end
    if (@reserve_window.index % 3) == 0
      if Input.repeat?(Input::LEFT)
        $game_system.se_play($data_system.cursor_se)
        @reserve_window.active = false
        @current_window.active = true
        @reserve_window_temp = @reserve_window.index
        @reserve_window.index = -1
        @current_window.index = @current_window_temp
      end
    end
  end
 
  def switch_members
    if @temp_window == 'Reserve' and @reserve_window.active
      @reserve_window.setactor(@temp_actor_index, @reserve_window.index)
      actor = @reserve_window.getactor(@reserve_window.index)
      @help_window.refresh(actor)
    end
    if @temp_window == 'Current' and @current_window.active
      @current_window.setactor(@temp_actor_index, @current_window.index)
    end
    if @temp_window == 'Reserve' and @current_window.active
      actor1 = @current_window.getactor(@current_window.index)
      actor2 = @reserve_window.getactor(@temp_actor_index)
      if call_warning?(@current_window.index, actor2)
        if actor1 != nil and actor1.must_be_in_party
          $game_system.se_play($data_system.buzzer_se)
          @scene_flag = false
          @temp_window = ''
          actor = @reserve_window.getactor(@reserve_window_temp)
          @current_window.refresh
          @reserve_window.refresh
          @help_window.refresh(actor)
          return
        end
        if actor2 != nil and actor2.not_available
          $game_system.se_play($data_system.buzzer_se)
          @scene_flag = false
          @temp_window = ''
          actor = @reserve_window.getactor(@reserve_window_temp)
          @current_window.refresh
          @reserve_window.refresh
          @help_window.refresh(actor)
          return
        end
        @reserve_window.setparty(@temp_actor_index, @current_window.index)
        @current_window.refresh
        actor = @reserve_window.getactor(@reserve_window_temp)
        @help_window.refresh(actor)
      else
        warning
      end
    end
    if @temp_window == 'Current' and @reserve_window.active
      actor1 = @current_window.getactor(@temp_actor_index)
      actor2 = @reserve_window.getactor(@reserve_window.index)
      if call_warning?(@temp_actor_index, actor2)
        if actor1 != nil and actor1.must_be_in_party
          $game_system.se_play($data_system.buzzer_se)
          @scene_flag = false
          @temp_window = ''
          actor = @reserve_window.getactor(@reserve_window.index)
          @current_window.refresh
          @reserve_window.refresh
          @help_window.refresh(actor)
          return
        end
        if actor2 != nil and actor2.not_available
          $game_system.se_play($data_system.buzzer_se)
          @scene_flag = false
          @temp_window = ''
          actor = @reserve_window.getactor(@reserve_window.index)
          @current_window.refresh
          @reserve_window.refresh
          @help_window.refresh(actor)
          return
        end
        @reserve_window.setparty(@reserve_window.index, @temp_actor_index)
        @current_window.refresh
        actor = @reserve_window.getactor(@reserve_window.index)
        @help_window.refresh(actor)
      else
        warning
      end
    end
    $game_system.se_play($data_system.decision_se)
    @scene_flag = false
    @temp_window = ""
  end
   
  def wipe_party
    for i in 0...$game_party.actors.size
      $game_party.actors[i].not_available = true if $game_party.actors[i] != nil
    end
    setup_forced_party(true)
    if $game_party.actors == []
      for i in 1...$data_actors.size
        unless $game_actors[i].not_available or $game_actors[i].disabled_for_party
          $game_party.actors[$game_party.actors.size] = $game_actors[i]
          return
        end
      end
    end
  end
 
  def setup_forced_party(flag = false)
    $game_party.actors = []
    party = []
    for i in 1...$data_actors.size
      actor = $game_actors[i]
      if actor != nil and actor.must_be_in_party and
           (not actor.disabled_for_party or flag) and not actor.not_available
        party[party.size] = actor
      end
    end
    for i in 0...party.size
      if actor.forced_position != nil
        $game_party.actors[party[i].forced_position] = party[i]
        party[i] = nil
      end
    end
    party.compact!
    for actor in party
      $game_party.actors.push(actor)
    end
  end 
 
  def swap_parties
    $game_party.actors.compact!
    temp_actors = $game_party.actors
    for actor in temp_actors
      actor.not_available = true
    end
    $game_system.stored_party.compact!
    for actor in $game_system.stored_party
      actor.not_available = false
    end
    $game_party.actors = $game_system.stored_party
    $game_system.stored_party = nil
    $game_system.stored_party = temp_actors if @store == 1
  end
 
  def call_warning?(index, actor2)
    return (ALLOW_EMPTY_PARTY or $game_party.actors[index] == nil or
        actor2 != nil or $game_party.actors.nitems > 1)
  end
 
  def warning(flag = false)
    $game_system.se_play($data_system.buzzer_se)
    @warning_window = Window_Warning.new(flag, @reserve_window.get_number)
    loop do
      Graphics.update
      Input.update
      if Input.trigger?(Input::C)
        $game_system.se_play($data_system.decision_se) if flag
        @current_window.refresh
        @reserve_window.refresh
        @warning_window.dispose
        @warning_window = nil
        break
      end
    end
  end
 
end

#==============================================================================
# Scene_Battle
#==============================================================================
 
class Scene_Battle
 
  alias start_phase5_eps_later start_phase5
  def start_phase5
    start_phase5_eps_later
    for i in 1...$data_actors.size
      unless $game_party.actors.include?($game_actors[i])
        if $game_actors[i].not_available
          $game_actors[i].exp += @result_window.exp * EXP_NOT_AVAILABLE/100
        elsif $game_actors[i].disabled_for_party
          $game_actors[i].exp += @result_window.exp * EXP_DISABLED_FOR_PARTY/100
        else
          $game_actors[i].exp += @result_window.exp * EXP_RESERVE/100
        end
      end
    end
  end
 
end


Thanks!
Title: Re: [XP] Easy Party Switcher
Post by: Starrodkirby86 on October 12, 2008, 02:11:05 pm
Hi,

If you're having problems with the script, always make sure it's at the latest version. Also, make sure that you find the script thread first and post in there if you're having a problem with the specific script. Either in the script thread or in Script Troubleshooting, either one would work fine...

I don't know what else to say, so wait for an experienced scripter or Blizzard. XD Welcome to the forums...

EDIT: I'm seeing that you may need to modify a bit of it...like you have to call the Scene whatever...XD Forgive my ignorance, I'm not a scripter at all...:P
Title: Re: [XP] Easy Party Switcher
Post by: omegapirate2000 on October 12, 2008, 05:18:57 pm
Quote from: Starrodkirby86 on October 12, 2008, 02:11:05 pm
Hi,

If you're having problems with the script, always make sure it's at the latest version. Also, make sure that you find the script thread first and post in there if you're having a problem with the specific script. Either in the script thread or in Script Troubleshooting, either one would work fine...

I don't know what else to say, so wait for an experienced scripter or Blizzard. XD Welcome to the forums...

EDIT: I'm seeing that you may need to modify a bit of it...like you have to call the Scene whatever...XD Forgive my ignorance, I'm not a scripter at all...:P

I'm guessing to do it you have to make it call the battle scene if you're in battle, call the map scene if you're on the map, ect ect. But I have no idea how to do that so I'm wondering if someone (most likely blizz) can help me out.

Thanks for moving this post by the way.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 13, 2008, 05:05:28 am
You can't call older versions in battle. That feature is available since v2.3b so you should upgrade the version first. I'm sure that it will work with SDK without problems, because I fixed the issue with SDK in v2.32b already. :)
Title: Re: [XP] Easy Party Switcher
Post by: omegapirate2000 on October 13, 2008, 07:21:04 pm
Quote from: Blizzard on October 13, 2008, 05:05:28 am
You can't call older versions in battle. That feature is available since v2.3b so you should upgrade the version first. I'm sure that it will work with SDK without problems, because I fixed the issue with SDK in v2.32b already. :)

Oh ok, I took this one from some other site, I guess they had an outdated one.

Thanks!

EDIT: Ok, is there a way to enable/disable party switch in battle using a script command?

I'm sure it's possible, I just can't figure out the syntax, thanks!

QuoteI love how you're breaking all these stupid rules. Really gives us moderators something to do. :P Thanks. Don't take this as a sign of threat, take it as a sign of positive laughter. As standard forum rules (Throughout many forums) go, you can't consecutively post one after another within 24 hours. ~Love, Starrodkirby86


You threaten me? I DESTROY YOU.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 14, 2008, 03:50:43 am
Lol!

Anyway... No, it's not possible to change this setting during the game. I guess I should make it possible... xD
Title: Re: [XP] Easy Party Switcher
Post by: omegapirate2000 on October 14, 2008, 08:26:01 am
Quote from: Blizzard on October 14, 2008, 03:50:43 am
Lol!

Anyway... No, it's not possible to change this setting during the game. I guess I should make it possible... xD

I would very, very much appreciate that, since my game sort of "unlocks" that ability a little bit through and it'd look a bit smoother if it didn't show up beforehand.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 14, 2008, 10:11:41 am
There you go. I updated the "How to use" section under 5. I didn't have time to test it so I suggest you do. It should work fine, though.
Title: Re: [XP] Easy Party Switcher
Post by: omegapirate2000 on October 14, 2008, 10:15:47 am
Lemme try it out now.

EDIT, ok, I'm getting an error message now whenever I try to run it with battle switch enabled.

(http://i8.photobucket.com/albums/a3/omegapirate2000/Error.png)

ANOTHER EDIT: Is there a way to make this script NOT freak out when I switch a party member out for nothing in the party switcher window? It's a script by SephirothSpawn that basically shares MP between all party members.

class Game_Party
  attr_reader :sp
  alias seph_partysp_gmpty_init initialize
  alias seph_partysp_gmpty_ssm  setup_starting_members
  def initialize
    seph_partysp_gmpty_init
    @sp = 0
  end
  def setup_starting_members
    seph_partysp_gmpty_ssm
    @sp = maxsp
  end
  def maxsp
    sp = 0
    @actors.each do |actor|
      sp += actor.seph_partysp_gmactr_maxsp
    end
    return sp
  end
  def sp=(sp)
    @sp = [[sp, maxsp].min, 0].max
  end
end

class Game_Actor
  alias seph_partysp_gmactr_maxsp maxsp
  def maxsp
    return $game_party.maxsp
  end
  def sp
    return $game_party.sp
  end
  def sp=(sp)
    $game_party.sp = sp
  end
end
Title: Re: [XP] Easy Party Switcher
Post by: omegapirate2000 on October 15, 2008, 06:39:25 pm
Bump >_>

<_<


>_>
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 15, 2008, 07:41:33 pm
I'll see what I can do. Sorry, I didn't see your post earlier for some reason. o.o
Title: Re: [XP] Easy Party Switcher
Post by: omegapirate2000 on October 15, 2008, 07:55:40 pm
Quote from: Blizzard on October 15, 2008, 07:41:33 pm
I'll see what I can do. Sorry, I didn't see your post earlier for some reason. o.o

It's most likely because I edited it.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 15, 2008, 08:16:11 pm
Yeah, I need to edit the forum's scripts so it displays edited posts in the "Posts since last visit" section. -_-
Title: Re: [XP] Easy Party Switcher
Post by: omegapirate2000 on October 15, 2008, 08:20:53 pm
Quote from: Blizzard on October 15, 2008, 08:16:11 pm
Yeah, I need to edit the forum's scripts so it displays edited posts in the "Posts since last visit" section. -_-

OR HAVE A MOD THAT IS NOT A POST MOVING NAZI-ZOMBIE.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 15, 2008, 08:26:22 pm
Actually I am encouraging him to move everything to the right place. :P But let's not go offtopic, lol!
Title: Re: [XP] Easy Party Switcher
Post by: Zeldaknight on October 15, 2008, 11:04:43 pm
lol! have you checked the demo I sent yet Blizzard?
Title: Re: [XP] Easy Party Switcher
Post by: omegapirate2000 on October 20, 2008, 04:14:56 am
Buuuuump.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 20, 2008, 05:27:46 am
Don't worry, Omega. I have time today, I will check what's wrong after I am done posting.

@Zeldaknight: Didn't you send me the demo regarding CRLS? Anyway, my anwser is in the CRLS topic.
Title: Re: [XP] Easy Party Switcher
Post by: omegapirate2000 on October 20, 2008, 11:18:17 am
Wooooooooooooooo
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 20, 2008, 11:57:36 am
There you go. It was a problem with SDK, not the script by Seph.
Title: Re: [XP] Easy Party Switcher
Post by: omegapirate2000 on October 20, 2008, 06:39:21 pm
Great fix, but I posted sephs script because it freaks out when I switch the second party member out for an empty slot, I'm guessing because it doesn't take the script into account when it calculates SP, I'll make a topic about it in script requests, thanks!

Topic is here:

http://forum.chaos-project.com/index.php?topic=2026.0
Title: Re: [XP] Easy Party Switcher
Post by: Memor-X on March 19, 2009, 11:04:56 pm
is there a way to have characters that must_be_in_party locked in the position they are in, like having the leader of the party unable to be removed from the party and always being first in the party
Title: Re: [XP] Easy Party Switcher
Post by: Starrodkirby86 on March 19, 2009, 11:10:21 pm
A feature like would be very popular, so Blizzard must have put it in there. And indeed he did. Locate this part in the instructions:
#   Other syntaxes:
#     $game_actors[ID].not_available = true/false
#     $game_actors[ID].disabled_for_party = true/false
#     $game_actors[ID].must_be_in_party = true/false
#     $game_actors[ID].forced_position = nil/0/1/2/...
#   OR
#     $game_party.actors[POS].not_available = true/false
#     $game_party.actors[POS].disabled_for_party = true/false
#     $game_party.actors[POS].must_be_in_party = true/false
#     $game_party.actors[POS].forced_position = nil/0/1/2/...
#
#   ID  - the actor's ID in the database
#   POS - the actor's position in the party (STARTS FROM 0, not 1!)
#
#   not_available
#   - will disable the possibility of an already unlocked character to be in
#     the current party
#
#   disabled_for_party
#   - will cause the character NOT to appear in the party switch screen at all
#
#   must_be_in_party
#   - will cause the character to be automatically moved into the current party
#     and he also cannot be put in the reserve
#
#   forced_position
#   - will enforce the player to be at a specific position in the party, set
#     this value to nil to disable this feature, use it in combination with
#     must_be_in_party and $game_party.forced_size or you might experience
#     bugs,
#


I don't know where you put these, so read the instructions comprehensively, my friend.
Title: Re: [XP] Easy Party Switcher
Post by: Punn on May 06, 2009, 03:30:28 pm
I don't know if this was intended but I was too busy playin my game and I went to the possibly dangerous area of the game and manage to find a safe spot, everyone damage or KO'd, so I went in and heal my ass, and then when I try to switch to the tank actor, he isn't recovered along with the reserved party...
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on May 07, 2009, 03:35:02 am
The event command that can heal only heals one actor at the time or the entire party. Since the reserve party isn't actually the current party, nothing happens. You can do it with a script call, though.

This one heals the reserve party if it exists:

if $game_system.stored_party != nil
  $game_system.stored_party.each {|actor| actor.recover_all}
end


This one heals all actors:

(1...$data_actors.size).each {|i| $game_actors[i].recover_all}
Title: Re: [XP] Easy Party Switcher
Post by: X-Law on May 07, 2009, 08:35:09 pm
I found a bug in the demo, just following the autorun event got an error, tomorrow i'll post the exact error, with a screen if possible
But in the meantime, just wonder if possible to have the option to change the party in the window command instead of in party_command? Maybe using the CRLS style, i mean the swap_command style.
Title: Re: [XP] Easy Party Switcher
Post by: G_G on May 07, 2009, 11:29:16 pm
Quote from: Rival Blizzard on May 07, 2009, 03:35:02 am
The event command that can heal only heals one actor at the time or the entire party. Since the reserve party isn't actually the current party, nothing happens. You can do it with a script call, though.

This one heals the reserve party if it exists:

if $game_system.stored_party != nil
  $game_system.stored_party.each {|actor| actor.recover_all}
end


This one heals all actors:

(1...$data_actors.size).each {|i| $game_actors[i].recover_all}



Would this work?

(1...$data_actors.size).each {|i| $game_actors[ID].not_available = true}
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on May 08, 2009, 03:18:07 am
Quote from: X-Law on May 07, 2009, 08:35:09 pm
I found a bug in the demo, just following the autorun event got an error, tomorrow i'll post the exact error, with a screen if possible
But in the meantime, just wonder if possible to have the option to change the party in the window command instead of in party_command? Maybe using the CRLS style, i mean the swap_command style.


I'm not going to implement it.
And it's possible that there is an error since I usually don't test the entire system thoroughly when I make a new version. I usually only make some shallow testing to see if everything works fine. If it's a bug in the demo only, then it's not a bother.

Quote from: Youngster Gi Gi on May 07, 2009, 11:29:16 pm
Would this work?

(1...$data_actors.size).each {|i| $game_actors[ID].not_available = true}



(1...$data_actors.size).each {|i| $game_actors[i].not_available = true}
Title: Re: [XP] Easy Party Switcher
Post by: Pm6583 on May 14, 2009, 02:29:23 pm
Hi firstly I would like to say hi to everyone as I am new to this forum.

And secondly i have a question.

I have Implemented this script in the the menu so the party switching window can be seen from there, But is there anyway I can disable it in the menu until a certain point in the game when I want it to appear.

Any help would be appreciated

Thanks in advance
Title: Re: [XP] Easy Party Switcher
Post by: G_G on May 14, 2009, 02:31:12 pm
you want the command disabled at certain times? Is that what you're asking?

If so post your menu here and I'll do it for you. The menu not the script.
Title: Re: [XP] Easy Party Switcher
Post by: Pm6583 on May 14, 2009, 02:37:05 pm
Spoiler: ShowHide
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================

class Scene_Menu
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make command window
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Save"
    s6 = "Party"
    s7 = "End Game"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.index = @menu_index
    # If number of party members is 0
    if $game_party.actors.size == 0
      # Disable items, skills, equipment, and status
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    # If save is forbidden
    if $game_system.save_disabled
      # Disable save
      @command_window.disable_item(4)
    end
    # Make play time window
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 0
    @playtime_window.y = 224
    # Make steps window
    @steps_window = Window_Steps.new
    @steps_window.x = 0
    @steps_window.y = 320
    # Make gold window
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 416
    # Make status window
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 0
    # 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
    @command_window.dispose
    @playtime_window.dispose
    @steps_window.dispose
    @gold_window.dispose
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @command_window.update
    @playtime_window.update
    @steps_window.update
    @gold_window.update
    @status_window.update
    # If command window is active: call update_command
    if @command_window.active
      update_command
      return
    end
    # If status window is active: call update_status
    if @status_window.active
      update_status
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    # 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_window.index
      when 0  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Item.new
      when 1  # skill
        # 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 2  # equipment
        # 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 3  # status
        # 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 4  # save
        # 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 5  # Party
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to end game screen
        $scene = Scene_PartySwitcher.new
      when 6  # end game
        # 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
    # 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_window.index
      when 1  # skill
        # 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 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to equipment screen
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # status
        # 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


There you go (If thats what you wanted lol) and thanks, Nice to find some nice people here lol
Title: Re: [XP] Easy Party Switcher
Post by: G_G on May 14, 2009, 02:55:05 pm
Spoiler: ShowHide
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================
class Game_System
  attr_accessor :party
  alias re_init_party initialize
  def initialize
    re_init_party
    @party = true
  end
 
end

class Scene_Menu
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make command window
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Save"
    s6 = "Party"
    s7 = "End Game"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.index = @menu_index
    # If number of party members is 0
    if $game_party.actors.size == 0
      # Disable items, skills, equipment, and status
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    if $game_system.party == false
      @command_window.disable_item(5)
    end
    if $game_system.save_disabled
      # Disable save
      @command_window.disable_item(4)
    end
    # Make play time window
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 0
    @playtime_window.y = 224
    # Make steps window
    @steps_window = Window_Steps.new
    @steps_window.x = 0
    @steps_window.y = 320
    # Make gold window
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 416
    # Make status window
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 0
    # 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
    @command_window.dispose
    @playtime_window.dispose
    @steps_window.dispose
    @gold_window.dispose
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @command_window.update
    @playtime_window.update
    @steps_window.update
    @gold_window.update
    @status_window.update
    # If command window is active: call update_command
    if @command_window.active
      update_command
      return
    end
    # If status window is active: call update_status
    if @status_window.active
      update_status
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    # 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_window.index
      when 0  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Item.new
      when 1  # skill
        # 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 2  # equipment
        # 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 3  # status
        # 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 4  # save
        # 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 5  # Party
        # Play decision SE
        if $game_system.party == false
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        $game_system.se_play($data_system.decision_se)
        # Switch to end game screen
        $scene = Scene_PartySwitcher.new
      when 6  # end game
        # 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
    # 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_window.index
      when 1  # skill
        # 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 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to equipment screen
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # status
        # 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



Use
$game_system.party = true/false

true means you can use the party command
false means you cant
Title: Re: [XP] Easy Party Switcher
Post by: Pm6583 on May 14, 2009, 03:16:12 pm
Thanks Youngster Gi Gi
Title: Re: [XP] Easy Party Switcher
Post by: Paladin295 on May 23, 2009, 08:43:27 pm
Hello, this script seems to be exactly what I have been looking for, to use with my project. I do have a few questions though.

Within the instructions of the script:

"Compatibility:
#
#   98% compatible with SDK v1.x. 90% compatible with SDK 2.x. Can cause
#   incompatibility issued with other Party Change Systems. Can cause problems
#   with CBS-es if you use the battle switch feature. WILL corrupt your old
#   savegames."

1. Could someone explain how this will corrupt old saved games? Does this mean saved games that your playing through or actual saved project files? Is there any way this script could harm my saved project files?


2. "Script

Just make a new script above main and paste this code into it."

Could anyone elaborate on this somewhat? Where do I add this script at, in the script editor? What parts of the script do I add?


3. Is there any more detailed instructions listed somewhere, for those of us who have little experience with using scripts? Maybe a step by step tutorial?


4. I assume it is possible to disable the in battle party member switching function? Would it also be possible to change it so that in certain battles, the player is prompted to switch another party member in only in exchange for those party members who have already been knocked out?


Thank you very much for making this script! I also very much appreciate the time anyone has spent reading my post here and answering my questions, thank you. I look forward to hearing back from you.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on May 23, 2009, 08:58:24 pm
Quote from: Paladin295 on May 23, 2009, 08:43:27 pm
"Compatibility:
#
#   98% compatible with SDK v1.x. 90% compatible with SDK 2.x. Can cause
#   incompatibility issued with other Party Change Systems. Can cause problems
#   with CBS-es if you use the battle switch feature. WILL corrupt your old
#   savegames."

1. Could someone explain how this will corrupt old saved games? Does this mean saved games that your playing through or actual saved project files? Is there any way this script could harm my saved project files?


No. I means that you shouldn't load savegames that were saved before you added this script into the game.

Quote from: Paladin295 on May 23, 2009, 08:43:27 pm
2. "Script

Just make a new script above main and paste this code into it."

Could anyone elaborate on this somewhat? Where do I add this script at, in the script editor? What parts of the script do I add?


Yes. All of it. How to add a script (http://forum.chaos-project.com/index.php?topic=198.0) and the recommended order for scripts (http://forum.chaos-project.com/index.php?topic=23.0).

Quote from: Paladin295 on May 23, 2009, 08:43:27 pm
3. Is there any more detailed instructions listed somewhere, for those of us who have little experience with using scripts? Maybe a step by step tutorial?


There are full instructions within the script in the first green block of text. The text will appear green when you have added it into the script editor. There's a also a download link for a demo in the first post.

Quote from: Paladin295 on May 23, 2009, 08:43:27 pm
4. I assume it is possible to disable the in battle party member switching function? Would it also be possible to change it so that in certain battles, the player is prompted to switch another party member in only in exchange for those party members who have already been knocked out?


You will need to find somebody to edit the script and add this specific functionality.
Title: Re: [XP] Easy Party Switcher
Post by: omegapirate2000 on May 23, 2009, 09:28:07 pm
This script is the bomb.
Title: Re: [XP] Easy Party Switcher
Post by: sournote103 on June 03, 2009, 04:56:16 pm
OK, so I'm pretty inept at scripting...... so..... How do you make a character who is ALWAYS the FIRST MEMBER of the party. If you can, please be specific.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on June 03, 2009, 06:30:34 pm
Read the instructions, there's a script call for it.
Title: Re: [XP] Easy Party Switcher
Post by: sournote103 on June 05, 2009, 03:46:17 pm
I did. I couldn't figure it out  :^_^':
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on June 05, 2009, 04:10:34 pm
actor.must_be_in_party and actor.forced_position or something like that. Just look it up.
Title: Re: [XP] Easy Party Switcher
Post by: Juan on June 05, 2009, 04:12:42 pm
Lol blizz you beat me to it. I might as well provide the comments to go with those.
Spoiler: ShowHide
$game_actors[ID].must_be_in_party = true/false
#   must_be_in_party
#   - will cause the character to be automatically moved into the current party
#     and he also cannot be put in the reserve
$game_party.actors[POS].forced_position = nil/0/1/2/...
#   forced_position
#   - will enforce the player to be at a specific position in the party, set
#     this value to nil to disable this feature, use it in combination with
#     must_be_in_party and $game_party.forced_size or you might experience
#     bugs,
Title: Re: [XP] Easy Party Switcher
Post by: sournote103 on June 05, 2009, 04:34:15 pm
Quote from: Juan on June 05, 2009, 04:12:42 pm
Lol blizz you beat me to it. I might as well provide the comments to go with those.
Spoiler: ShowHide
$game_actors[ID].must_be_in_party = true/false
#   must_be_in_party
#   - will cause the character to be automatically moved into the current party
#     and he also cannot be put in the reserve
$game_party.actors[POS].forced_position = nil/0/1/2/...
#   forced_position
#   - will enforce the player to be at a specific position in the party, set
#     this value to nil to disable this feature, use it in combination with
#     must_be_in_party and $game_party.forced_size or you might experience
#     bugs,


OK, but that doesn't tell me HOW to make an actor be a permanent party member. I'm pretty useless with scripts.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on June 05, 2009, 04:41:32 pm
No, it doesn't tell you at all. There is absolutely no text which indicates or just hints at what you need to do in order to use those commands. :V:

Quote# How to use:
#
#   To call this script, make a "Call script" command in an event.


Quote#   Other syntaxes:
#     $game_actors[ID].not_available = true/false
#     $game_actors[ID].disabled_for_party = true/false
#     $game_actors[ID].must_be_in_party = true/false
#     $game_actors[ID].forced_position = nil/0/1/2/...
#   OR
#     $game_party.actors[POS].not_available = true/false
#     $game_party.actors[POS].disabled_for_party = true/false
#     $game_party.actors[POS].must_be_in_party = true/false
#     $game_party.actors[POS].forced_position = nil/0/1/2/...
#  
#   ID  - the actor's ID in the database
#   POS - the actor's position in the party (STARTS FROM 0, not 1!)
#


Where you would obviously use only one of the given values and not all of them.
Title: Re: [XP] Easy Party Switcher
Post by: sournote103 on June 06, 2009, 08:30:52 am
Quote from: Blizzard on June 05, 2009, 04:41:32 pm
No, it doesn't tell you at all. There is absolutely no text which indicates or just hints at what you need to do in order to use those commands. :V:

Quote# How to use:
#
#   To call this script, make a "Call script" command in an event.


Quote#   Other syntaxes:
#     $game_actors[ID].not_available = true/false
#     $game_actors[ID].disabled_for_party = true/false
#     $game_actors[ID].must_be_in_party = true/false
#     $game_actors[ID].forced_position = nil/0/1/2/...
#   OR
#     $game_party.actors[POS].not_available = true/false
#     $game_party.actors[POS].disabled_for_party = true/false
#     $game_party.actors[POS].must_be_in_party = true/false
#     $game_party.actors[POS].forced_position = nil/0/1/2/...
#  
#   ID  - the actor's ID in the database
#   POS - the actor's position in the party (STARTS FROM 0, not 1!)
#


Where you would obviously use only one of the given values and not all of them.

Hm.... I tried that, and it gave me an error. Could you please show me how it's supposed to look?
Title: Re: [XP] Easy Party Switcher
Post by: teengamer on June 28, 2009, 08:44:35 pm
I can't get it to change any party member's status 8 or higher (008, 009, 010, etc.)
Title: Re: [XP] Easy Party Switcher
Post by: fugibo on June 28, 2009, 09:42:33 pm
Quote from: sournote103 on June 06, 2009, 08:30:52 am
Quote from: Blizzard on June 05, 2009, 04:41:32 pm
No, it doesn't tell you at all. There is absolutely no text which indicates or just hints at what you need to do in order to use those commands. :V:

Quote# How to use:
#
#   To call this script, make a "Call script" command in an event.


Quote#   Other syntaxes:
#     $game_actors[ID].not_available = true/false
#     $game_actors[ID].disabled_for_party = true/false
#     $game_actors[ID].must_be_in_party = true/false
#     $game_actors[ID].forced_position = nil/0/1/2/...
#   OR
#     $game_party.actors[POS].not_available = true/false
#     $game_party.actors[POS].disabled_for_party = true/false
#     $game_party.actors[POS].must_be_in_party = true/false
#     $game_party.actors[POS].forced_position = nil/0/1/2/...
#  
#   ID  - the actor's ID in the database
#   POS - the actor's position in the party (STARTS FROM 0, not 1!)
#


Where you would obviously use only one of the given values and not all of them.

Hm.... I tried that, and it gave me an error. Could you please show me how it's supposed to look?


It'd be super-duper helpful if you showed us what YOU are doing!
Title: Re: [XP] Easy Party Switcher
Post by: rpgmakerfanhaha on August 29, 2009, 12:43:48 pm
My god....The thing I wanted is that not all actors in the database are in the party changer.I want it to start with the initial party members and then other actors slowly joins into the party through the story.Someonee please help me with the scripts?
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on August 29, 2009, 12:57:18 pm
You wouldn't have this problem if you read just this one page of the topic.
Title: Soory I don't quite know how to do
Post by: rpgmakerfanhaha on August 31, 2009, 06:01:03 am
I don't possess any scripting knowledge or what.Blizzard can you give me a sample of a disabled member in the party so I will know how to type the line in the script and where to do it.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on August 31, 2009, 07:23:01 am
Quote from: Blizzard on June 05, 2009, 04:41:32 pm
Quote# How to use:
#
#   To call this script, make a "Call script" command in an event.


Quote#   Other syntaxes:
#     $game_actors[ID].not_available = true/false
#     $game_actors[ID].disabled_for_party = true/false
#     $game_actors[ID].must_be_in_party = true/false
#     $game_actors[ID].forced_position = nil/0/1/2/...
#   OR
#     $game_party.actors[POS].not_available = true/false
#     $game_party.actors[POS].disabled_for_party = true/false
#     $game_party.actors[POS].must_be_in_party = true/false
#     $game_party.actors[POS].forced_position = nil/0/1/2/...
#  
#   ID  - the actor's ID in the database
#   POS - the actor's position in the party (STARTS FROM 0, not 1!)
#


Where you would obviously use only one of the given values and not all of them.

Title: Re: [XP] Easy Party Switcher
Post by: Jackolas on August 31, 2009, 09:15:44 am
I can't understand how peep can't understand the really really simple instructions... >:(

Quotegive me a sample of a disabled member in the party

download the demo?
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on August 31, 2009, 10:12:49 am
I can't understand how people can't understand CLARIFIED instructions. ._. It makes me a sad blizzard. ;_;
Title: Re: [XP] Easy Party Switcher
Post by: rpgmakerfanhaha on September 01, 2009, 07:13:00 am
okay okay alright alright!Calm down!I have finally found out the way to work the script now.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on September 01, 2009, 07:28:37 am
You seem to be misunderstanding something. Nobody is angry here.
Title: Re: [XP] Easy Party Switcher
Post by: Alunasa on October 21, 2009, 11:01:42 pm
Hi!  First I want to thank you for taking the time to develop and test this script.  It's amazing and very helpful.  I'm very, very new to using scripts and this is the first one that I've installed.

Nortos posted a demo for how to add a button to Change Party from the menu and I copied the code from the demo.  The Easy Party Switcher Script seems to be working perfectly but I'm getting an error message every time I exit the game.  I think it is due to something in the code for the menu.

Oh and this same error appears in both my game and the demo posted by Nortos.  I am using the most recent version of the Easy Party Switcher script.

Here's the error message:
Spoiler: ShowHide
Script 'Scene_Menu' line 243: NameError occurred.
undefined local variable or method 'update' for #<Scene_Exit:0x157e8a0>


Here's a copy of the entire menu code:

Spoiler: ShowHide
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================

class Scene_Menu
 #--------------------------------------------------------------------------
 # * Object Initialization
 #     menu_index : command cursor's initial position
 #--------------------------------------------------------------------------
 def initialize(menu_index = 0)
   @menu_index = menu_index
 end
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   # Make command window
   s1 = $data_system.words.item
   s2 = $data_system.words.skill
   s3 = $data_system.words.equip
   s4 = "Status"
   s5 = "Change Party"
   s6 = "Save"
   s7 = "Exit"
   @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
   @command_window.index = @menu_index
   # If number of party members is 0
   if $game_party.actors.size == 0
     # Disable items, skills, equipment, and status
     @command_window.disable_item(0)
     @command_window.disable_item(1)
     @command_window.disable_item(2)
     @command_window.disable_item(3)
   end
   # If save is forbidden
   if $game_system.save_disabled
     # Disable save
     @command_window.disable_item(4)
   end
   # Make playtime window
   @playtime_window = Window_PlayTime.new
   @playtime_window.x = 0
   @playtime_window.y = 305
   @steps_window = Window_Steps.new
   @steps_window.x = 0
   @steps_window.y = 390
   @gold_window = Window_Gold.new
   @gold_window.x = 0
   @gold_window.y = 255
   # Make status window
   @status_window = Window_MenuStatus.new
   @status_window.x = 160
   @status_window.y = 0
   # 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
   @command_window.dispose
   @playtime_window.dispose
   @steps_window.dispose
   @gold_window.dispose
   @status_window.dispose
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   # Update windows
   @command_window.update
   @playtime_window.update
   @steps_window.update
   @gold_window.update
   @status_window.update
   # If command window is active: call update_command
   if @command_window.active
     update_command
     return
   end
   # If status window is active: call update_status
   if @status_window.active
     update_status
     return
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update (when command window is active)
 #--------------------------------------------------------------------------
 def update_command
   # 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_window.index
     when 0  # item
       # Play decision SE
       $game_system.se_play($data_system.decision_se)
       # Switch to item screen
       $scene = Scene_Item.new
     when 1  # skill
       # 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 2  # equipment
       # 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 3  # status
       # 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 4 # Party Changer
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_PartySwitcher.new
     when 5  # save
       # 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 6  # exit
       # Play decision SE
       $game_system.se_play($data_system.decision_se)
       # Switch to end game screen
       $scene = Scene_Exit.new
     end
     return
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update (when status window is active)
 #--------------------------------------------------------------------------
 def update_status
   # 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_window.index
     when 1  # skill
       # 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 2  # equipment
       # Play decision SE
       $game_system.se_play($data_system.decision_se)
       # Switch to equipment screen
       $scene = Scene_Equip.new(@status_window.index)
     when 3  # status
       # 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
#------------------------------------------------------------------------------
#  This performs exiting
#===================================================

class Scene_Exit
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   # Make command window
   s1 = "To Title"
   s2 = "Exit"
   s3 = "Cancel"
   @command_window = Window_Command.new(192, [s1, s2, s3])
   @command_window.x = 320 - @command_window.width / 2
   @command_window.y = 240 - @command_window.height / 2
   @command_window.opacity = 255
   @spriteset = Spriteset_Map.new
   # Execute transition
   Graphics.transition
   # Main loop
   loop do
     # Update game screen
     Graphics.update
     # Update input information
     Input.update
     # Frame Update
     Frame.update
     # Abort loop if screen is changed
     if $scene != self
       break
     end
   end
   # Prepare for transition
   Graphics.freeze
   # Dispose of window
   @command_window.dispose
   @spriteset.dispose
   # If switching to title screen
   if $scene.is_a?(Scene_Title)
     # Fade out screen
     Graphics.transition
     Graphics.freeze
   end
 end
end


I think that the error message pertains directly to line 243.  Line 243 reads: "update".
Here is the section of the specific code with the line highlighted in red:

Spoiler: ShowHide
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   # Make command window
   s1 = "To Title"
   s2 = "Exit"
   s3 = "Cancel"
   @command_window = Window_Command.new(192, [s1, s2, s3])
   @command_window.x = 320 - @command_window.width / 2
   @command_window.y = 240 - @command_window.height / 2
   @command_window.opacity = 255
   @spriteset = Spriteset_Map.new
   # 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 window
   @command_window.dispose
   @spriteset.dispose
   # If switching to title screen
   if $scene.is_a?(Scene_Title)
     # Fade out screen
     Graphics.transition
     Graphics.freeze


I would appreciate any help that you can give me.  Like I said before, I'm a complete newbie when it comes to scripts and coding so I know next to nothing.  I actually had to look up how to "call a script" and where to insert it.  O.o

Thank you,
-Alunasa
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 22, 2009, 06:22:52 am
That's a weird error. Do you think you could make a small demo demonstrating the problem? I'll take a look at it and fix it then.
Title: Re: [XP] Easy Party Switcher
Post by: Alunasa on October 22, 2009, 06:02:14 pm
Okay, I made a demo and put it up on Megaupload.  The error happens when you enter the game, change party members and then select exit.  Also, I wasn't sure what type of file you needed so I uploaded two different kinds... one WinZip and one made by RMXP.

Exe File:
Spoiler: ShowHide
http://www.megaupload.com/?d=UJG7NF1A


WinZip File:
Spoiler: ShowHide
http://www.megaupload.com/?d=PI0R6PZH


Thanks for the quick reply.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 22, 2009, 06:23:52 pm
I'll look into it ASAP.
Title: Re: [XP] Easy Party Switcher
Post by: Fallen Angel X on October 22, 2009, 06:49:17 pm
Replace the lines under Scene_Exit (Line 220) with:

  #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   # Make command window
   s1 = "To Title"
   s2 = "Shutdown"
   s3 = "Cancel"
   @command_window = Window_Command.new(192, [s1, s2, s3])
   @command_window.x = 320 - @command_window.width / 2
   @command_window.y = 240 - @command_window.height / 2
   # 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 window
   @command_window.dispose
   # If switching to title screen
   if $scene.is_a?(Scene_Title)
     # Fade out screen
     Graphics.transition
     Graphics.freeze
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   # Update command window
   @command_window.update
   # If B button was pressed
   if Input.trigger?(Input::B)
     # Play cancel SE
     $game_system.se_play($data_system.cancel_se)
     # Switch to menu screen
     $scene = Scene_Menu.new(5)
     return
   end
   # If C button was pressed
   if Input.trigger?(Input::C)
     # Branch by command window cursor position
     case @command_window.index
     when 0  # to title
       command_to_title
     when 1  # shutdown
       command_shutdown
     when 2  # quit
       command_cancel
     end
     return
   end
 end
 #--------------------------------------------------------------------------
 # * Process When Choosing [To Title] Command
 #--------------------------------------------------------------------------
 def command_to_title
   # Play decision SE
   $game_system.se_play($data_system.decision_se)
   # Fade out BGM, BGS, and ME
   Audio.bgm_fade(800)
   Audio.bgs_fade(800)
   Audio.me_fade(800)
   # Switch to title screen
   $scene = Scene_Title.new
 end
 #--------------------------------------------------------------------------
 # * Process When Choosing [Shutdown] Command
 #--------------------------------------------------------------------------
 def command_shutdown
   # Play decision SE
   $game_system.se_play($data_system.decision_se)
   # Fade out BGM, BGS, and ME
   Audio.bgm_fade(800)
   Audio.bgs_fade(800)
   Audio.me_fade(800)
   # Shutdown
   $scene = nil
 end
 #--------------------------------------------------------------------------
 # *  Process When Choosing [Cancel] Command
 #--------------------------------------------------------------------------
 def command_cancel
   # Play decision SE
   $game_system.se_play($data_system.decision_se)
   # Switch to menu screen
   $scene = Scene_Menu.new(6)
 end
end
Title: Re: [XP] Easy Party Switcher
Post by: Alunasa on October 22, 2009, 11:04:24 pm
It worked!  Thank you again!
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 23, 2009, 04:06:20 am
Yeah, it can be "solved" that way as well. :P
Title: Re: [XP] Easy Party Switcher
Post by: Alunasa on October 23, 2009, 01:09:31 pm
If you know another way that is safer and more stable for the game, I'll try that too.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 23, 2009, 01:12:09 pm
Finding and fixing the actual problem would be safer than just patching it up, that's all I'm saying. But if this works for you, then there's no need for anything else.
Title: Re: [XP] Easy Party Switcher
Post by: Orici on October 23, 2009, 07:13:14 pm
hey, it seems that the battle switch option is incompatible with guillaume 777's Multi-Slot script (gives error in line 676: NameError occurred - unitialized constant window_partycommand::Window_HorizCommand)
I 'fixed' it by deleting that part since it mentioned the SDK and I'm not using it...It works now but I want to be sure i didn't do something wrong or if there is another way to solve the problem  :P
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 23, 2009, 07:24:53 pm
You probably shouldn't have deleted it. :P The SDK part was there because it's supposed to fix a problem with the SDK. So maybe it'll work out anyway.

Also, it makes not really sense that the script isn't compatible with Guillaume's script since the scripts don't really have any common code. Did you put the scripts in the right order?
Title: Re: [XP] Easy Party Switcher
Post by: Alunasa on October 27, 2009, 06:17:09 pm
I'm making serious progress on the project and I just ran into an issue that I'd like your help with.

I have a total of 12 possible party members including the main character.  I need to make the other 11 characters not selectable for a short period of time.  The problem is that RMXP is only allowing me to enter 10 lines of code which amounts to 5 characters.

How do I tell it that I'd like all party members except #9 to be unavailable?

Here is the code that I was trying to use:
Spoiler: ShowHide
$scene = Scene_PartySwitcher.new
$game_actors[001].
disabled_for_party = true
$game_actors[002].
disabled_for_party = true
$game_actors[003].
disabled_for_party = true
$game_actors[004].
disabled_for_party = true
$game_actors[005].
disabled_for_party = true
$scene = Scene_PartySwitcher.new
$game_actors[006].
disabled_for_party = true
$game_actors[007].
disabled_for_party = true
$game_actors[008].
disabled_for_party = true
$game_actors[010].
disabled_for_party = true
$game_actors[011].
disabled_for_party = true
$scene = Scene_PartySwitcher.new
$game_actors[012].
disabled_for_party = true


The only solution that I've been able to come up with is to delete six characters.  I'd like to avoid doing that if possible.

-Alunasa
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 27, 2009, 06:21:57 pm
Just make 2 script calls. Also, remove the leading zeros or it won't work properly. You can also use something like this:

(1..12).each {|i|
 $game_actors[i].
   disabled_for_party = true}
$game_actors[9].
  disabled_for_party = false
$scene = Scene_PartySwitcher.new
Title: Re: [XP] Easy Party Switcher
Post by: Alunasa on October 27, 2009, 07:47:03 pm
As my partner said, "Allow us to bow to your code BAMFness."

Thank you again!  This works perfectly.  We were beating our heads against the wall trying to figure this out.  Obviously neither of us knows anything about code.  Thanks for the fast reply!

-Alunasa
Title: Re: [XP] Easy Party Switcher
Post by: G_G on October 27, 2009, 07:48:21 pm
another solution you coulda used was 2 script call commands and seperate the code, but use blizzy's code much more better.
Title: Re: [XP] Easy Party Switcher
Post by: AngeliqueSama on November 11, 2009, 09:13:19 am
when i tried it said
line 988 is invalid $game_system.stored_party.compact!

Spoiler: ShowHide
(http://i92.photobucket.com/albums/l28/Nuilsama/error.jpg)
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on November 11, 2009, 09:40:25 am
You tried to switch the current party with a stored party without having a stored party.
Title: Please take a look!
Post by: Sima Yi on May 19, 2010, 05:57:16 am
Please take a look.I know it's an old post,but I just found a big and fat bug here.

I was play-testing my game,then I saved my data in a game file.Then when I loaded the file back and go to the party switcher,there is a duplicate of the player.Can you fix this bug?
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on May 19, 2010, 06:09:09 am
I'd need a working demo of the bug.
Title: Re: [XP] Easy Party Switcher
Post by: Sima Yi on May 21, 2010, 11:33:47 am
!!!I found the PROBLEM WHICH DELAYED ME 3 DAYS FROM WORK! :D!!!

I went to the Scene_Load script and erased the code of the party members being refreshed,cause I want to make it more like the other RPGs.Howver,when I erased that line,I got that problem of a dulipcate character.

Can you help me fix that?Thanks. :P
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on May 21, 2010, 12:16:36 pm
Then your save files are corrupted.
Title: Re: [XP] Easy Party Switcher
Post by: Sima Yi on May 22, 2010, 10:46:11 am
I tried in a new game,but it is still the same. :P
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on May 22, 2010, 10:54:03 am
Then...

Quote from: Blizzard on May 19, 2010, 06:09:09 am
I'd need a working demo of the bug.
Title: Re: [XP] Easy Party Switcher
Post by: Blazblue Fan on May 24, 2010, 10:50:45 pm
I'm sorry if this is a dumb question, but what does it mean when you said that it will corrupt old saved games?
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on May 25, 2010, 02:19:35 am
This script adds variables to data that is saved. When you load a save file, those variables don't exist and are set to nil since they were not initialized so people often get a "no method for nil class" error. It IS possible to set them to some value on loading, but I avoid that as it adds extra code and it's not really necessary. Giving up old save files is a small price to pay. Better that than increase lag on the map.
Title: Re: [XP] Easy Party Switcher
Post by: Sima Yi on May 26, 2010, 05:49:02 am
I got a very simple(Yes there's no deceration,I'm just lazy to do it)demo here:

http://www.mediafire.com/?jjzxnqyyygf (http://www.mediafire.com/?jjzxnqyyygf)

Hope you can help me solve the problem.Thanks. :D

[EDIT]
So...until now is anyone helping me?
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on May 28, 2010, 11:06:58 am
Quote from: Sima Yi on May 21, 2010, 11:33:47 am
I went to the Scene_Load script and erased the code of the party members being refreshed


You deliberately deleted a line in a script and expect it to work. Laughable.
Title: Re: [XP] Easy Party Switcher
Post by: Sima Yi on May 30, 2010, 11:22:35 am
So how can I fix that?

I know that I'm stupid,so I need help.I barely even pass the exam to maintain in Express stream in Secondary 2.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on May 30, 2010, 04:38:45 pm
Put the deleted line back in.
Title: Re: [XP] Easy Party Switcher
Post by: Sima Yi on May 31, 2010, 02:26:34 am
But I don't want the party members to restore their HP and SP.

Quote from: Sima Yi on May 21, 2010, 11:33:47 am

I went to the Scene_Load script and erased the code of the party members being refreshed,cause I want to make it more like the other RPGs.


Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on May 31, 2010, 02:55:07 am
What are you talking about?!
Title: Re: [XP] Easy Party Switcher
Post by: Sima Yi on June 01, 2010, 05:03:03 am
Look at the Scene_Load script.Scroll it to the bottom and find this line.

$game_party.refresh


This is the line I deleted and it caused that duplicate character problem.

Quote from: Blizzard on May 31, 2010, 02:55:07 am
What are you talking about?!


You sounded irritated.Woh.




Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on June 01, 2010, 05:13:01 am

Quote from: Sima Yi on May 31, 2010, 02:26:34 am
But I don't want the party members to restore their HP and SP.


WHAT?!

Quote from: Sima Yi on May 21, 2010, 11:33:47 am
cause I want to make it more like the other RPGs.


Again: WHAT?!

I don't understand at all what your initial problem is. Yes, I am very irritated. Party members are not changed at all when you save the game. Other RPGs don't change data before it is saved either.
Title: Re: [XP] Easy Party Switcher
Post by: Sima Yi on June 01, 2010, 06:01:39 am
After you save on a savedata,you load it.You will realise that your HP and SP will be fully restored.This will cause problem as people can just save and load again if their character's HP are low.

So,I found that what caused the Hp and SP to be fully recovered is the code at the bottom,which is this:

$game_party.refresh


Then I proceed to delete this line.

After I deleted it,yes,the characters' HP and SP did not restore,but when I look at the party changer,I got a duplicate character.

Did you try my demo?
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on June 01, 2010, 07:29:20 am
I repeat:

Quote from: Blizzard on June 01, 2010, 05:13:01 am
Party members are not changed at all when you save the game.


It's possible that you are using a script that messes things up because except if you put copies of database actors into the party, it's not possible that their HP/SP are restored after loading the game.
Title: Re: [XP] Easy Party Switcher
Post by: Sima Yi on June 01, 2010, 08:09:43 am
I found the problem.A script had messed up my whole game.

Thanks Blizz.I finally understood the problem.Sorry if I have caused any anger and irritance(wrong spelling?)over this.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on June 01, 2010, 09:24:48 am
Lol, in future make sure you don't delete stuff from the default scripts just like that. xD
Title: Re: [XP] Easy Party Switcher
Post by: RedViper1990 on June 06, 2010, 07:16:54 am
EDIT:

I used this script:

$game_actors[ID].not_available = true/false


But every time i want to enable the character again, the game freezes.

do i have to use this?

$game_actors[ID].not_available = false
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on June 07, 2010, 08:09:50 am
Quote from: Sase on March 22, 2008, 12:34:47 am
My game freezes if I set not_available to false after setting it to true, but can this be caused with Not_available and Disabled_for_party at the same time? Because I used disabled first and then changed it to not available but I haven't removed the old skript calls.


Quote from: Blizzard on March 25, 2008, 10:30:44 am
Use
bla.not_available =
true

instead of
bla.not_available = true

Title: Re: [XP] Easy Party Switcher
Post by: RedViper1990 on June 07, 2010, 12:14:46 pm
Quote from: Blizzard on March 25, 2008, 10:30:44 am
Use
bla.not_available =
true

instead of
bla.not_available = true




Thanks :-*
Title: Re: [XP] Easy Party Switcher
Post by: SilverShadow737 on August 10, 2010, 09:31:04 pm
The party wipe doesn't work.
Even in the demo...
Also in the demo, if you try to continue with a party of 1 it says please make a party of 6.
Title: Re: [XP] Easy Party Switcher
Post by: InvokingRainbows on October 25, 2010, 02:54:30 am
Hey! :)

Well I'm currently attempting to make a Sailor Moon RPG and I really want it to be perfect. I've searched around a lot for a reserve party system and so far yours is the best I've been able to find! However, I am having a few problems with it.

First I should probably say that I am using a side-view battle script, though so far it seems to be completely compatible with your script.

OK well I saw earlier that someone wanted to have the party selector option on the menu, and that you posted a demo with this option. Well my game is already in development so I just copied and pasted the script from the demo into my own and I can't get it to show up in the menu. Any ideas why?

Also, I noticed that ALL of my actors show up in the reserve party when I set it to turn on via an event. Is there a way to set it so that only members that have been added to the party show up in said reserve? I appreciate the help as I am new to scripting! :)

Oh yeah, one more thing. Originally it worked I believe as you intended, and then when I began to try to get it available in the party menu I now get an error that says something like "unable to locate "char_set_file_FACE" when I attempt to activate the scrtipt..
Title: Re: [XP] Easy Party Switcher
Post by: Holyrapid on November 07, 2010, 02:52:43 am
I got a bug in the demo. After fighting the ghost after having an empty party (is it the fourth or fifth fight? I didn't keep count...) i get this error:
Script ' (*) Scene_PartySwitcher' line 988: NoMethodError occured. undefined method `compact! for nil: NilClass
Title: Re: [XP] Easy Party Switcher
Post by: RenegadeNick27 on December 06, 2010, 05:29:51 pm
Is there any way ti give exp to actors that are not in your 4 person party
Title: Re: [XP] Easy Party Switcher
Post by: fjurio on December 06, 2010, 05:37:04 pm
There is a "change EXP" command. I don´t know if you can give EXP to an actor who isn´t in the party but at least you can save the amount and give him the points if he join the party.
Title: Re: [XP] Easy Party Switcher
Post by: Sacred Nym on December 09, 2010, 02:28:58 pm
Quote from: RenegadeNick27 on December 06, 2010, 05:29:51 pm
Is there any way ti give exp to actors that are not in your 4 person party

If you mean from battles, yes it's possibleby manipulating the EXP_RESERVE, EXP_NOT_AVAILABLE, and EXP_DISABLED_FOR_PARTY constants at the start of the script.
Title: Re: [XP] Easy Party Switcher
Post by: Bernkastel on January 27, 2011, 03:24:01 am
Alright, I get a No Method Error when I call the script and put $game_party.actors[7].forced_position = 0


The error I get is:
undefined method 'forced_position' for [7]:Array

Any ideas?
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on January 27, 2011, 04:03:51 am
Are you using some sort of custom party script? Judging by the error, $game_party.actors[7] is an array which means you would have to use something like $game_party.actors[7][0] or $game_party.actors[7][1] to make it work which is not the standard way.
Title: Re: [XP] Easy Party Switcher
Post by: Bernkastel on January 27, 2011, 04:13:32 am
No, actually. This is the only party script I have.

I tried doing what you told me to do. $game_party.actors[7][0] That didn't work. I'm really confused :???: :???: :???: I got a new error.

NoMethodError occurred while running script.
undefined method for '[]' for nil:NilClass
Title: Re: [XP] Easy Party Switcher
Post by: ForeverZer0 on January 27, 2011, 12:14:35 pm
You got some sort of funky business going on. Somehow, someway, a party member, which should be an instance of Game_Actor, is now an array. Start a new project, re-copy and paste the script in from the website, and try again. Likely some edit was made that shouldn't have been made.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on January 27, 2011, 12:18:13 pm
$game_party.actors[7] does not exist. Are you sure you have 8 party members?
Title: Re: [XP] Easy Party Switcher
Post by: Bernkastel on January 27, 2011, 03:38:45 pm
Quote from: ForeverZer0 on January 27, 2011, 12:14:35 pm
You got some sort of funky business going on. Somehow, someway, a party member, which should be an instance of Game_Actor, is now an array. Start a new project, re-copy and paste the script in from the website, and try again. Likely some edit was made that shouldn't have been made.


That was exactly it. I feel like a total retard. Thank you both for helping me. Means a lot. :^_^': :^_^':
Title: Re: [XP] Easy Party Switcher
Post by: cheos on April 07, 2011, 12:23:06 am
ok i use Blizz-ABS and easy party switcher and i ran into a error
Spoiler: ShowHide
Script 'Easy Party Switcher' line 415: SyntaxError occurred.

when i try to call script
$game_actors[ID].
must_be_in_party = true

how do i fix it???
Title: Re: [XP] Easy Party Switcher
Post by: ForeverZer0 on April 07, 2011, 12:30:45 am
You can't break to a new line in that situation. Try this:

chr = $game_actors[ID_OF_CHARACTER]
chr.must_be_in_party = true
Title: Re: [XP] Easy Party Switcher
Post by: cheos on April 07, 2011, 11:51:47 am
no dident work i got the same error let me give u the script maby its there i s a problem there
Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Easy Party Switcher by Blizzard
# Version 2.43b
# Type: Party Changing System
# Date: 21.05.2006
# Date v1.1: 25.05.2006
# Date v1.2b: 27.05.2006
# Date v1.5b: 3.11.2006
# Date v1.51b: 29.11.2006
# Date v1.52b: 6.12.2006
# Date v1.7b: 23.2.2007
# Date v1.8b: 30.4.2007
# Date v2.0b: 7.8.2007
# Date v2.1b: 24.8.2007
# Date v2.11b: 24.9.2007
# Date v2.3b: 26.1.2008
# Date v2.32b: 28.1.2008
# Date v2.4b: 29.1.2008
# Date v2.41b: 6.8.2008
# Date v2.42b: 14.10.2008
# Date v2.43b: 20.10.2008
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#   
#  This work is protected by the following license:
# #----------------------------------------------------------------------------
# # 
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# # 
# #  You are free:
# # 
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# # 
# #  Under the following conditions:
# # 
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# # 
# #  Noncommercial. You may not use this work for commercial purposes.
# # 
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# # 
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# # 
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# # 
# #  - Nothing in this license impairs or restricts the author's moral rights.
# # 
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Special Thanks to:
#
#   Zeriab for pointing out a few glitches and shortening the code in an
#   earlier version. =D
#
#
# IMPORTANT NOTE:
#
#   Be sure to set the MAX_PARTY to the maximum size of your party. There is
#   already a preconfiguration of 4.
#
#
# Compatibility:
#
#   98% compatible with SDK v1.x. 90% compatible with SDK 2.x. Can cause
#   incompatibility issued with other Party Change Systems. Can cause problems
#   with CBS-es if you use the battle switch feature. WILL corrupt your old
#   savegames.
#
#
# Features:
#
#   - set party members for "not _available" (shown transparent in the reserve)
#   - remove party members from the reserve list ("disabled_for_party")
#   - set party members, who MUST be in the party (shown transparent in the
#     current party, "must_be_in_party")
#   - set up forced positions for party members
#   - set up forced party size
#   - option either to wipe the party (for multi-party use) or only remove
#     every member (except 1) from the party.
#   - easy to use and easy to switch party members
#   - also supports small parties (2 or 3 members) and large parties (5 or
#     more)
#   - uses facesets optionally
#
# v1.5b:
#   - better, shorter and more efficient code (less memory use, less CPU use)
#   - fixed potential bugs
#
# v1.7b:
#   - improved coding
#   - facesets now optional
#   - no extra bitmap files needed anymore
#   - works now with Tons of Add-ons
#
# v1.8b:
#   - added "forced position"
#   - added "forced party size"
#
# v2.0b:
#   - fixed the bug where you could empty the party... again...
#   - fixed the bug that appeared when you pressed SHIFT
#   - added option to allow an empty party
#   - added "EXP for party members in reserve" option
#   - made the forced_size for party work more convenient
#   - improved coding
#   - slightly decreased lag
#
# v2.1b:
#   - fixed a bug
#   - improved coding
#   - rewritten conditions using classic syntax to avoid RGSS conditioning bug
#   - now can serve as enhancement for CP Debug System
#
# v2.11b:
#   - improved coding and performance
#
# v2.3b:
#   - optional feature to call the Party Switcher during battle
#
# v2.32b:
#   - fixed crash problem with SDK 2.x when using the BATTLE_SWITCH option
#   - fixed SP display glitch when using BARS from Tons of Add-ons
#
# v2.4b:
#   - now you can activate party order change only in the party switcher
#   - add option for automatic party order change only in battle
#
# v2.41b:
#   - fixed problem where you could put together a party where everybody is
#     dead
#
# v2.42b:
#   - added possibility to change the BATTLE_SWITCH setting during the game
#
# v2.43b:
#   - fixed a problem with SDK 2.x
#
#
# How to use:
#
#   To call this script, make a "Call script" command in an event.
#
#   1. Syntax: $scene = Scene_PartySwitcher.new
#      No extra feature will be applied and you can switch the party as you
#      wish.
#
#   2. Syntax: $scene = Scene_PartySwitcher.new(XXX)
#      You can replace XXX for 1 to remove all party members except one (either
#      one, who must be in the party or a random one), or replace XXX with 2,
#      to cause a wipe party. Wiping a party will disable the of the current
#      members and a NEW party of the remaining members must be formed. If you
#      replace it with 3, the current party configuration will be stored for a
#      later fast switch-back. If XXX is 10, all actors will be available for
#      party switching no matter if the are "not_available" or
#      "disabled_for_party". This feature if used by the CP Debug System. No
#      faceset will be used in this case for a more convenient working.
#
#   3. Syntax: $scene = Scene_PartySwitcher.new(XXX, 1)
#      You can use the XXX as described above or just set it to 0 to disable
#      it. Also the "1" in the syntax will reset any disabled_for_party and is
#      made to be used after multi-party use.
#
#   4. Syntax: $scene = Scene_PartySwitcher.new(XXX, YYY, ZZZ)
#      You can replace ZZZ with 1 to replace the party with a stored one AND
#      store the current or replace it with 2 to replace the party with a
#      stored one, but without storing the current. USE THIS ONLY IF YOU ASSUME
#      TO HAVE A STORED PARTY READY! You can simply test if there is a store
#      party by putting this code into the conditional branch script:
#
#      $game_system.stored_party != nil
#
#      This syntax will not open the Party Switcher and it will override the
#      commands XXX and YYY, so you can replace these with any number.
#   
#   5. To activate/deactivate the option of order change only, simply use the
#      event command "Call Script" with following syntax:
#     
#      $game_system.order_only = true/false
#     
#      If the setting is set to true, the switcher will allow only party order
#      change. The same goes for battle change (if you are using the
#      BATTLE_SWITCH option), but the syntax is different:
#     
#      $game_system.battle_order_only = true/false
#     
#      The BATTLE_SWITCH option can be changed during the game by using
#      following syntax:
#     
#      $game_system.battle_switch = true/false
#     
#      This option is intially set to the same setting as BATTLE_SWITCH is.
#     
#   Character faces go into the "Characters" folder and they have the same name
#   as the character spritesets have with _face added
#
#   Example:
#
#     sprite - Marlen.png
#     face   - Marlen_face.png
#
#   Other syntaxes:
#     $game_actors[ID].not_available = true/false
#     $game_actors[ID].disabled_for_party = true/false
#     $game_actors[ID].must_be_in_party = true/false
#     $game_actors[ID].forced_position = nil/0/1/2/...
#   OR
#     $game_party.actors[POS].not_available = true/false
#     $game_party.actors[POS].disabled_for_party = true/false
#     $game_party.actors[POS].must_be_in_party = true/false
#     $game_party.actors[POS].forced_position = nil/0/1/2/...
#
#   ID  - the actor's ID in the database
#   POS - the actor's position in the party (STARTS FROM 0, not 1!)
#
#   not_available
#   - will disable the possibility of an already unlocked character to be in
#     the current party
#
#   disabled_for_party
#   - will cause the character NOT to appear in the party switch screen at all
#
#   must_be_in_party
#   - will cause the character to be automatically moved into the current party
#     and he also cannot be put in the reserve
#
#   forced_position
#   - will enforce the player to be at a specific position in the party, set
#     this value to nil to disable this feature, use it in combination with
#     must_be_in_party and $game_party.forced_size or you might experience
#     bugs,
#
#   $game_party.forced_size = nil/0/1/2/...
#
#   Using this syntax will enforce a specific party size. The EPS won't exit
#   until this size is filled up or there are no more in the reserve. EPS will
#   automatically "correct" this number if there are not enough characters in
#   the reserve to fill up a party of forced_size. Set this value to nil to
#   disable the size requirement. Note that the actor DO NOT HAVE TO be set in
#   normal order without any empty position like in version 1.x.
#
#
# Additional note:
#
#   For your own sake, do not apply the attribute "must_be_in_party" to a
#   character at the same time with "not_available" or "disabled_for_party" as
#   this WILL disrupt your party and party switch system. Use "forced_position"
#   together with "must_be_in_party" to avoid bugs. Be careful when using
#   "forced_position" with "$game_party.forced_size". Add actors at the very
#   end to be sure the player can't put others after them if the "forced_size"
#   is smaller than the maximum party size.
#
#
# If you find any bugs, please report them here:
# http://www.chaosproject.co.nr
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#==============================================================================
# module BlizzCFG
#==============================================================================

module BlizzCFG

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Conficuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  # how many party members do you use
  MAX_PARTY = 4
  # set to true to use facesets instead of spritesets
  FACESETS = false
  # allows a party with 0 members
  ALLOW_EMPTY_PARTY = false
  # allows switching the party in battle
  BATTLE_SWITCH = false
  # name of the call command in the party menu in battle
  SWITCH_COMMAND = 'Switch'
  # gives all other characters EXP (specify in %)
  EXP_RESERVE = 50
  # gives "not available" characters EXP (specify in %)
  EXP_NOT_AVAILABLE = 0
  # gives "disabled for party" characters EXP (specify in %)
  EXP_DISABLED_FOR_PARTY = 0
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Conficuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

end

# recognition variable for plug-ins
$easy_party_switcher = 2.43

#==============================================================================
# Game_Actor
#==============================================================================

class Game_Actor < Game_Battler

  attr_accessor :must_be_in_party
  attr_accessor :disabled_for_party
  attr_accessor :not_available
  attr_accessor :forced_position
 
  alias setup_eps_later setup
  def setup(actor_id)
    setup_eps_later(actor_id)
    @must_be_in_party = @disabled_for_party = @not_available = false
  end
 
end

#==============================================================================
# Game_System
#==============================================================================

class Game_System

  attr_accessor :stored_party
  attr_accessor :order_only
  attr_accessor :battle_order_only
  attr_accessor :battle_switch
 
  alias init_eps_later initialize
  def initialize
    init_eps_later
    @order_only = @battle_order_only = false
    @battle_switch = BlizzCFG::BATTLE_SWITCH
  end
 
end

#==============================================================================
# Game_Party
#==============================================================================

class Game_Party

  attr_accessor :actors
  attr_accessor :forced_size
 
  def any_forced_position
    return (@actors.any? {|actor| actor != nil && actor.forced_position != nil})
  end
 
end

#==============================================================================
# Window_Base
#==============================================================================

class Window_Base

  alias draw_actor_graphic_eps_later draw_actor_graphic
  def draw_actor_graphic(actor, x, y)
    if actor != nil && actor.character_name != ''
      classes = [Window_Current, Window_Reserve, Window_HelpStatus]
      if BlizzCFG::FACESETS && !$all_available && classes.include?(self.class)
        draw_actor_face_eps(actor, x, y)
      else
        if classes.include?(self.class)
          bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
          x += bitmap.width / 8 + 24
          y += bitmap.height / 4 + 16
        end
        draw_actor_graphic_eps_later(actor, x, y)
      end
    end
  end

  def draw_actor_face_eps(actor, x, y)
    if $tons_version == nil || $tons_version < 3.71 || !FACE_HUE
      hue = 0
    else
      hue = actor.character_hue
    end
    bitmap = RPG::Cache.character("#{actor.character_name}_face", hue)
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    if actor.not_available || actor.must_be_in_party
      self.contents.blt(x, y, bitmap, src_rect, 128)
    else
      self.contents.blt(x, y, bitmap, src_rect)
    end
  end
 
end

#==============================================================================
# Window_BattleResult
#==============================================================================

class Window_BattleResult
 
  attr_reader :exp
 
end

#==============================================================================
# Window_Current
#==============================================================================

class Window_Current < Window_Selectable

  def initialize
    super(0, 0, 240 + 32, (BlizzCFG::MAX_PARTY > 4 ? 480 : BlizzCFG::MAX_PARTY * 120))
    self.contents = Bitmap.new(width - 32, 448 + (BlizzCFG::MAX_PARTY-4) * 120)
    @item_max = BlizzCFG::MAX_PARTY
    if $fontface != nil
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
    end
    self.contents.font.size = 24
    refresh
    self.active, self.index, self.z = false, -1, 5000
  end
 
  def refresh
    self.contents.clear
    $game_party.actors.each_index {|i|
        if $game_party.actors[i] != nil
          draw_actor_graphic($game_party.actors[i], 4, i*120+4)
          draw_actor_name($game_party.actors[i], 152, i*120-4)
          draw_actor_level($game_party.actors[i], 88, i*120-4)
          draw_actor_hp($game_party.actors[i], 88, i*120+24)
          draw_actor_sp($game_party.actors[i], 88, i*120+52)
        end}
  end

  def setactor(index_1, index_2)
    $game_party.actors[index_2], $game_party.actors[index_1] =
        $game_party.actors[index_1], $game_party.actors[index_2]
    refresh
  end

  def getactor(index)
    return $game_party.actors[index]
  end
 
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
      return
    end
    row = @index / @column_max
    self.top_row = row if row < self.top_row
    self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
    y = (@index / @column_max) * 120 - self.oy
    self.cursor_rect.set(0, y, self.width - 32, 88)
  end

  def clone_cursor
    row = @index / @column_max
    self.top_row = row if row < self.top_row
    self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
    y = (@index / @column_max) * 120
    src_rect = Rect.new(0, 0, self.width, 88)
    bitmap = Bitmap.new(self.width-32, 88)
    bitmap.fill_rect(0, 0, self.width-32, 88, Color.new(255, 255, 255, 192))
    bitmap.fill_rect(2, 2, self.width-36, 84, Color.new(255, 255, 255, 80))
    self.contents.blt(0, y, bitmap, src_rect, 192)
  end
 
  def top_row
    return self.oy / 116
  end

  def top_row=(row)
    self.oy = (row % row_max) * 120
  end

  def page_row_max
    return (self.height / 120)
  end

end

#==============================================================================
# Window_Reserve
#==============================================================================

class Window_Reserve < Window_Selectable
 
  attr_reader :actors
 
  def initialize(scene)
    super(0, 0, 368, 320)
    setup
    @column_max, rows = 3, @item_max / @column_max
    self.contents = Bitmap.new(width - 32, (rows >= 3 ? rows * 96 : height - 32))
    if $fontface != nil
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
    end
    self.contents.font.size = 24
    self.active, self.index, self.z = false, -1, 5000
    refresh
    if scene == Scene_Map && $game_system.order_only ||
        scene == Scene_Battle && $game_system.battle_order_only
      self.opacity = 128
    end
  end
 
  def setup
    @actors = []
    (1...$data_actors.size).each {|i|
        unless $game_party.actors.include?($game_actors[i]) ||
            $game_actors[i].disabled_for_party && !$all_available
          @actors.push($game_actors[i])
        end}
    @item_max = (@actors.size + $game_party.actors.size + 3) / 3 * 3
  end
 
  def refresh
    self.contents.clear
    @actors.each_index {|i| draw_actor_graphic(@actors[i], i%3*112+16, i/3*96+8)}
  end
 
  def getactor(index)
    return @actors[index]
  end
 
  def get_number
    return (@actors.find_all {|actor| actor != nil}).size if $all_available
    return (@actors.find_all {|actor| actor != nil && !actor.not_available}).size
  end
 
  def setactor(index_1, index_2)
    @actors[index_1], @actors[index_2] = @actors[index_2], @actors[index_1]
    refresh
  end

  def setparty(index_1, index_2)
    @actors[index_1], $game_party.actors[index_2] =
        $game_party.actors[index_2], @actors[index_1]
    refresh
  end

  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
      return
    end
    row = @index / @column_max
    self.top_row = row if row < self.top_row
    self.top_row = row - (page_row_max-1) if row > top_row + (page_row_max-1)
    x, y = (@index % @column_max)*112 + 8, (@index / @column_max)*96 - self.oy
    self.cursor_rect.set(x, y, 96, 96)
  end

  def clone_cursor
    row = @index / @column_max
    self.top_row = row if row < self.top_row
    self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
    x, y = (@index % @column_max) * 112 + 8, (@index / @column_max) * 96
    src_rect = Rect.new(0, 0, 96, 96)
    bitmap = Bitmap.new(96, 96)
    bitmap.fill_rect(0, 0, 96, 96, Color.new(255, 255, 255, 192))
    bitmap.fill_rect(2, 2, 92, 92, Color.new(255, 255, 255, 80))
    self.contents.blt(x, y, bitmap, src_rect, 192)
  end
 
  def top_row
    return self.oy / 96
  end

  def top_row=(row)
    row = row % row_max
    self.oy = row * 96
  end

  def page_row_max
    return (self.height - 32) / 96
  end

end

#==============================================================================
# Window_HelpStatus
#==============================================================================

class Window_HelpStatus < Window_Base

  def initialize(gotactor, scene)
    super(0, 0, 400 - 32, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    if $fontface != nil
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
    end
    self.contents.font.size = 24
    refresh(gotactor)
    self.active, self.z = false, 5000
    if scene == Scene_Map && $game_system.order_only ||
        scene == Scene_Battle && $game_system.battle_order_only
      self.opacity = 128
    end
  end
 
  def refresh(actor)
    self.contents.clear
    if actor != nil
      self.contents.font.color = normal_color
      if actor.not_available && !$all_available
        self.contents.draw_text(8, 0, 160, 32, 'not available', 0)
      end
      draw_actor_graphic(actor, 0, 40)
      draw_actor_name(actor, 160, 32)
      draw_actor_level(actor, 96, 32)
      draw_actor_hp(actor, 96, 64)
      draw_actor_sp(actor, 96, 96)
    end
  end

end

#==============================================================================
# Window_Warning
#==============================================================================

class Window_Warning < Window_Base

  def initialize(mode, members)
    super(0, 0, 320, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    if $fontface != nil
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
    end
    self.contents.font.size = 24
    self.x, self.y, self.z = 320 - width/2, 240 - height/2, 9999
    self.contents.font.color = normal_color
    case mode
    when 0
      self.contents.draw_text(0, 0, 288, 32, 'You need a party', 1)
      num = [$game_party.forced_size, members + $game_party.actors.nitems].min
      self.contents.draw_text(0, 32, 288, 32, "of #{num} members!", 1)
    when 1
      self.contents.draw_text(0, 0, 288, 32, 'You cannot remove', 1)
      self.contents.draw_text(0, 32, 288, 32, 'the last party member!', 1)
    when 2
      self.contents.draw_text(0, 0, 288, 32, 'At least one member', 1)
      self.contents.draw_text(0, 32, 288, 32, 'has to be alive!', 1)
    end
  end

end

#==============================================================================
# Window_PartyCommand
#==============================================================================

class Window_PartyCommand
 
  alias init_eps_later initialize
  def initialize
    if $game_system.battle_switch
      if defined?(SDK) && self.is_a?(Window_HorizCommand)
        s1 = SDK::Scene_Commands::Scene_Battle::Fight
        s2 = SDK::Scene_Commands::Scene_Battle::Escape
        s3 = BlizzCFG::SWITCH_COMMAND
        super(640, [s1, s2, s3])
        disable_item(1) unless $game_temp.battle_can_escape
      else
        super(0, 0, 640, 64)
        self.contents = Bitmap.new(width - 32, height - 32)
        @commands = ['Fight', 'Escape', BlizzCFG::SWITCH_COMMAND]
        @item_max = @column_max = 3
        draw_item(0, normal_color)
        draw_item(1, $game_temp.battle_can_escape ? normal_color : disabled_color)
        draw_item(2, normal_color)
      end
      self.active, self.visible, self.index = false, false, 0
      self.back_opacity = 160
    else
      init_eps_later
    end
  end
 
  alias draw_item_eps_later draw_item
  def draw_item(index, color)
    if $game_system.battle_switch
      self.contents.font.color = color
      rect = Rect.new(80 + index * 160 + 4, 0, 128 - 10, 32)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      self.contents.draw_text(rect, @commands[index], 1)
    else
      draw_item_eps_later(index, color)
    end
  end
 
  alias update_cursor_rect_eps_later update_cursor_rect
  def update_cursor_rect
    if $game_system.battle_switch
      self.cursor_rect.set(80 + index * 160, 0, 128, 32)
    else
      update_cursor_rect_eps_later
    end
  end
 
  def command(index = self.index)
    return @commands[index]
  end
 
end

#==============================================================================
# Scene_PartySwitcher
#==============================================================================

class Scene_PartySwitcher
 
  def initialize(wipe_party = 0, reset = 0, store = 0)
    @wipe_party, @store, @reset = store, reset, wipe_party
    @current_window_temp = @reserve_window_temp = 0
    @scene_flag, @temp_window = false, ''
    @scene = $scene.class
  end
 
  def main
    if @store != 0
      swap_parties
      $scene = Scene_Map.new
      $game_player.refresh
      return
    end
    case @wipe_party
    when 1 then setup_forced_party
    when 2 then wipe_party
    when 3
      $game_system.stored_party = $game_party.actors
      wipe_party
    when 10 then $all_available = true
    end
    if @reset == 1
      (1...$data_actors.size).each {|i| $game_actors[i].not_available = false}
    end
    @current_window = Window_Current.new
    @current_window.index, @current_window.active = 0, true
    @reserve_window = Window_Reserve.new(@scene)
    @reserve_window.x, @reserve_window.y = 272, 160
    @help_window = Window_HelpStatus.new(@reserve_window.getactor(0), @scene)
    @help_window.x = 240 + 32
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    Graphics.freeze
    [@current_window, @reserve_window, @help_window].each {|win| win.dispose}
    $game_party.actors.compact!
    $game_player.refresh
    $all_available = nil
  end
 
  def update
    check = @reserve_window.index
    if @reserve_window.active
      reserve_update
      @reserve_window.update
    end
    if check != @reserve_window.index
      if @reserve_window.active
        actor = @reserve_window.getactor(@reserve_window.index)
      elsif @current_window.active
        actor = @reserve_window.getactor(@reserve_window_temp)
      end
      @help_window.refresh(actor) if ['', 'Current'].include?(@temp_window)
    end
    current_update if @current_window.active
    if Input.trigger?(Input::B)
      if @scene_flag
        $game_system.se_play($data_system.cancel_se)
        @scene_flag, @temp_window = false, ''
        if @reserve_window.active
          actor = @reserve_window.getactor(@reserve_window.index)
        elsif @current_window.active
          actor = @reserve_window.getactor(@reserve_window_temp)
        end
        @help_window.refresh(actor) if ['', 'Current'].include?(@temp_window)
        [@current_window, @reserve_window].each {|win| win.refresh}
        return
      end
      if $game_party.forced_size != nil &&
          ($game_party.forced_size < $game_party.actors.nitems ||
          ($game_party.forced_size > $game_party.actors.nitems &&
          @reserve_window.get_number != 0))
        $game_system.se_play($data_system.buzzer_se)
        warning(1)
        return
      end
      if $game_party.actors.all? {|actor| actor == nil ||
            actor != nil && actor.dead?}
        $game_system.se_play($data_system.buzzer_se)
        warning(2)
        return
      end
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::A)
      if $game_party.any_forced_position
        $game_system.se_play($data_system.buzzer_se)
      else
        $game_system.se_play($data_system.decision_se)
        $game_party.actors.compact!
        @current_window.refresh
      end
    end
  end
   
  def current_update
    @current_window.update
    if Input.trigger?(Input::C)
      actor = @current_window.getactor(@current_window.index)
      if actor != nil && actor.forced_position != nil
        $game_system.se_play($data_system.buzzer_se)
      else
        if @scene_flag
          switch_members
        else
          $game_system.se_play($data_system.decision_se)
          @scene_flag, @temp_window = true, 'Current'
          @temp_actor_index = @current_window.index
          @current_window.clone_cursor
        end
      end
    elsif Input.trigger?(Input::RIGHT)
      if @scene == Scene_Map && $game_system.order_only ||
          @scene == Scene_Battle && $game_system.battle_order_only
        $game_system.se_play($data_system.buzzer_se)
      else
        $game_system.se_play($data_system.cursor_se)
        @current_window.active = false
        @reserve_window.active = true
        @current_window_temp = @current_window.index
        actor = @reserve_window.getactor(@reserve_window_temp)
        @current_window.index = -1
        @reserve_window.index = @reserve_window_temp
        @help_window.refresh(actor) unless @scene_flag
      end
    end
  end
 
  def reserve_update
    if Input.trigger?(Input::C)
      if @scene_flag
        switch_members
      else
        $game_system.se_play($data_system.decision_se)
        @scene_flag, @temp_window = true, 'Reserve'
        @temp_actor_index = @reserve_window.index
        @reserve_window.clone_cursor
      end
    elsif @reserve_window.index % 3 == 0 && Input.repeat?(Input::LEFT)
      $game_system.se_play($data_system.cursor_se)
      @reserve_window.active = false
      @current_window.active = true
      @reserve_window_temp = @reserve_window.index
      @reserve_window.index = -1
      @current_window.index = @current_window_temp
    end
  end
 
  def switch_members
    if @temp_window == 'Reserve' && @reserve_window.active
      @reserve_window.setactor(@temp_actor_index, @reserve_window.index)
      actor = @reserve_window.getactor(@reserve_window.index)
      @help_window.refresh(actor)
    end
    if @temp_window == 'Current' && @current_window.active
      @current_window.setactor(@temp_actor_index, @current_window.index)
    end
    if @temp_window == 'Reserve' && @current_window.active
      actor1 = @current_window.getactor(@current_window.index)
      actor2 = @reserve_window.getactor(@temp_actor_index)
      if call_warning?(@current_window.index, actor2)
        if actor1 != nil && actor1.must_be_in_party
          $game_system.se_play($data_system.buzzer_se)
          @scene_flag, @temp_window = false, ''
          actor = @reserve_window.getactor(@reserve_window_temp)
          [@current_window, @reserve_window].each {|win| win.refresh}
          @help_window.refresh(actor)
          return
        end
        if actor2 != nil && actor2.not_available && !$all_available
          $game_system.se_play($data_system.buzzer_se)
          @scene_flag, @temp_window = false, ''
          actor = @reserve_window.getactor(@reserve_window_temp)
          [@current_window, @reserve_window].each {|win| win.refresh}
          @help_window.refresh(actor)
          return
        end
        @reserve_window.setparty(@temp_actor_index, @current_window.index)
        @current_window.refresh
        actor = @reserve_window.getactor(@reserve_window_temp)
        @help_window.refresh(actor)
      else
        warning(0)
      end
    end
    if @temp_window == 'Current' && @reserve_window.active
      actor1 = @current_window.getactor(@temp_actor_index)
      actor2 = @reserve_window.getactor(@reserve_window.index)
      if call_warning?(@temp_actor_index, actor2)
        if actor1 != nil && actor1.must_be_in_party
          $game_system.se_play($data_system.buzzer_se)
          @scene_flag, @temp_window = false, ''
          actor = @reserve_window.getactor(@reserve_window.index)
          [@current_window, @reserve_window].each {|win| win.refresh}
          @help_window.refresh(actor)
          return
        end
        if actor2 != nil && actor2.not_available && !$all_available
          $game_system.se_play($data_system.buzzer_se)
          @scene_flag, @temp_window = false, ''
          actor = @reserve_window.getactor(@reserve_window.index)
          [@current_window, @reserve_window].each {|win| win.refresh}
          @help_window.refresh(actor)
          return
        end
        @reserve_window.setparty(@reserve_window.index, @temp_actor_index)
        @current_window.refresh
        actor = @reserve_window.getactor(@reserve_window.index)
        @help_window.refresh(actor)
      else
        warning(0)
      end
    end
    $game_system.se_play($data_system.decision_se)
    @scene_flag, @temp_window = false, ''
  end
   
  def wipe_party
    $game_party.actors.each {|actor| actor.not_available = true if actor != nil}
    setup_forced_party(true)
    if $game_party.actors == []
      (1...$data_actors.size).each {|i|
          unless $game_actors[i].not_available ||
              $game_actors[i].disabled_for_party
            $game_party.actors.push($game_actors[i])
            return
          end}
    end
  end
 
  def setup_forced_party(flag = false)
    $game_party.actors, party = [], []
    (1...$data_actors.size).each {|i|
        if $game_actors[i] != nil && $game_actors[i].must_be_in_party &&
             (!$game_actors[i].disabled_for_party || flag) &&
             !$game_actors[i].not_available
          party.push($game_actors[i])
        end}
    party.clone.each {|actor|
        if actor.forced_position != nil
          $game_party.actors[actor.forced_position] = actor
          party.delete(actor)
        end}
    $game_party.actors.each_index {|i|
        $game_party.actors[i] = party.shift if $game_party.actors[i] == nil}
    $game_party.actors += party.compact
  end 
 
  def swap_parties
    $game_party.actors.compact!
    temp_actors = $game_party.actors
    temp_actors.each {|actor| actor.not_available = true}
    $game_system.stored_party.compact!
    $game_system.stored_party.each {|actor| actor.not_available = false}
    $game_party.actors = $game_system.stored_party
    $game_system.stored_party = (@store == 1 ? temp_actors : nil)
  end
 
  def call_warning?(index, actor2)
    return (BlizzCFG::ALLOW_EMPTY_PARTY || $game_party.actors[index] == nil ||
        actor2 != nil || $game_party.actors.nitems > 1)
  end
 
  def warning(type)
    $game_system.se_play($data_system.buzzer_se)
    @warning_window = Window_Warning.new(type, @reserve_window.get_number)
    loop do
      Graphics.update
      Input.update
      if Input.trigger?(Input::C)
        $game_system.se_play($data_system.decision_se) if type > 0
        [@current_window, @reserve_window].each {|win| win.refresh}
        @warning_window.dispose
        @warning_window = nil
        break
      end
    end
  end
 
end

#==============================================================================
# Scene_Battle
#==============================================================================
 
class Scene_Battle
 
  alias update_phase2_eps_later update_phase2
  def update_phase2
    update_phase2_eps_later
    if Input.trigger?(Input::C) && @party_command_window.index == 2
      $game_system.se_play($data_system.decision_se)
      @spriteset.dispose
      $scene = Scene_PartySwitcher.new
      $scene.main
      $scene = self
      @spriteset = Spriteset_Battle.new
      15.times {@spriteset.update}
      @status_window.refresh
      Graphics.transition(0)
    end
  end
 
  alias start_phase5_eps_later start_phase5
  def start_phase5
    start_phase5_eps_later
    (1...$data_actors.size).each {|i|
        unless $game_party.actors.include?($game_actors[i])
          if $game_actors[i].not_available
            $game_actors[i].exp += @result_window.exp * BlizzCFG::EXP_NOT_AVAILABLE/100
          elsif $game_actors[i].disabled_for_party
            $game_actors[i].exp += @result_window.exp * BlizzCFG::EXP_DISABLED_FOR_PARTY/100
          else
            $game_actors[i].exp += @result_window.exp * BlizzCFG::EXP_RESERVE/100
          end
        end}
  end
 
end


maybe it is the sript cause i get the error befor the tittle screen when i start the game
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on April 07, 2011, 12:02:41 pm
I'm not getting any syntax errors from this script that you posted. Are you sure that you are using an unedited version of the script, that you are using that exact script that you just posted?
Title: Re: [XP] Easy Party Switcher
Post by: cheos on April 07, 2011, 12:43:38 pm
works now tks blizzard and foreverzero
Title: Re: [XP] Easy Party Switcher
Post by: Alby4t5 on May 02, 2011, 04:55:15 pm
This script is totally awesome, however I have a slight problem. I have the switcher as one of my menu commands, but I would like to make it to where the command is disabled until reaching a certain point of the game, kinda like you would do for the Save command. Is there a way to do this?
Title: Re: [XP] Easy Party Switcher
Post by: ForeverZer0 on May 02, 2011, 05:42:54 pm
You have to do that with your menu. It isn't really related to this script when you decide to call the scene.
Title: Re: [XP] Easy Party Switcher
Post by: Maar on June 18, 2011, 03:08:56 am
i get the error

Script 'Easy Party Switcher' line 361: NameError occurred.
undefined method 'draw_actor_graphic' for class 'Window_Base'

Can someone help me.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on June 18, 2011, 03:42:51 am
Are your scripts in the right order? http://forum.chaos-project.com/index.php/topic,23.0.html
Have you made sure that you have copy-pasted the whole script properly?
Make sure you don't load old save games, start new games. *points to Compatibility section in the instructions*
Title: Re: [XP] Easy Party Switcher
Post by: Maar on June 18, 2011, 04:01:33 am
Now it is working thanks for the help
Title: Re: [XP] Easy Party Switcher
Post by: G_G on June 18, 2011, 04:08:19 am
The error is odd though. Its calling a method that clearly exists in Window_Base. Old savegames and script order shouldn't matter there should it?
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on June 18, 2011, 07:15:05 am
It's possible that he assigned a non-existing actor graphic.
Title: Re: [XP] Easy Party Switcher
Post by: TNBProductions on June 30, 2011, 01:38:03 pm
i was wondering that since it says that the conditions can be waived if i get permission from the copyright holder. can i have your permission?
Title: Re: [XP] Easy Party Switcher
Post by: Blink akita on August 23, 2011, 09:18:02 pm
okay so im a total newb at this so dont have a go at me XD

When i use the party member option from the game menu it shows all my characters there, in my game you start off with one character and gradually get more than 4 which is why i wanted this script sorry if i missed somthing written down but is there a way to add members into reserve as you meet them and not them already being there?
Title: Re: [XP] Easy Party Switcher
Post by: G_G on August 23, 2011, 09:25:02 pm
Try this, just place it in a new script below Scene_Title.
class Scene_Title
  alias gg_new_game_party_lat command_new_game
  def command_new_game
    gg_new_game_party_lat
    for i in 1...$data_actors.size
      $game_actors[i].disabled_for_party = true
    end
  end
end


Then to enable them use this code. Should work.
$game_actors[ID].disabled_for_party = false
Title: Re: [XP] Easy Party Switcher
Post by: Blink akita on August 23, 2011, 09:31:21 pm
Quote from: game_guy on August 23, 2011, 09:25:02 pm
Try this, just place it in a new script below Scene_Title.
class Scene_Title
  alias gg_new_game_party_lat command_new_game
  def command_new_game
    gg_new_game_party_lat
    for i in 1...$data_actors.size
      $game_actors[i].disabled_for_party = true
    end
  end
end


Then to enable them use this code. Should work.
$game_actors[ID].disabled_for_party = false



any where do you put the next code? is it like, if your party is full they automaticly go to reserv
Title: Re: [XP] Easy Party Switcher
Post by: G_G on August 23, 2011, 09:38:33 pm
That last code you use in script call events. Its located on the 3rd page of the event commands. You use that line when you want to put the member back into the party switcher.
Title: Re: [XP] Easy Party Switcher
Post by: Blink akita on August 23, 2011, 09:44:37 pm
Quote from: game_guy on August 23, 2011, 09:38:33 pm
That last code you use in script call events. Its located on the 3rd page of the event commands. You use that line when you want to put the member back into the party switcher.


final quetions...

What do i ao about

"" name error occurred while running script

uninitialized constant interpreter ::ID ""
Title: Re: [XP] Easy Party Switcher
Post by: G_G on August 23, 2011, 10:18:52 pm
ID has to be the id of the actor you want to add. Open up the database and you see that little number next to the actors name. Thats the actor's id.
Title: Re: [XP] Easy Party Switcher
Post by: Blink akita on August 23, 2011, 10:21:01 pm
oh i get it now XD

thanks
Title: Re: [XP] Easy Party Switcher
Post by: Shy on September 28, 2011, 12:38:14 pm
I'm new to this kind of stuff (I've just learned how to make switches in games!) and I have a question... How do make this show up in the game? Do I press a button, or something else? If not pressing a button, what? Could I make an item that would allow me to switch?

Thank you!
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on September 28, 2011, 01:39:15 pm
It's explained in the instructions on top of the script.
Title: Re: [XP] Easy Party Switcher
Post by: wolfitsune on October 02, 2012, 03:23:54 am
I got an issue similar to an early one in the thread, but it wasn't addressed.

Script 'Easy Party Switcher' line 1047: NoMethodError ocurred
undefined method 'exp' for nil:NilClass

Anyone know what's wrong and/or how to fix?
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 02, 2012, 04:34:09 am
Quote from: Blizzard on January 09, 2008, 04:30:52 pm
Compatibility

98% compatible with SDK v1.x. 90% compatible with SDK 2.x. Can cause incompatibility issued with other Party Change Systems. WILL corrupt your old savegames.
Title: Re: [XP] Easy Party Switcher
Post by: wolfitsune on October 02, 2012, 03:32:10 pm
i made sure to start a new game. it comes up during the first attack of a battle.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 02, 2012, 04:47:59 pm
I'm not able to reproduce it. If you can make a demo of the problem, I can take a look at it.
Title: Re: [XP] Easy Party Switcher
Post by: wolfitsune on October 04, 2012, 12:22:14 am
Ok, i think i figured out where the error comes from. I have a battle results screen script, and i think that's what's causing the bug.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 04, 2012, 11:28:28 am
It was the custom battle result script. While it's actually a problem with other scripts and how they do stuff, I have added a fix for that in version 2.5.
Title: Re: [XP] Easy Party Switcher
Post by: wolfitsune on October 05, 2012, 04:27:46 pm
Thank you so much! It works!
Title: Re: [XP] Easy Party Switcher
Post by: Someone on October 20, 2012, 11:05:43 am
I'm having a bit of a problem here.
I installed the script, and it seemed to work. BUT the .disabled_for_party thing is not working for me. It says I've got a Syntax error.
Also, the "unavailable" function doesn't appear to be working either. It doesn't give an error, it just doesn't work.  :'(

I checked out the demo that you've provided, but the script is broken there as well. It opens the party interface, but all characters are available all the time. And according to Siegfried, they shouldn't be.
Title: Re: [XP] Easy Party Switcher
Post by: KK20 on October 20, 2012, 09:37:58 pm
Can I see the exact syntax that you are using?
Title: Re: [XP] Easy Party Switcher
Post by: Someone on October 21, 2012, 05:41:17 am
Quote from: Ezel Berbier on October 20, 2012, 09:37:58 pm
Can I see the exact syntax that you are using?

Sure, I took a screenshot:
(http://imageshack.us/a/img6/4043/59972661.png)
This gives me an error. Replacing the [006] with just [6] removes the error and makes it do absolutely nothing instead.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 21, 2012, 05:45:48 am
Try this.

$game_actors[6].disabled_for_party =
true


Never use leading zeros, BTW.
Title: Re: [XP] Easy Party Switcher
Post by: Someone on October 21, 2012, 06:51:52 am
EDIT: I tried that, but the code is just being ignored now.  :(
EDIT2: The not available command seems to work a little bit. The N/A characters can't be placed in your party, but they don't appear to be greyed out.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 21, 2012, 07:29:51 am
Could you make a demo? I'm not sure you set up the script properly.
Title: Re: [XP] Easy Party Switcher
Post by: Someone on October 21, 2012, 12:06:56 pm
The script is exactly the same as the script in the downloadable demo. I'm nor running any other scripts.
But as I mentioned before, the downloadable demo isn't working properly for me either.
Title: Re: [XP] Easy Party Switcher
Post by: KK20 on October 21, 2012, 12:43:44 pm
Try this out:
Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Easy Party Switcher by Blizzard
# Version 2.5b
# Type: Party Changing System
# Date: 21.05.2006
# Date v1.1: 25.05.2006
# Date v1.2b: 27.05.2006
# Date v1.5b: 3.11.2006
# Date v1.51b: 29.11.2006
# Date v1.52b: 6.12.2006
# Date v1.7b: 23.2.2007
# Date v1.8b: 30.4.2007
# Date v2.0b: 7.8.2007
# Date v2.1b: 24.8.2007
# Date v2.11b: 24.9.2007
# Date v2.3b: 26.1.2008
# Date v2.32b: 28.1.2008
# Date v2.4b: 29.1.2008
# Date v2.41b: 6.8.2008
# Date v2.42b: 14.10.2008
# Date v2.43b: 20.10.2008
# Date v2.5b: 4.10.2012
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#   
#  This work is protected by the following license:
# #----------------------------------------------------------------------------
# # 
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# # 
# #  You are free:
# # 
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# # 
# #  Under the following conditions:
# # 
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# # 
# #  Noncommercial. You may not use this work for commercial purposes.
# # 
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# # 
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# # 
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# # 
# #  - Nothing in this license impairs or restricts the author's moral rights.
# # 
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Special Thanks to:
#
#   Zeriab for pointing out a few glitches and shortening the code in an
#   earlier version. =D
#
#
# IMPORTANT NOTE:
#
#   Be sure to set the MAX_PARTY to the maximum size of your party. There is
#   already a preconfiguration of 4.
#
#
# Compatibility:
#
#   98% compatible with SDK v1.x. 90% compatible with SDK 2.x. Can cause
#   incompatibility issued with other Party Change Systems. Can cause problems
#   with CBS-es if you use the battle switch feature. WILL corrupt your old
#   savegames.
#
#
# Features:
#
#   - set party members for "not _available" (shown transparent in the reserve)
#   - remove party members from the reserve list ("disabled_for_party")
#   - set party members, who MUST be in the party (shown transparent in the
#     current party, "must_be_in_party")
#   - set up forced positions for party members
#   - set up forced party size
#   - option either to wipe the party (for multi-party use) or only remove
#     every member (except 1) from the party.
#   - easy to use and easy to switch party members
#   - also supports small parties (2 or 3 members) and large parties (5 or
#     more)
#   - uses facesets optionally
#
# v1.5b:
#   - better, shorter and more efficient code (less memory use, less CPU use)
#   - fixed potential bugs
#
# v1.7b:
#   - improved coding
#   - facesets now optional
#   - no extra bitmap files needed anymore
#   - works now with Tons of Add-ons
#
# v1.8b:
#   - added "forced position"
#   - added "forced party size"
#
# v2.0b:
#   - fixed the bug where you could empty the party... again...
#   - fixed the bug that appeared when you pressed SHIFT
#   - added option to allow an empty party
#   - added "EXP for party members in reserve" option
#   - made the forced_size for party work more convenient
#   - improved coding
#   - slightly decreased lag
#
# v2.1b:
#   - fixed a bug
#   - improved coding
#   - rewritten conditions using classic syntax to avoid RGSS conditioning bug
#   - now can serve as enhancement for CP Debug System
#
# v2.11b:
#   - improved coding and performance
#
# v2.3b:
#   - optional feature to call the Party Switcher during battle
#
# v2.32b:
#   - fixed crash problem with SDK 2.x when using the BATTLE_SWITCH option
#   - fixed SP display glitch when using BARS from Tons of Add-ons
#
# v2.4b:
#   - now you can activate party order change only in the party switcher
#   - add option for automatic party order change only in battle
#
# v2.41b:
#   - fixed problem where you could put together a party where everybody is
#     dead
#
# v2.42b:
#   - added possibility to change the BATTLE_SWITCH setting during the game
#
# v2.43b:
#   - fixed a problem with SDK 2.x
#
# v2.5b:
#   - fixed a problem caused by other scripts that remove the result window
#
#
# How to use:
#
#   To call this script, make a "Call script" command in an event.
#
#   1. Syntax: $scene = Scene_PartySwitcher.new
#      No extra feature will be applied and you can switch the party as you
#      wish.
#
#   2. Syntax: $scene = Scene_PartySwitcher.new(XXX)
#      You can replace XXX for 1 to remove all party members except one (either
#      one, who must be in the party or a random one), or replace XXX with 2,
#      to cause a wipe party. Wiping a party will disable the of the current
#      members and a NEW party of the remaining members must be formed. If you
#      replace it with 3, the current party configuration will be stored for a
#      later fast switch-back. If XXX is 10, all actors will be available for
#      party switching no matter if the are "not_available" or
#      "disabled_for_party". This feature if used by the CP Debug System. No
#      faceset will be used in this case for a more convenient working.
#
#   3. Syntax: $scene = Scene_PartySwitcher.new(XXX, 1)
#      You can use the XXX as described above or just set it to 0 to disable
#      it. Also the "1" in the syntax will reset any disabled_for_party and is
#      made to be used after multi-party use.
#
#   4. Syntax: $scene = Scene_PartySwitcher.new(XXX, YYY, ZZZ)
#      You can replace ZZZ with 1 to replace the party with a stored one AND
#      store the current or replace it with 2 to replace the party with a
#      stored one, but without storing the current. USE THIS ONLY IF YOU ASSUME
#      TO HAVE A STORED PARTY READY! You can simply test if there is a store
#      party by putting this code into the conditional branch script:
#
#      $game_system.stored_party != nil
#
#      This syntax will not open the Party Switcher and it will override the
#      commands XXX and YYY, so you can replace these with any number.
#   
#   5. To activate/deactivate the option of order change only, simply use the
#      event command "Call Script" with following syntax:
#     
#      $game_system.order_only = true/false
#     
#      If the setting is set to true, the switcher will allow only party order
#      change. The same goes for battle change (if you are using the
#      BATTLE_SWITCH option), but the syntax is different:
#     
#      $game_system.battle_order_only = true/false
#     
#      The BATTLE_SWITCH option can be changed during the game by using
#      following syntax:
#     
#      $game_system.battle_switch = true/false
#     
#      This option is intially set to the same setting as BATTLE_SWITCH is.
#     
#   Character faces go into the "Characters" folder and they have the same name
#   as the character spritesets have with _face added
#
#   Example:
#
#     sprite - Marlen.png
#     face   - Marlen_face.png
#
#   Other syntaxes:
#     $game_actors[ID].not_available = true/false
#     $game_actors[ID].disabled_for_party = true/false
#     $game_actors[ID].must_be_in_party = true/false
#     $game_actors[ID].forced_position = nil/0/1/2/...
#   OR
#     $game_party.actors[POS].not_available = true/false
#     $game_party.actors[POS].disabled_for_party = true/false
#     $game_party.actors[POS].must_be_in_party = true/false
#     $game_party.actors[POS].forced_position = nil/0/1/2/...
#
#   ID  - the actor's ID in the database
#   POS - the actor's position in the party (STARTS FROM 0, not 1!)
#
#   not_available
#   - will disable the possibility of an already unlocked character to be in
#     the current party
#
#   disabled_for_party
#   - will cause the character NOT to appear in the party switch screen at all
#
#   must_be_in_party
#   - will cause the character to be automatically moved into the current party
#     and he also cannot be put in the reserve
#
#   forced_position
#   - will enforce the player to be at a specific position in the party, set
#     this value to nil to disable this feature, use it in combination with
#     must_be_in_party and $game_party.forced_size or you might experience
#     bugs,
#
#   $game_party.forced_size = nil/0/1/2/...
#
#   Using this syntax will enforce a specific party size. The EPS won't exit
#   until this size is filled up or there are no more in the reserve. EPS will
#   automatically "correct" this number if there are not enough characters in
#   the reserve to fill up a party of forced_size. Set this value to nil to
#   disable the size requirement. Note that the actor DO NOT HAVE TO be set in
#   normal order without any empty position like in version 1.x.
#
#
# Additional note:
#
#   For your own sake, do not apply the attribute "must_be_in_party" to a
#   character at the same time with "not_available" or "disabled_for_party" as
#   this WILL disrupt your party and party switch system. Use "forced_position"
#   together with "must_be_in_party" to avoid bugs. Be careful when using
#   "forced_position" with "$game_party.forced_size". Add actors at the very
#   end to be sure the player can't put others after them if the "forced_size"
#   is smaller than the maximum party size.
#
#
# If you find any bugs, please report them here:
# http://www.chaosproject.co.nr
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#==============================================================================
# module BlizzCFG
#==============================================================================

module BlizzCFG

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Conficuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  # how many party members do you use
  MAX_PARTY = 4
  # set to true to use facesets instead of spritesets
  FACESETS = false
  # allows a party with 0 members
  ALLOW_EMPTY_PARTY = false
  # allows switching the party in battle
  BATTLE_SWITCH = false
  # name of the call command in the party menu in battle
  SWITCH_COMMAND = 'Switch'
  # gives all other characters EXP (specify in %)
  EXP_RESERVE = 50
  # gives "not available" characters EXP (specify in %)
  EXP_NOT_AVAILABLE = 0
  # gives "disabled for party" characters EXP (specify in %)
  EXP_DISABLED_FOR_PARTY = 0
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Conficuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

end

# recognition variable for plug-ins
$easy_party_switcher = 2.5

#==============================================================================
# Game_Actor
#==============================================================================

class Game_Actor < Game_Battler

  attr_accessor :must_be_in_party
  attr_accessor :disabled_for_party
  attr_accessor :not_available
  attr_accessor :forced_position
 
  alias setup_eps_later setup
  def setup(actor_id)
    setup_eps_later(actor_id)
    @must_be_in_party = @disabled_for_party = @not_available = false
  end
 
end

#==============================================================================
# Game_System
#==============================================================================

class Game_System

  attr_accessor :stored_party
  attr_accessor :order_only
  attr_accessor :battle_order_only
  attr_accessor :battle_switch
 
  alias init_eps_later initialize
  def initialize
    init_eps_later
    @order_only = @battle_order_only = false
    @battle_switch = BlizzCFG::BATTLE_SWITCH
  end
 
end

#==============================================================================
# Game_Party
#==============================================================================

class Game_Party

  attr_accessor :actors
  attr_accessor :forced_size
 
  def any_forced_position
    return (@actors.any? {|actor| actor != nil && actor.forced_position != nil})
  end
 
end

#==============================================================================
# Window_Base
#==============================================================================

class Window_Base

  alias draw_actor_graphic_eps_later draw_actor_graphic
  def draw_actor_graphic(actor, x, y)
    if actor != nil && actor.character_name != ''
      classes = [Window_Current, Window_Reserve, Window_HelpStatus]
      if BlizzCFG::FACESETS && !$all_available && classes.include?(self.class)
        draw_actor_face_eps(actor, x, y)
      else
        if classes.include?(self.class)
          bitmap = RPG::Cache.character(actor.character_name,
              actor.character_hue)
          x += bitmap.width / 8 + 24
          y += bitmap.height / 4 + 16
        end
        draw_actor_graphic_eps_later(actor, x, y)
      end
    end
  end

  def draw_actor_face_eps(actor, x, y)
    if $tons_version == nil || $tons_version < 3.71 || !FACE_HUE
      hue = 0
    else
      hue = actor.character_hue
    end
    bitmap = RPG::Cache.character("#{actor.character_name}_face", hue)
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    if actor.not_available || actor.must_be_in_party
      self.contents.blt(x, y, bitmap, src_rect, 128)
    else
      self.contents.blt(x, y, bitmap, src_rect)
    end
  end
 
end

#==============================================================================
# Window_BattleResult
#==============================================================================

class Window_BattleResult
 
  attr_reader :exp
 
end

#==============================================================================
# Window_Current
#==============================================================================

class Window_Current < Window_Selectable

  def initialize
    super(0, 0, 240 + 32,
        BlizzCFG::MAX_PARTY > 4 ? 480 : BlizzCFG::MAX_PARTY * 120)
    self.contents = Bitmap.new(width - 32,
        448 + (BlizzCFG::MAX_PARTY - 4) * 120)
    @item_max = BlizzCFG::MAX_PARTY
    if $fontface != nil
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
    end
    self.contents.font.size = 24
    refresh
    self.active, self.index, self.z = false, -1, 5000
  end
 
  def refresh
    self.contents.clear
    $game_party.actors.each_index {|i|
        if $game_party.actors[i] != nil
          draw_actor_graphic($game_party.actors[i], 4, i * 120 + 4)
          draw_actor_name($game_party.actors[i], 152, i * 120 - 4)
          draw_actor_level($game_party.actors[i], 88, i * 120 - 4)
          draw_actor_hp($game_party.actors[i], 88, i * 120 + 24)
          draw_actor_sp($game_party.actors[i], 88, i * 120 + 52)
        end}
  end

  def setactor(index_1, index_2)
    $game_party.actors[index_2], $game_party.actors[index_1] =
        $game_party.actors[index_1], $game_party.actors[index_2]
    refresh
  end

  def getactor(index)
    return $game_party.actors[index]
  end
 
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
      return
    end
    row = @index / @column_max
    self.top_row = row if row < self.top_row
    if row > top_row + (page_row_max - 1)
      self.top_row = row - (page_row_max - 1)
    end
    y = (@index / @column_max) * 120 - self.oy
    self.cursor_rect.set(0, y, self.width - 32, 88)
  end

  def clone_cursor
    row = @index / @column_max
    self.top_row = row if row < self.top_row
    if row > top_row + (page_row_max - 1)
      self.top_row = row - (page_row_max - 1)
    end
    y = (@index / @column_max) * 120
    src_rect = Rect.new(0, 0, self.width, 88)
    bitmap = Bitmap.new(self.width-32, 88)
    bitmap.fill_rect(0, 0, self.width-32, 88, Color.new(255, 255, 255, 192))
    bitmap.fill_rect(2, 2, self.width-36, 84, Color.new(255, 255, 255, 80))
    self.contents.blt(0, y, bitmap, src_rect, 192)
  end
 
  def top_row
    return self.oy / 116
  end

  def top_row=(row)
    self.oy = (row % row_max) * 120
  end

  def page_row_max
    return (self.height / 120)
  end

end

#==============================================================================
# Window_Reserve
#==============================================================================

class Window_Reserve < Window_Selectable
 
  attr_reader :actors
 
  def initialize(scene)
    super(0, 0, 368, 320)
    setup
    @column_max, rows = 3, @item_max / @column_max
    self.contents = Bitmap.new(width - 32, rows >= 3 ? rows * 96 : height - 32)
    if $fontface != nil
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
    end
    self.contents.font.size = 24
    self.active, self.index, self.z = false, -1, 5000
    refresh
    if scene == Scene_Map && $game_system.order_only ||
        scene == Scene_Battle && $game_system.battle_order_only
      self.opacity = 128
    end
  end
 
  def setup
    @actors = []
    (1...$data_actors.size).each {|i| #kk20
        if !$game_party.actors.include?($game_actors[i]) && !$game_actors[i].disabled_for_party && !$all_available
          @actors.push($game_actors[i])
        end}
    @item_max = (@actors.size + $game_party.actors.size + 3) / 3 * 3
  end
 
  def refresh
    self.contents.clear
    @actors.each_index {|i|
        draw_actor_graphic(@actors[i], i % 3 * 112 + 16, i / 3 * 96 + 8)}
  end
 
  def getactor(index)
    return @actors[index]
  end
 
  def get_number
    return (@actors.find_all {|actor| actor != nil}).size if $all_available
    return (@actors.find_all {|actor| actor != nil &&
        !actor.not_available}).size
  end
 
  def setactor(index_1, index_2)
    @actors[index_1], @actors[index_2] = @actors[index_2], @actors[index_1]
    refresh
  end

  def setparty(index_1, index_2)
    @actors[index_1], $game_party.actors[index_2] =
        $game_party.actors[index_2], @actors[index_1]
    refresh
  end

  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
      return
    end
    row = @index / @column_max
    self.top_row = row if row < self.top_row
    self.top_row = row - (page_row_max-1) if row > top_row + (page_row_max-1)
    x = (@index % @column_max) * 112 + 8
    y = (@index / @column_max) * 96 - self.oy
    self.cursor_rect.set(x, y, 96, 96)
  end

  def clone_cursor
    row = @index / @column_max
    self.top_row = row if row < self.top_row
    if row > top_row + (page_row_max - 1)
      self.top_row = row - (page_row_max - 1)
    end
    x, y = (@index % @column_max) * 112 + 8, (@index / @column_max) * 96
    src_rect = Rect.new(0, 0, 96, 96)
    bitmap = Bitmap.new(96, 96)
    bitmap.fill_rect(0, 0, 96, 96, Color.new(255, 255, 255, 192))
    bitmap.fill_rect(2, 2, 92, 92, Color.new(255, 255, 255, 80))
    self.contents.blt(x, y, bitmap, src_rect, 192)
  end
 
  def top_row
    return self.oy / 96
  end

  def top_row=(row)
    row = row % row_max
    self.oy = row * 96
  end

  def page_row_max
    return (self.height - 32) / 96
  end

end

#==============================================================================
# Window_HelpStatus
#==============================================================================

class Window_HelpStatus < Window_Base

  def initialize(gotactor, scene)
    super(0, 0, 400 - 32, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    if $fontface != nil
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
    end
    self.contents.font.size = 24
    refresh(gotactor)
    self.active, self.z = false, 5000
    if scene == Scene_Map && $game_system.order_only ||
        scene == Scene_Battle && $game_system.battle_order_only
      self.opacity = 128
    end
  end
 
  def refresh(actor)
    self.contents.clear
    if actor != nil
      self.contents.font.color = normal_color
      if actor.not_available && !$all_available
        self.contents.draw_text(8, 0, 160, 32, 'not available', 0)
      end
      draw_actor_graphic(actor, 0, 40)
      draw_actor_name(actor, 160, 32)
      draw_actor_level(actor, 96, 32)
      draw_actor_hp(actor, 96, 64)
      draw_actor_sp(actor, 96, 96)
    end
  end

end

#==============================================================================
# Window_Warning
#==============================================================================

class Window_Warning < Window_Base

  def initialize(mode, members)
    super(0, 0, 320, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    if $fontface != nil
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
    end
    self.contents.font.size = 24
    self.x, self.y, self.z = 320 - width/2, 240 - height/2, 9999
    self.contents.font.color = normal_color
    case mode
    when 0
      self.contents.draw_text(0, 0, 288, 32, 'You need a party', 1)
      num = [$game_party.forced_size, members + $game_party.actors.nitems].min
      self.contents.draw_text(0, 32, 288, 32, "of #{num} members!", 1)
    when 1
      self.contents.draw_text(0, 0, 288, 32, 'You cannot remove', 1)
      self.contents.draw_text(0, 32, 288, 32, 'the last party member!', 1)
    when 2
      self.contents.draw_text(0, 0, 288, 32, 'At least one member', 1)
      self.contents.draw_text(0, 32, 288, 32, 'has to be alive!', 1)
    end
  end

end

#==============================================================================
# Window_PartyCommand
#==============================================================================

class Window_PartyCommand
 
  alias init_eps_later initialize
  def initialize
    if $game_system.battle_switch
      if defined?(SDK) && self.is_a?(Window_HorizCommand)
        s1 = SDK::Scene_Commands::Scene_Battle::Fight
        s2 = SDK::Scene_Commands::Scene_Battle::Escape
        s3 = BlizzCFG::SWITCH_COMMAND
        super(640, [s1, s2, s3])
        disable_item(1) if !$game_temp.battle_can_escape
      else
        super(0, 0, 640, 64)
        self.contents = Bitmap.new(width - 32, height - 32)
        @commands = ['Fight', 'Escape', BlizzCFG::SWITCH_COMMAND]
        @item_max = @column_max = 3
        draw_item(0, normal_color)
        draw_item(1, $game_temp.battle_can_escape ?
            normal_color : disabled_color)
        draw_item(2, normal_color)
      end
      self.active, self.visible, self.index = false, false, 0
      self.back_opacity = 160
    else
      init_eps_later
    end
  end
 
  alias draw_item_eps_later draw_item
  def draw_item(index, color)
    if $game_system.battle_switch
      self.contents.font.color = color
      rect = Rect.new(80 + index * 160 + 4, 0, 128 - 10, 32)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      self.contents.draw_text(rect, @commands[index], 1)
    else
      draw_item_eps_later(index, color)
    end
  end
 
  alias update_cursor_rect_eps_later update_cursor_rect
  def update_cursor_rect
    if $game_system.battle_switch
      self.cursor_rect.set(80 + index * 160, 0, 128, 32)
    else
      update_cursor_rect_eps_later
    end
  end
 
  def command(index = self.index)
    return @commands[index]
  end
 
end

#==============================================================================
# Scene_PartySwitcher
#==============================================================================

class Scene_PartySwitcher
 
  def initialize(wipe_party = 0, reset = 0, store = 0)
    @wipe_party, @store, @reset = wipe_party, store, reset #KK20
    @current_window_temp = @reserve_window_temp = 0
    @scene_flag, @temp_window = false, ''
    @scene = $scene.class
  end
 
  def main
    if @store != 0
      swap_parties
      $scene = Scene_Map.new
      $game_player.refresh
      return
    end
    case @wipe_party
    when 1 then setup_forced_party
    when 2 then wipe_party
    when 3
      $game_system.stored_party = $game_party.actors
      wipe_party
    when 10 then $all_available = true
    end
    if @reset == 1
      (1...$data_actors.size).each {|i| $game_actors[i].not_available = false}
    end
    @current_window = Window_Current.new
    @current_window.index, @current_window.active = 0, true
    @reserve_window = Window_Reserve.new(@scene)
    @reserve_window.x, @reserve_window.y = 272, 160
    @help_window = Window_HelpStatus.new(@reserve_window.getactor(0), @scene)
    @help_window.x = 240 + 32
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    Graphics.freeze
    [@current_window, @reserve_window, @help_window].each {|win| win.dispose}
    $game_party.actors.compact!
    $game_player.refresh
    $all_available = nil
  end
 
  def update
    check = @reserve_window.index
    if @reserve_window.active
      reserve_update
      @reserve_window.update
    end
    if check != @reserve_window.index
      if @reserve_window.active
        actor = @reserve_window.getactor(@reserve_window.index)
      elsif @current_window.active
        actor = @reserve_window.getactor(@reserve_window_temp)
      end
      @help_window.refresh(actor) if ['', 'Current'].include?(@temp_window)
    end
    current_update if @current_window.active
    if Input.trigger?(Input::B)
      if @scene_flag
        $game_system.se_play($data_system.cancel_se)
        @scene_flag, @temp_window = false, ''
        if @reserve_window.active
          actor = @reserve_window.getactor(@reserve_window.index)
        elsif @current_window.active
          actor = @reserve_window.getactor(@reserve_window_temp)
        end
        @help_window.refresh(actor) if ['', 'Current'].include?(@temp_window)
        [@current_window, @reserve_window].each {|win| win.refresh}
        return
      end
      if $game_party.forced_size != nil &&
          ($game_party.forced_size < $game_party.actors.nitems ||
          ($game_party.forced_size > $game_party.actors.nitems &&
          @reserve_window.get_number != 0))
        $game_system.se_play($data_system.buzzer_se)
        warning(1)
        return
      end
      if $game_party.actors.all? {|actor| actor == nil ||
            actor != nil && actor.dead?}
        $game_system.se_play($data_system.buzzer_se)
        warning(2)
        return
      end
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::A)
      if $game_party.any_forced_position
        $game_system.se_play($data_system.buzzer_se)
      else
        $game_system.se_play($data_system.decision_se)
        $game_party.actors.compact!
        @current_window.refresh
      end
    end
  end
   
  def current_update
    @current_window.update
    if Input.trigger?(Input::C)
      actor = @current_window.getactor(@current_window.index)
      if actor != nil && actor.forced_position != nil
        $game_system.se_play($data_system.buzzer_se)
      else
        if @scene_flag
          switch_members
        else
          $game_system.se_play($data_system.decision_se)
          @scene_flag, @temp_window = true, 'Current'
          @temp_actor_index = @current_window.index
          @current_window.clone_cursor
        end
      end
    elsif Input.trigger?(Input::RIGHT)
      if @scene == Scene_Map && $game_system.order_only ||
          @scene == Scene_Battle && $game_system.battle_order_only
        $game_system.se_play($data_system.buzzer_se)
      else
        $game_system.se_play($data_system.cursor_se)
        @current_window.active = false
        @reserve_window.active = true
        @current_window_temp = @current_window.index
        actor = @reserve_window.getactor(@reserve_window_temp)
        @current_window.index = -1
        @reserve_window.index = @reserve_window_temp
        @help_window.refresh(actor) if !@scene_flag
      end
    end
  end
 
  def reserve_update
    if Input.trigger?(Input::C)
      if @scene_flag
        switch_members
      else
        $game_system.se_play($data_system.decision_se)
        @scene_flag, @temp_window = true, 'Reserve'
        @temp_actor_index = @reserve_window.index
        @reserve_window.clone_cursor
      end
    elsif @reserve_window.index % 3 == 0 && Input.repeat?(Input::LEFT)
      $game_system.se_play($data_system.cursor_se)
      @reserve_window.active = false
      @current_window.active = true
      @reserve_window_temp = @reserve_window.index
      @reserve_window.index = -1
      @current_window.index = @current_window_temp
    end
  end
 
  def switch_members
    if @temp_window == 'Reserve' && @reserve_window.active
      @reserve_window.setactor(@temp_actor_index, @reserve_window.index)
      actor = @reserve_window.getactor(@reserve_window.index)
      @help_window.refresh(actor)
    end
    if @temp_window == 'Current' && @current_window.active
      @current_window.setactor(@temp_actor_index, @current_window.index)
    end
    if @temp_window == 'Reserve' && @current_window.active
      actor1 = @current_window.getactor(@current_window.index)
      actor2 = @reserve_window.getactor(@temp_actor_index)
      if call_warning?(@current_window.index, actor2)
        if actor1 != nil && actor1.must_be_in_party
          $game_system.se_play($data_system.buzzer_se)
          @scene_flag, @temp_window = false, ''
          actor = @reserve_window.getactor(@reserve_window_temp)
          [@current_window, @reserve_window].each {|win| win.refresh}
          @help_window.refresh(actor)
          return
        end
        if actor2 != nil && actor2.not_available && !$all_available
          $game_system.se_play($data_system.buzzer_se)
          @scene_flag, @temp_window = false, ''
          actor = @reserve_window.getactor(@reserve_window_temp)
          [@current_window, @reserve_window].each {|win| win.refresh}
          @help_window.refresh(actor)
          return
        end
        @reserve_window.setparty(@temp_actor_index, @current_window.index)
        @current_window.refresh
        actor = @reserve_window.getactor(@reserve_window_temp)
        @help_window.refresh(actor)
      else
        warning(0)
      end
    end
    if @temp_window == 'Current' && @reserve_window.active
      actor1 = @current_window.getactor(@temp_actor_index)
      actor2 = @reserve_window.getactor(@reserve_window.index)
      if call_warning?(@temp_actor_index, actor2)
        if actor1 != nil && actor1.must_be_in_party
          $game_system.se_play($data_system.buzzer_se)
          @scene_flag, @temp_window = false, ''
          actor = @reserve_window.getactor(@reserve_window.index)
          [@current_window, @reserve_window].each {|win| win.refresh}
          @help_window.refresh(actor)
          return
        end
        if actor2 != nil && actor2.not_available && !$all_available
          $game_system.se_play($data_system.buzzer_se)
          @scene_flag, @temp_window = false, ''
          actor = @reserve_window.getactor(@reserve_window.index)
          [@current_window, @reserve_window].each {|win| win.refresh}
          @help_window.refresh(actor)
          return
        end
        @reserve_window.setparty(@reserve_window.index, @temp_actor_index)
        @current_window.refresh
        actor = @reserve_window.getactor(@reserve_window.index)
        @help_window.refresh(actor)
      else
        warning(0)
      end
    end
    $game_system.se_play($data_system.decision_se)
    @scene_flag, @temp_window = false, ''
  end
   
  def wipe_party
    $game_party.actors.each {|actor| actor.not_available = true if actor != nil}
    setup_forced_party(true)
    if $game_party.actors == []
      (1...$data_actors.size).each {|i|
          if !$game_actors[i].not_available ||
              $game_actors[i].disabled_for_party
            $game_party.actors.push($game_actors[i])
            return
          end}
    end
  end
 
  def setup_forced_party(flag = false)
    $game_party.actors, party = [], []
    (1...$data_actors.size).each {|i|
        if $game_actors[i] != nil && $game_actors[i].must_be_in_party &&
             (!$game_actors[i].disabled_for_party || flag) &&
             !$game_actors[i].not_available
          party.push($game_actors[i])
        end}
    party.clone.each {|actor|
        if actor.forced_position != nil
          $game_party.actors[actor.forced_position] = actor
          party.delete(actor)
        end}
    $game_party.actors.each_index {|i|
        $game_party.actors[i] = party.shift if $game_party.actors[i] == nil}
    $game_party.actors += party.compact
  end 
 
  def swap_parties
    $game_party.actors.compact!
    temp_actors = $game_party.actors
    temp_actors.each {|actor| actor.not_available = true}
    $game_system.stored_party.compact!
    $game_system.stored_party.each {|actor| actor.not_available = false}
    $game_party.actors = $game_system.stored_party
    $game_system.stored_party = (@store == 1 ? temp_actors : nil)
  end
 
  def call_warning?(index, actor2)
    return (BlizzCFG::ALLOW_EMPTY_PARTY || $game_party.actors[index] == nil ||
        actor2 != nil || $game_party.actors.nitems > 1)
  end
 
  def warning(type)
    $game_system.se_play($data_system.buzzer_se)
    @warning_window = Window_Warning.new(type, @reserve_window.get_number)
    loop do
      Graphics.update
      Input.update
      if Input.trigger?(Input::C)
        $game_system.se_play($data_system.decision_se) if type > 0
        [@current_window, @reserve_window].each {|win| win.refresh}
        @warning_window.dispose
        @warning_window = nil
        break
      end
    end
  end
 
end

#==============================================================================
# Scene_Battle
#==============================================================================
 
class Scene_Battle
 
  alias update_phase2_eps_later update_phase2
  def update_phase2
    update_phase2_eps_later
    if Input.trigger?(Input::C) && @party_command_window.index == 2
      $game_system.se_play($data_system.decision_se)
      @spriteset.dispose
      $scene = Scene_PartySwitcher.new
      $scene.main
      $scene = self
      @spriteset = Spriteset_Battle.new
      15.times {@spriteset.update}
      @status_window.refresh
      Graphics.transition(0)
    end
  end
 
  alias start_phase5_eps_later start_phase5
  def start_phase5
    exp = 0
    oldexp = 0
    if $game_party.actors.size > 0
      oldexp = $game_party.actors[0].exp
      start_phase5_eps_later
      exp = $game_party.actors[0].exp - oldexp if $game_party.actors.size > 0
    else
      start_phase5_eps_later
    end
    exp = @result_window.exp if exp == 0 && @result_window != nil
    exp = @exp if exp == 0 && @exp != nil
    if exp > 0
      (1...$data_actors.size).each {|i|
          if !$game_party.actors.include?($game_actors[i])
            if $game_actors[i].not_available
              addexp = exp * BlizzCFG::EXP_NOT_AVAILABLE / 100
            elsif $game_actors[i].disabled_for_party
              addexp = exp * BlizzCFG::EXP_DISABLED_FOR_PARTY / 100
            else
              addexp = exp * BlizzCFG::EXP_RESERVE / 100
            end
            $game_actors[i].exp += addexp
          end}
    end
  end
 
end


@Blizz: I noticed two things in the script. The changes I made are marked with '#KK20' in the code above. They were:
  def setup
    @actors = []
    (1...$data_actors.size).each {|i|
        if !$game_party.actors.include?($game_actors[i]) ||
            $game_actors[i].disabled_for_party && !$all_available
          @actors.push($game_actors[i])
        end}
    @item_max = (@actors.size + $game_party.actors.size + 3) / 3 * 3
  end
and
  def initialize(wipe_party = 0, reset = 0, store = 0)
    @wipe_party, @store, @reset = store, reset, wipe_party
    @current_window_temp = @reserve_window_temp = 0
    @scene_flag, @temp_window = false, ''
    @scene = $scene.class
  end
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 21, 2012, 02:25:40 pm
I wonder how it's possible that nobody reported this earlier. O_o
If Someone can confirm that this works, I'll add it to the script.
Title: Re: [XP] Easy Party Switcher
Post by: Someone on October 22, 2012, 08:27:42 am
Quote from: Ezel Berbier on October 21, 2012, 12:43:44 pm
Try this out:
Spoiler: ShowHide
*snip*


It's working now!  :D
Thanks guys.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on October 22, 2012, 11:28:26 am
I have updated the script.
Title: Re: [XP] Easy Party Switcher
Post by: Elevenius on December 30, 2012, 05:11:42 pm
I apologize if this has already been asked, but I read through the topic and didn't see this specific question. But I wondered if there was an easy way to change leaders, only for cutscenes. I wanted a certain character to be the leader, so that they're the ones moving and speaking correctly, but I realized that the player could change to another character. These mini-cutscenes are random small events scattered around the map, so forcing a party screen rearrange just for them seems slightly over the top.

Although, if there was a way to make the player turn invisible during the cutscene, that would also be perfect, but I've searched and can't seem to find a way to do that.
Title: Re: [XP] Easy Party Switcher
Post by: Metaron on January 03, 2013, 04:52:58 pm
Elevenius the best method I've found for turning an actor invisible is to create an entirely new actor with no character graphic that you add to the party for cutscenes and then remove after, while having him permanently disabled in the party switcher.

I've encountered an odd error of my own, I've turn a character to non available, however when trying to turn him available again using this code "$game_actors[2].not_available = false" the game simply freezes and refuses to do anything else.
Title: Re: [XP] Easy Party Switcher
Post by: KK20 on January 03, 2013, 05:12:53 pm
http://forum.chaos-project.com/index.php/topic,938.0.html
Title: Re: [XP] Easy Party Switcher
Post by: Metaron on January 03, 2013, 05:56:34 pm
Brilliant, this works perfectly  :haha: I spent so much time thinking I had made an error somewhere in the game. *Levels up*
Title: Re: [XP] Easy Party Switcher
Post by: Elevenius on January 03, 2013, 08:21:40 pm
Quote from: Metaron on January 03, 2013, 04:52:58 pm
Elevenius the best method I've found for turning an actor invisible is to create an entirely new actor with no character graphic that you add to the party for cutscenes and then remove after, while having him permanently disabled in the party switcher.


I appreciate your help.  I wonder though, is there a special command to switch this invisible party member for the leader? If it was, say, my seventh party member?
Title: Re: [XP] Easy Party Switcher
Post by: Zachfive on March 10, 2013, 07:30:25 pm
Is there a way to completely disable the party reserve window and the status window. Rather than just disabling their use, it would be nice to have them completely gone or just one solid color with no icons.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on March 11, 2013, 02:25:15 am
Technically you could disable them and then draw a sprite with a black bitmap over them so they aren't visible. But if a "party re-arranger" is all you need, there are other scripts out there that were intended for this and will probably work the same while providing a more consistent interface.
Title: Re: [XP] Easy Party Switcher
Post by: Skitzen on March 28, 2013, 08:41:42 pm
I love this script!

Just one question though.. I want to be able to have 9+ party members, but make the max /in/ battle only 4. As having more than 4 in battle makes the battle bug.
Even with no extra script for the battle, it will still bug out.

Is there anyway to do this? I found in the one KGC script they had a Max_Battle member = 4 but that script did not work for what I needed and killed my menu script.
I'm usually good at adjusting scripts, but I didn't want to just edit yours without asking and I'm not sure how to go about it.

Thanks so much if you can help! :^_^':
Title: Re: [XP] Easy Party Switcher
Post by: KK20 on March 28, 2013, 09:26:29 pm
Did you change the constant MAX_PARTY to something higher than 4?
Title: Re: [XP] Easy Party Switcher
Post by: Skitzen on March 28, 2013, 09:30:54 pm
QuoteDid you change the constant MAX_PARTY to something higher than 4?


Yes I did.. But if I do that it makes the BATTLE bug. I need something that makes the max 4 when you are /IN/ battle..
Title: Re: [XP] Easy Party Switcher
Post by: KK20 on March 28, 2013, 09:33:40 pm
The point is to leave it at 4.
Title: Re: [XP] Easy Party Switcher
Post by: Skitzen on March 28, 2013, 09:41:11 pm
QuoteThe point is to leave it at 4.


....... Then there is no use for a party changing script....
(Like I said in my first post) I want to be able to have 9+ party members (Which I know how to do!)
The /Problem/ I said I was having is that in battle if I have 9 members or more the battle works weird and characters +4 will not show up on the screen.
Making the MAX party 4 would be stupid because the point of using a large party script is to have more than that...
In my first post I stated that I found another script which makes it limit the battle party to 4. While still having a party of 9.
But that script doesn't work outside of battle for party switching like this one.
Title: Re: [XP] Easy Party Switcher
Post by: KK20 on March 28, 2013, 09:44:30 pm
...

Did you look at the demo and tried it fully? Did you notice that you can have 8 party members in reserve when changing members around? Did you then, after playing the demo, look at the script itself within the demo and notice MAX_PARTY equals 4?

All confusion aside, MAX_PARTY should really be MAX_PARTY_SIZE. It doesn't mean HOW_MANY_PARTY_MEMBERS_DOES_YOUR_GAME_HAVE.
Title: Re: [XP] Easy Party Switcher
Post by: Skitzen on March 28, 2013, 09:49:17 pm
Quote...

Did you look at the demo and tried it fully? Did you notice that you can have 8 party members in reserve when changing members around? Did you then, after playing the demo, look at the script itself within the demo and notice MAX_PARTY equals 4?

All confusion aside, MAX_PARTY should really be MAX_PARTY_SIZE. It doesn't mean HOW_MANY_PARTY_MEMBERS_DOES_YOUR_GAME_HAVE.

I'm not retarded or a noob I know what this is^ :facepalm: I do a lot of scripting for my game.

.... I would rather Blizzard answer my question as you clearly do not know what I am meaning.
I know how to change the damn max!!!! I have it at 9. I WANT the max to be at 9. This is how the story goes adding the characters. I want the player only to be able to have 9 at a time.
I have more party members later in my game.
And no matter HOW MANY I can have the BATTLE still bugs!
The issue is about the BATTLE not the general party. The battle bugs and makes everyone displayed.

I want there to be 9 people in the party. AND at the /same/ time I want only 4 displayed /in/ battle

Please if you don't understand what I am asking, just stop.
Title: Re: [XP] Easy Party Switcher
Post by: KK20 on March 28, 2013, 10:30:30 pm
I apologize for misunderstanding you then. It wasn't until that last post that I finally get what you mean.

After looking into it more, the edits you require are mostly (at least 95%) outside of this script. And there are a number of changes that need to be made as well (e.g. selecting actor targets, treatment of EXP, items and skill targets, definition of loss, etc.).

I'm curious how this system of having 9 party members with you at once but only having 4 fight at a time works in theory.
Title: Re: [XP] Easy Party Switcher
Post by: Skitzen on March 28, 2013, 10:38:05 pm
Quote from: KK20 on March 28, 2013, 10:30:30 pm
I apologize for misunderstanding you then. It wasn't until that last post that I finally get what you mean.

After looking into it more, the edits you require are mostly (at least 95%) outside of this script. And there are a number of changes that need to be made as well (e.g. selecting actor targets, treatment of EXP, items and skill targets, definition of loss, etc.).

I'm curious how this system of having 9 party members with you at once but only having 4 fight at a time works in theory.


Sorry If I hadn't explained it enough.
Yeah I figured it would be a lot of work. I was thinking of possibly taking the japanese script I had that does limit the battle size and trying to add/combine parts with the Blizzard script.

I just wanted to know if Blizzard would know of a way to do it.
Title: Re: [XP] Easy Party Switcher
Post by: Skitzen on May 18, 2013, 06:11:22 pm
I keep getting a "NoMethod Error" everytime I have a disabled actor for party. I don't want them shown at all in the switcher menu.

It says: "undefined Method 'diabled_for_party=' for NilClass"

Any help?
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on May 18, 2013, 06:28:01 pm
What is the exact script call that you are using?
Title: Re: [XP] Easy Party Switcher
Post by: LiTTleDRAgo on May 18, 2013, 11:28:41 pm
Quote from: Skitzen on May 18, 2013, 06:11:22 pm
I keep getting a "NoMethod Error" everytime I have a disabled actor for party. I don't want them shown at all in the switcher menu.

It says: "undefined Method 'diabled_for_party=' for NilClass"

Any help?


$game_actors[ID].disabled_for_party = true/false
$game_party.actors[POS].disabled_for_party = true/false
Title: Re: [XP] Easy Party Switcher
Post by: Skitzen on May 19, 2013, 03:03:42 am
Quote from: Blizzard on May 18, 2013, 06:28:01 pm
What is the exact script call that you are using?


$game_actors[ID].disabled_for_party = true
:/ I don't have anyone locked for the party or forced a position.
Title: Re: [XP] Easy Party Switcher
Post by: KK20 on May 19, 2013, 03:08:51 am
What value of ID are you using?

It's working fine for me.
Title: Re: [XP] Easy Party Switcher
Post by: Skitzen on May 19, 2013, 03:16:51 am
The character(s) whom of which I don't want shown,
Title: Re: [XP] Easy Party Switcher
Post by: KK20 on May 19, 2013, 03:18:47 am
I mean, what are you putting EXACTLY in [ID]? Because that's what the error is pointing to. Nowhere in the script does the line 'disabled_for_party=' appear. It can only come from the event you created.

Copy-paste the EXACT line you have that's throwing errors.
Title: Re: [XP] Easy Party Switcher
Post by: Skitzen on May 19, 2013, 03:22:30 am
$game_actors[4].disabled_for_party = true
Title: Re: [XP] Easy Party Switcher
Post by: KK20 on May 19, 2013, 03:27:22 am
Hm, still works fine for me in the demo. Unless there is no such thing as an actor 4 in your database, I am now confused. A demo is probably in order. You using any other custom scripts? Probably somewhere in the process $game_actors[4] is being converted to something else.
Title: Re: [XP] Easy Party Switcher
Post by: Skitzen on May 19, 2013, 03:29:53 am
All my other scripts have nothing to do with the party. And my game has over 10 actors. So It can't be that there is no 4.

I did get the script from the demo too.
Title: Re: [XP] Easy Party Switcher
Post by: KK20 on May 19, 2013, 03:32:23 am
Meh, still going to need a demo. I can't continue at this point. Everything you have said sounds fine and it works fine for me.
Title: Re: [XP] Easy Party Switcher
Post by: Skitzen on May 19, 2013, 03:34:50 am
Okay well I can't really give you a demo when my game is already pretty large..
Title: Re: [XP] Easy Party Switcher
Post by: KK20 on May 19, 2013, 03:38:13 am
Make a new project, copy the Data folder and paste it in this new project, and delete all the maps except for one. I honestly swear, if you cannot provide a demo, no one (not even Blizz) can help you.

And please, if you are still holding feelings of animosity towards me, I am in no way belittling you. I am merely stating the truth of this matter. I seriously want to help you--it's what I find pleasure doing here :)
Title: Re: [XP] Easy Party Switcher
Post by: Skitzen on May 19, 2013, 03:54:02 am
lol Sorry not going to make a demo due to kinda busy with things right now.

Not really any hate towards you. Just annoyed because you didn't understand the problem last time and this time it's probably a simple script error.
I'm just going to go back and see what is wrong in the script itself and fix it myself.
Title: Re: [XP] Easy Party Switcher
Post by: KK20 on May 19, 2013, 04:10:21 am
If it's not script order or improper syntax, the last thing I can think of is that you are calling $game_actors when it hasn't been loaded.

Well, I did the best I could. Blizzard, I hand this back to you.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on May 19, 2013, 04:44:47 am
KK20 basically already said it. Something is off and without a demo we can't really do much. Let us know if you can figure out what's wrong. To me it seems that for some reason the actor doesn't exist which is odd because when calling $game_actors[ID], the actor should be created at that point.
Title: Re: [XP] Easy Party Switcher
Post by: Skitzen on May 19, 2013, 09:23:05 pm
IT was a script error. My friend, who helps me out a bit accidentally edited a few lines of code. I modified it and now it works fine.
Title: Re: [XP] Easy Party Switcher
Post by: Slime55 on May 22, 2013, 02:05:01 pm
Hi, I like your script and it saved me a lot of time so thank you in first.
But i want add a specific option, an option that allow 1 member of party to take more than 1 place, example > Like in Dragon Quest Monster Joker 2 and Prof. 
picture >> http://www.jeuxvideo.com/screenshots/images/00036/00036015_247.htm, the monsters in the right.
So i want to know wich spcific line i need to change to have that result ?
Thank you and sorry if they're mistakes due to my non-english sentences
Title: Re: [XP] Easy Party Switcher
Post by: Echo Nine on September 20, 2013, 12:35:30 pm
This script is amazing!

I only need one thing. I am trying to make my game similar to the way pokemon works. So basically what I am trying to do is make it so you can only have one creature out on the field at a time (I have done this part) but when you go to switch there will only be monsters in your current party. At the moment I have started a new project, made the initial party only consist of one actor, but when I open up the party switch menu I can switch out the only actor in the party with all of the other actors that are available. Is there something I am doing wrong or is there some bit of code I can fix? I don't want the other options grayed out, I'd rather them to not be an option at all until someone joins the party.

I'm not very good at coding. Thank you so much for the script though! Hard to find a good one like this now days.   :)
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on September 20, 2013, 02:23:50 pm
If you are trying to actually make a pokemon game, you'd be best off with using the Pokemon Starter Kit. It has everything you need.

If you need just a similar functionality, check out the demo. It explains which script calls you can use to gradually enable actors to be selectable in the party switcher.
Title: Re: [XP] Easy Party Switcher
Post by: Echo Nine on September 20, 2013, 09:44:24 pm
Ah yes you can delete people from he party using the script code. The game I am making is much much different from pokemon, it just has a very similar fighting style.

Thanks so much for the script, credits to you :D.

Edit: Actually I have a question. Is there a way to make it so once you change out an actor can it not change the sprite graphic? Basically I want to have the player keep the same sprite through out the game no matter who is in the party. I could make it so that each character has the same sprite but that will be confusing when you are trying to find a certain monster.
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on September 21, 2013, 06:05:14 am
The map character sprite and the battle sprite are separate so you actually can make them all have the same map character sprite.
Title: Re: [XP] Easy Party Switcher
Post by: Echo Nine on September 21, 2013, 06:22:32 am
Hmm well what I am doing at the moment is having only one character in the party at all times, if I don't make an event that changes the sprite of it, it reverts to the set sprite of the only party member, I am trying to keep the sprite on the map the same no matter who is in the party. If I change all of their sprites to the same one it looks odd, I'm trying to make it look similar to the way pokemon does it. I keep referring back to it but that's the only game I can think of that does this :P.

Sorry if I am being annoying, I'm just not sure at what to do.  :shy:
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on September 21, 2013, 09:24:57 am
Actually I'm not exactly sure what you are trying to accomplish. xD Maybe this will do. Add this script below the party switcher. Call the set graphic event command on the player and it should stay.

class Game_Player
  def refresh
  end
end
Title: Re: [XP] Easy Party Switcher
Post by: Echo Nine on September 21, 2013, 10:47:41 am
Wow that works perfectly now! It was sorta hard to explain my point but you solved it :).

There is an issue though when it comes to having only one character in the party, even if you have other characters ready to be switched out, once your actor on the field dies you lose the game, instead of bringing up the switch menu. If all the actors are dead then it should give a game over. Anything I can do to change that?
Title: Re: [XP] Easy Party Switcher
Post by: Blizzard on September 21, 2013, 04:30:39 pm
Yeah, you will need an additional piece of script for that. Best you post a script request. Make sure to mention that it should work with the party switcher properly.
Title: Re: [XP] Easy Party Switcher
Post by: Echo Nine on September 21, 2013, 08:48:29 pm
Alright, thanks again :).
Title: Re: [XP] Easy Party Switcher
Post by: Tepe on November 28, 2022, 05:23:52 pm
Hello Blizzard.

Do You have idea how to fix bug in this script?
I wanna hidden or remove Window_BattleStatus and Window_Help in Battle Mode when Party Switcher is active.

Image (https://freeimage.host/i/HKiUYsp)

(https://iili.io/HKiUYsp.png)
Title: Re: [XP] Easy Party Switcher
Post by: KK20 on November 28, 2022, 07:39:50 pm
Seems to be caused by this (note, it's present in classes Window_Reserve and Window_HelpStatus)
    if scene == Scene_Map && $game_system.order_only ||
        scene == Scene_Battle && $game_system.battle_order_only
      self.opacity = 128
    end
When I have $game_system.battle_order_only set to true, I can partially reproduce what you have there.

Window_Current doesn't have this logic, so I'm not sure why your screenshot shows the left window with halved opacity too.

I don't particularly understand the reasoning behind this opacity change, so you could just remove it.
Title: Re: [XP] Easy Party Switcher
Post by: Tepe on November 28, 2022, 09:42:09 pm
I don't wanna remove opacity because it is most important for me.

I wanna only remove window_battlestatus and window_help under windowskin.

KK20

Set in script:

# allows switching the party in battle
BATTLE_SWITCH = true

Find in script:

@current_window = Window_Current.new

Add after:

@current_window.back_opacity = 100

Find

@reserve_window = Window_Reserve.new(@scene)

Add after:

@reserve_window.back_opacity = 100

Find:

@help_window = Window_HelpStatus.new(@reserve_window.getactor(0), @scene)

Add after:

@help_window.back_opacity = 100

I added custom background for this module and I solved this problem with z-index method but it still not exactly what I want.

Before z-index:

(https://iili.io/HKs8EfS.png)

After z-index:

(https://iili.io/HKs86mJ.png)
Title: Re: [XP] Easy Party Switcher
Post by: KK20 on November 29, 2022, 12:08:10 am
You can just make the two windows invisible right before switching to the PartySwitcher scene.

In Scene_Battle#update_phase2 (near the bottom of the script), add these four lines I point out:
Code: ruby
      $scene = Scene_PartySwitcher.new
     
      @party_command_window.visible = false #<==
      @status_window.visible = false        #<==
     
      $scene.main
     
      @party_command_window.visible = true  #<==
      @status_window.visible = true         #<==
     
      $scene = self
Title: Re: [XP] Easy Party Switcher
Post by: Tepe on November 29, 2022, 08:06:44 am
It's working. Thanks for Your advice / support. :)