RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Change Party Order

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
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


Code: [Select]
#==============================================================================
#  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


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
« Last Edit: February 11, 2010, 09:51:05 PM by Modern Algebra »

**
Rep: +0/-0Level 86
What's with these people?!?
This sounds pretty nifty. I could make a use out of this in my game! It works perfectly. Great job, I must say.

***
Rep:
Level 86
Thnx this will come in handy I'll definatly use it  :)

**
Rep:
Level 85
I am already there
thanx mate im definately using it in my game

**
Rep: +0/-0Level 84
I dare u to move
Is this compatible with a caterpillar script?




I'm a big fan of Breath of Fire.
"DONT JUDGE THE GAME BY IT'S TITLE SCREEN"

**
Rep:
Level 84
Live it up!
Modern Algebra, is this compatible with the Kaduki version of the Tankentai SBS?
Courage is the magic that turns dreams into reality.

My Blogsite

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
I'm not familiar with that script, but I don't see why it wouldn't be.

**
Rep: +0/-0Level 84
^ lame xbox avatar is under 9000.
Oh alrite. So it's kind of like Wild ARMs 3 or FF4? Pretty handy.
You've just been obliteraped!

Currently Working On: One Day Salesman
http://rmrk.net/index.php/topic,33234.0.html

**
Rep: +0/-0Level 81
RMRK Junior
This script sounds pretty good - reminds me of the breath of fires series, each character had it's own important functions that could only be preformed if he/she was the 'main' actor.

**
Rep: +0/-0Level 82
Is it possible to have it done in a demo? Because it keeps saying a error on practacly every line.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
If it's giving an error anywhere it's likely an incompatibility between some script you're using. Try it in a new project and you'll see it works, so there's really no need for a demo.

My guess if it's giving an error on practically every line is that you have some script that calls it before $game_party is initialized. Maybe a skip title screen or title screen on map script? Or you're trying to use it in XP when it's a VX script. There is an XP version of it in the XP Scripts Database if that's what's happening.

**
Rep: +0/-0Level 84
There's a way to check the leading actor, like in a conditional branch? This is perfect to make events that need a specific leading actor.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Um, use this in a script call:

Code: [Select]
$game_variables[x] = $game_party.members.empty? ? 0 : $game_party.members[0].id

That make it so Variable X is the ID of the lead actor, unless there are no party members, in which case it will be 0. You can use regular conditional branches to check the value of that variable once it is set.

**
Rep: +0/-0Level 84
Work, thanks.
Using the same method, can i check the class (paladin, knight etc) ?

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
yeah, just put class_id instead of id.

**
Rep:
Level 80
RMRK Member
Hey, I put your script in my game--thanks for making it!
But I have a question-
How do I change the triggers for changing the order?
(It works when I hit Q and W, but I use the Vampyr battle system, and the item/spell menus are hotkeyed to Q and W, so whenever I try to bring up those interfaces, I switch the order.)
People who are organized are just too lazy to organize their stuff.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
In sthe script, find where Input::L and Input::R are. Change them to whatever buttons you want to use.