MZ Smoother map transition for an open world feel

So I wanted to stitch maps together and do smoother transitions to approximate the chunk loading from open world type games. I didn't find anyone who ever presented a solution although I found a couple of times where someone had asked a similar question. Obviously you need to have the transfer not have a fade so started there. But the followers bunch up when you do a transfer. Didn't see an obvious way to change it through the event system so rooted around in the .js files and cobbled this together:


switch ($gamePlayer._direction) {
case 2:
$gamePlayer.followers()._data[0].locate($gamePlayer.x, $gamePlayer.y-1);
$gamePlayer.followers()._data[1].locate($gamePlayer.x, $gamePlayer.y-2);
$gamePlayer.followers()._data[2].locate($gamePlayer.x, $gamePlayer.y-3);
break;
case 4:
$gamePlayer.followers()._data[0].locate($gamePlayer.x+1, $gamePlayer.y);
$gamePlayer.followers()._data[1].locate($gamePlayer.x+2, $gamePlayer.y);
$gamePlayer.followers()._data[2].locate($gamePlayer.x+3, $gamePlayer.y);
break;
case 6:
$gamePlayer.followers()._data[0].locate($gamePlayer.x-1, $gamePlayer.y);
$gamePlayer.followers()._data[1].locate($gamePlayer.x-2, $gamePlayer.y);
$gamePlayer.followers()._data[2].locate($gamePlayer.x-3, $gamePlayer.y);
break;
case 8:
$gamePlayer.followers()._data[0].locate($gamePlayer.x, $gamePlayer.y+1);
$gamePlayer.followers()._data[1].locate($gamePlayer.x, $gamePlayer.y+2);
$gamePlayer.followers()._data[2].locate($gamePlayer.x, $gamePlayer.y+3);
break;
}

I put it in a script call from an event like this:
1631406382526.png


As long as you set your maps up so you have overlapping portions like this so you have room to place the player and the string of followers and set your transfers to space out properly:
1631406425870.png
1631406436566.png


Then it works just fine. I set it up as an autorun event so it triggers as soon as you enter a map and not sure if the Erase Event is truly needed but did it just in case so I'm certain it only runs once. As a bonus when you first start the followers will be all lined up instead of stacked on top of the player 🙂
1631406934458.png
I didn't feel like trying to dig into writing a full-blown plugin so this doesn't work in MV as the script window won't take that much text and I'm pretty much doing everything in MZ anyhow. If anyone feels they want to do a plugin using this feel free.
If anyone feels they want to do a plugin using this feel free.
Sure. It isn't that hard anyway.
Here is the plugin version so you don't need to put the block of text in your eventing system.
Code:
/*:
@target MZ
@plugindesc Unstack Follower
@help
A plugin version of this post
https://forums.rpgmakerweb.com/index.php?threads/smoother-map-transition-for-an-open-world-feel.140363/#post-1214308
@command unstack
@text Unstack Follower
@desc Unstack Follower
*/
(()=>{
    _pluginName = document.currentScript.src.match(/.+\/(.+)\.js/)[1]
    PluginManager.registerCommand(_pluginName, "unstack", () => {
        switch ($gamePlayer._direction) {
            case 2:
            $gamePlayer.followers()._data[0].locate($gamePlayer.x, $gamePlayer.y-1);
            $gamePlayer.followers()._data[1].locate($gamePlayer.x, $gamePlayer.y-2);
            $gamePlayer.followers()._data[2].locate($gamePlayer.x, $gamePlayer.y-3);
            break;
            case 4:
            $gamePlayer.followers()._data[0].locate($gamePlayer.x+1, $gamePlayer.y);
            $gamePlayer.followers()._data[1].locate($gamePlayer.x+2, $gamePlayer.y);
            $gamePlayer.followers()._data[2].locate($gamePlayer.x+3, $gamePlayer.y);
            break;
            case 6:
            $gamePlayer.followers()._data[0].locate($gamePlayer.x-1, $gamePlayer.y);
            $gamePlayer.followers()._data[1].locate($gamePlayer.x-2, $gamePlayer.y);
            $gamePlayer.followers()._data[2].locate($gamePlayer.x-3, $gamePlayer.y);
            break;
            case 8:
            $gamePlayer.followers()._data[0].locate($gamePlayer.x, $gamePlayer.y+1);
            $gamePlayer.followers()._data[1].locate($gamePlayer.x, $gamePlayer.y+2);
            $gamePlayer.followers()._data[2].locate($gamePlayer.x, $gamePlayer.y+3);
            break;
        }
    });
})()
What does it look like?

Screenshot_589.jpg

unstack.gif
That's probably the shortest plugin I've seen. I personally have no interest in writing plugins. My best effort is a line or two of javascript to access variables the event system can't get to 🙂
Basically I did some searching and found I wasn't the only person to ask that question but there was never an answer to the other people other than "you need a plugin" so I figured I'd share it since other people obviously have wanted to do the same thing.
It is actually complex than you might expect. However, you are using the easiest solution, which can only work or make sense in a particular scenario.

For example, your solution may not be suited in this scenario.
unstack2.gif

This requires a complex checking if the tile is passable and, ideally, you should make a detour.
However, having the easiest solution is better than nothing at all. Just make sure to tell that it can only make sense in a certain scenario.
Yes that's why I mentioned you have to have to make sure you have room for the followers. My intended use case was to mimic chunk loading so you would ideally make your maps with a sizeable overlap so it looks more like you're on a large map rather than jumping between smaller maps. Similar questions I'd seen unanswered only involved keeping the followers from being bunched up so that's why I threw this in.
My solution was just like grabbing a piece of junk mail to swat a fly rather than make an appointment with an exterminator ....... 🙂
There is also another flaw to this method.

You are assuming that during the map transition, the player followers are in the straight line. What if it wasn't. As soon as the map change, you change the follower position to be a straight line, which would look weird.
Not really a flaw. With the use case I described the map layout should ensure they are in a straight line when they hit the transfer. If you want to cover multiple use cases then obviously you'd have to grab the positions of all the followers to translate them to the new destination. Like I said this is just a quick hack for a specific purpose and not a general purpose solution. People are free to run with this if they want and do whatever suits their need. Again I didn't get RPG Maker to write plugins. If I get to where I'm writing any significant amount of code then the project isn't well suited to this engine 🙂
Right, what I said is maybe you have a solution for that, to grab the previous relative position before transferring to the new location so you don't have to make sure it has a straight line at all times.
It would still be necessary to check the number of following members in the Party:
JavaScript:
$gameParty.members().length

And also if the follower system is not activated:
JavaScript:
$gamePlayer._followers._visible

Current Map size:
JavaScript:
$dataMap.width
JavaScript:
$dataMap.height

I hope this helps.
All great ideas if anyone needs to expand upon it.

Original thread: https://forums.rpgmakerweb.com/threads/smoother-map-transition-for-an-open-world-feel.140363/