Main Menu
  • Welcome to The RPG Maker Resource Kit.

Switch Party Leader

Started by AeghtyAteKees, July 22, 2011, 11:04:11 PM

0 Members and 1 Guest are viewing this topic.

AeghtyAteKees

So I've found all these complex Party Management scripts floating around with millions of effects and customizations that redraw the menu and every other crazy thing you can imagine. But I just have three party members, not eight-hundred and seventeen, and need a way to switch out which one leads the party. Sweet and simple. If anyone knows where to find this or can whip it up, I would greatly appreciate the help. :)
Anatidaephobia- The fear that somewhere, somehow, a duck is watching you.

DoctorTodd


AeghtyAteKees

Well, yes. Is it possible to make it work from the menu?
Anatidaephobia- The fear that somewhere, somehow, a duck is watching you.

DoctorTodd

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

 

AeghtyAteKees

Works just as well. :) Thanks.
Anatidaephobia- The fear that somewhere, somehow, a duck is watching you.