Change Party Order
Version: 1.0
Author: modern algebra
Date: February 20th, 2008
Description
This script allows the player to change party order through the use of the L and R buttons
Features
- Allows the player to switch party order on the map
- Can be disabled and reenabled at any time
Instructions
Simple. Press L and R (Q and W by default) to switch between the actors in your party and have them as leader. If the party is composed of 4 actors A B C D, where A is the current leader, then pressing R would change the order to B C D A and pressing L would change the order to D A B C. You can disallow the player from doing this by first setting ORDER_FREEZE_SWITCH_ID to a Switch ID of your choosing, and then setting that switch in game with a Control Switch command. Turning the switch ON will disable the ability, and so the player will not be able to switch party order, while turning it off enables the feature.
Script
#==============================================================================
# Change Party Order
# Author: modern algebra (rmrk.net)
# Date: February 20, 2008
#==============================================================================
class Scene_Map
# ORDER_FREEZE_SWITCH_ID :: This constant is for you to set to a switch ID
# that controls whether the player is allowed to change party order. If it is
# set to 1 for example, then turning Switch 1 ON will disallow the player
# from changing party order, and turning it OFF will allow the player to.
ORDER_FREEZE_SWITCH_ID = 1
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Frame Update
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modern_algebra_change_leader_modification_updt update
def update
modern_algebra_change_leader_modification_updt
return if $game_switches[ORDER_FREEZE_SWITCH_ID]
# If Button R is being pressed
if Input.trigger? (Input::R)
# Remove the Lead Actor
old_lead = $game_party.members.shift.id
$game_party.remove_actor (old_lead)
# Add the old leader back into the party
$game_party.add_actor (old_lead)
end
# If Button L is being pressed
if Input.trigger? (Input::L)
# Recreate the actors array from the members array
actors = []
$game_party.members.each {|actor| actors.push (actor.id)}
# Reorder the array to the new order
actors.unshift (actors.pop)
actors.each {|id|
# Remove each actor and add them in the new order
$game_party.remove_actor (id)
$game_party.add_actor (id)
}
end
end
end
Credit
No credit is necessary for such a simple script, but it was written by me
Support
Please post your questions here if you run into problems
Author's Notes
This, when I made it for RMXP, was just released as a scriptlet. But, I figure I will test releasing them independently to see what happens. Once the VX database gets more scripts I will probably merge them all back into the Useful Scriptlets topic. It was slightly more annoying than the RMXP version since you don't have access to the actors array directly. I could have merely done that, made actors an instance variable, but I figured I would restrict myself within the default as much as possible
This script by
modern algebra is licensed under a
Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.