Quick Actor Switching

Hello. So I just went through 24 pages of plugins to make sure this wasn't made yet. >_<


So let's get straight to the point. 


I'd like to request a plugin that allows the user to set 2 keys to quickly change the position of their actors.


Example:


A key is pressed - Actors shift to the left. First actor would go to the end of the party and the second actor would become the leader.


S key is pressed - Actors shift to the right. First actor would move to the second position and the last actor would become the leader.


A/S key were just examples but the keys should be a plugin command to be changed to fit the developers game layout.
Hi Silenity,


I'd start with Yanfly's Button Common Events plugin:










Then, all you need to do is get the Common Event to change the positions of the actors!  I would try using the Change Party Member command, because this allows us to remove and then add actors again, which should move the actor to the back of the party.  We may try using the Change Party Member command directly, or we may need to use it as a script call.  For the script call list, see Archeia's topic on script calls:





We see from the script call list that we can add and remove actors using the following:


$gameParty.addActor(n);
$gameParty.removeActor(n);


I assume that "n" is the actor ID.


Removing and then re-adding the front actor would move the front actor to the back.  The only challenge, then, is figuring out the correct actor ID of whoever the front actor is.


The front actor, who is the party leader, can be determined in the method described in this topic:





So, the front actor's ID should be:


$game_party.members[0].id


(If that doesn't work, it might actually be a function like the following...)


$game_party.members[0].id()


So, we should be able to insert the above for n.  Therefore, we should place the following as a Script command within our common event:


var n = $game_party.members[0].id; // Find the front actor.
$gameParty.removeActor(n); // First, remove the front actor.
$gameParty.addActor(n); // Next, add the front actor.


If we've done this right, our common event should rotate the front party member to the back.  This takes care of one of our common event buttons.  I won't be able to test this tonight, since I'm signing out to sleep, for now, but let me know if this works for you!  I at least hope the above ideas helped you get started!


Your Adventuring Companion,


Tyruswoo


P.S.  If the above script calls don't work, the next thing I would do is use Notepad++ to open up rpg_objects.js within your project's js folder.  We won't want to change anything there, but we'll just want to use CTRL+F to look for Game_Party.prototype.id to check if that is a function, or something similar, to see how to call it.


https://notepad-plus-plus.org/

Original thread: https://forums.rpgmakerweb.com/threads/quick-actor-switching.55630/