MV Is it possible to swap leader and follower with an animation in RMMV?

Hi everyone,

I’m working on a puzzle game in RPG Maker MV with a two-character party: a Leader (ID 1) and a Follower (ID 2) (which never changes). I want to create a system where pressing a key, like G (G For "Group"), swaps the Leader and Follower with a visible, animated movement. The idea is that the current Leader steps backward while the Follower moves forward into the Leader’s position, or vice versa depending on the current swap. Before swapping, the system should record the direction the front character is facing so both characters maintain correct facing after the swap. If a character cannot move (for example, blocked by a wall or something with collision), the step animation should be skipped to prevent clipping or softlocks of any kinds.

I imagine this would work as a parallel common event running at the start of the game. The swap should keep the two characters in formation (ID's won't be swapped), one behind the other, and automatically restore the follower to follow the leader after the movement. I’m not sure if fully achieving this animation (or anything i just wrote) is possible using only vanilla MV, so if it’s not, I’m open to using a custom plugin or script to make it work (As long as it's not AI gen).

I'm kinda lost... even because i don't know if i can move followers at all, so thanks in advance for any advice or suggestions! ^_^
I think it's possible just with eventing, if you are willing to put in a bit of work. You'll have to create events with the same sprites as both actors on every map you want this to work on. Also they should have the same event IDs on every map, so that you can control them with a common event (or you have to put this event also on every map as a parallel process^^). With this event, activated on button press, you need to get the position and facing direction of your actors and then move the events with the corresponding sprites to the exact same location (for example with a jump command). If you make them invisible at first and just activate the event page with the sprite after they are above your actors and then make your actors invisible, nobody will notice they switched places. From here on you can just controll there movements via moveroutes. Afterwards you remove your party leader from the party and then add them again. This will make them switch positions. Now you make them visible again and turn the doppelganger events off.

If you want a specific button that is not covered by the conditions for conditional branches, you'll probably also need a plugin for button press though. And if you are going to use plugins, you can spare yourself a lot of work with just using a follower control plugin like this one.
I think it's possible just with eventing, if you are willing to put in a bit of work. You'll have to create events with the same sprites as both actors on every map you want this to work on. Also they should have the same event IDs on every map, so that you can control them with a common event (or you have to put this event also on every map as a parallel process^^). With this event, activated on button press, you need to get the position and facing direction of your actors and then move the events with the corresponding sprites to the exact same location (for example with a jump command). If you make them invisible at first and just activate the event page with the sprite after they are above your actors and then make your actors invisible, nobody will notice they switched places. From here on you can just controll there movements via moveroutes. Afterwards you remove your party leader from the party and then add them again. This will make them switch positions. Now you make them visible again and turn the doppelganger events off.

If you want a specific button that is not covered by the conditions for conditional branches, you'll probably also need a plugin for button press though. And if you are going to use plugins, you can spare yourself a lot of work with just using a follower control plugin like this one.
Sounds terribly difficult to make and a pain to code, that's basically all i've accomplished (for now):

◆If:Script:Input.isTriggered('g') && $gameSystem.isFormationEnabled()
◆Script:var dir = $gamePlayer.direction();
:Script:var f = $gamePlayer.followers().follower(0);
:Script:$gameParty.swapOrder(0, 1);
:Script:$gamePlayer.setDirection(dir);
:Script:if (f) f.setDirection(dir);
◆
:End
Yeah, that's why I suggested to use a plugin instead^^
But I tried the eventing way and got something like this (it's still a bit wonky, but this can probably be fixed by some moveroute & waiting commands, also never mind the low framerate, it's because of the gif conversion):
Desktop2026.03.04-14.28.28.01-ezgif.com-video-to-gif-converter.gif


Is this somewhat like you imagined it to be?
Yeah, that's why I suggested to use a plugin instead^^
But I tried the eventing way and got something like this (it's still a bit wonky, but this can probably be fixed by some moveroute & waiting commands, also never mind the low framerate, it's because of the gif conversion): View attachment 361974

Is this somewhat like you imagined it to be?
Oh damn. yes, that’s exactly what I’ve been trying to do for the past few hours! I’m still pretty new to scripting, so trying to recreate it myself didn’t really work out, totally my fault. If you’re cool with it, could you share the code you used? If you do, just select all, copy it as plain text and paste it here so I can copy it manually straight into my own project and use it. Of course, I’ll credit you for it, just tell me what name you want me to put down. (if you are cool with it of course! 🙂 )
Of course I'm fine with it. If it works out for you, you can just credit me as coucassi if you want, but it's not necessary^^ Just note a few things:
- I went the eventing way, wherever possible, so if you familiar with scripting you could break down most of the steps.
- A lot of the commands are in german, because I use the maker in my native language. Knowing how the engine works, I think you'll be fine though. If anything is unclear, I'm happy to explain.
- I did not use a script to ask for the button press of G, but the default conditional branch asking for shift. You'll have to change that.

I used:
4 Switches [498 - 501]
2 Variables [170 & 171]
2 Events (You'll have to copy them to every map, where you want the leader switch to be possible)
1 Common Event

Heres my Common Event. You have to set it to parallel. I used Switch #500. You'll need it later.
◆If:Taste [Umschalten] wird gedrückt
◆If:Leader1 ist EIN
◆Text:01 Lunee(3), Fenster, Unten
: :Time for new leader!
◆
:Else
◆Text:01 Lunee(0), Fenster, Unten
: :My turn!
◆
:Beenden
◆Bewegungsroute festlegen:Spieler (Warten)
: :◇Durchgang EIN
◆Variablen steuern:#0171 Player X = Karte X von Spieler
◆Variablen steuern:#0170 Player Y = Karte Y von Spieler
◆Bewegungsroute festlegen:Spieler (Warten)
: :◇Warten:5 Frames
◆Ereignisstandort festlegen:EV014, ({Player X},{Player Y})
◆Bewegungsroute festlegen:Spieler (Warten)
: :◇Warten:5 Frames
◆If:Spieler blickt auf Unten
◆Bewegungsroute festlegen:EV014 (Warten)
: :◇Nach unten drehen
◆
:Beenden
◆If:Spieler blickt auf Links
◆Bewegungsroute festlegen:EV014 (Warten)
: :◇Nach links drehen
◆
:Beenden
◆If:Spieler blickt auf Rechts
◆Bewegungsroute festlegen:EV014 (Warten)
: :◇Nach rechts drehen
◆
:Beenden
◆If:Spieler blickt auf Oben
◆Bewegungsroute festlegen:EV014 (Warten)
: :◇Nach oben drehen
◆
:Beenden
◆Bewegungsroute festlegen:Spieler (Warten)
: :◇Warten:5 Frames
◆Ereignisstandort festlegen:EV015, ({Player X},{Player Y})
◆If:Spieler blickt auf Unten
◆Bewegungsroute festlegen:EV015 (Warten)
: :◇Nach unten drehen
◆
:Beenden
◆If:Spieler blickt auf Links
◆Bewegungsroute festlegen:EV015 (Warten)
: :◇Nach links drehen
◆
:Beenden
◆If:Spieler blickt auf Rechts
◆Bewegungsroute festlegen:EV015 (Warten)
: :◇Nach rechts drehen
◆
:Beenden
◆If:Spieler blickt auf Oben
◆Bewegungsroute festlegen:EV015 (Warten)
: :◇Nach oben drehen
◆
:Beenden
◆Bewegungsroute festlegen:EV015 (Warten)
: :◇1 Schritt rückwärts
◆If:Skript:$gamePlayer.followers().follower(0).direction() === 2
◆Bewegungsroute festlegen:EV015 (Warten)
: :◇Nach unten drehen
◆
:Beenden
◆If:Skript:$gamePlayer.followers().follower(0).direction() === 4
◆Bewegungsroute festlegen:EV015 (Warten)
: :◇Nach links drehen
◆
:Beenden
◆If:Skript:$gamePlayer.followers().follower(0).direction() === 6
◆Bewegungsroute festlegen:EV015 (Warten)
: :◇Nach rechts drehen
◆
:Beenden
◆If:Skript:$gamePlayer.followers().follower(0).direction() === 8
◆Bewegungsroute festlegen:EV015 (Warten)
: :◇Nach oben drehen
◆
:Beenden
◆Bewegungsroute festlegen:Spieler (Warten)
: :◇Warten:5 Frames
◆Schalter steuern:#0501 = EIN
◆Bewegungsroute festlegen:Spieler (Warten)
: :◇Warten:5 Frames
: :◇Transparenz EIN
◆Bewegungsroute festlegen:EV014 (Überspringen)
: :◇1 Schritt rückwärts
◆Bewegungsroute festlegen:EV015 (Überspringen, Warten)
: :◇Zum Spieler drehen
: :◇1 Schritt vorwärts
◆Bewegungsroute festlegen:Spieler (Warten)
: :◇Warten:5 Frames
◆If:Leader1 ist EIN
◆Gruppenmitglied ändern:Lunee entfernen
◆Gruppenmitglied ändern:Lunee hinzufügen
◆
:Else
◆Gruppenmitglied ändern:Van entfernen
◆Gruppenmitglied ändern:Van hinzufügen
◆
:Beenden
◆Bewegungsroute festlegen:Spieler (Warten)
: :◇Warten:5 Frames
: :◇Transparenz AUS
◆Schalter steuern:#0501 = AUS
◆If:Leader1 ist EIN
◆Schalter steuern:#0499 Leader1 = AUS
◆Schalter steuern:#0498 Leader2 = EIN
◆
:Else
◆Schalter steuern:#0499 Leader1 = EIN
◆Schalter steuern:#0498 Leader2 = AUS
◆
:Beenden
◆
:Beenden

Here's the two other events. You'll have to copy them to every map and make sure they always have the same ID (in this case it's 14 & 15)
Event 14
1772638712910.png
1772638751664.png

Event 15
1772638812984.png
1772638835313.png


Switch 499, which let's the Event know that your main character is the current leader is best set to ON manually at the beginning of you game.
Switch 500, which enables the common event is best manually set on as soon as you want the leader switchiung to be possible.

Sorry, if it's a bit messy^^ As I said, if anything is unclear I'll explain in detail.
I hope you'll get it to work as you imagine! Also, tell me if you have a demo ou, so I can see it in action 🙂

Original thread: https://forums.rpgmakerweb.com/threads/is-it-possible-to-swap-leader-and-follower-with-an-animation-in-rmmv.182724/