Here, credit goes to Modern Algebra
#==============================================================================
# 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