Zelda Style Map Transitions

It is not really a transfer but more of camera scroll. By default the camera scrolls and cents on the player, This way it will only scroll when you reach edge of screen. If you look at old zelda games you will see this a lot. I made this script because it was requested by another person. Now if you combine this with a map stitching script and Quasi(ABS) or my ABS then you will have all the mechanics to make a zelda type game.
Thanks for your hard work! 🙂 This plugin will suit my new project perfectly! 😉
Works beautifully! Thank you 🙂
Thanks Jeremy. I was actually looking for something like this. I was in the process of making a plugin, but I'm glad you made one instead. I'll be sure to credit you in my rpg.
Would this plugin have a possible impact on performance on big maps? Like, depending on how MV works, if it isn't loading much of anything outside of the current screen then this might actually decrece the risk for lag a little on bigger maps? Does anyone know?
Hey! 🙂


Thank you so much Jeremy for this epic plug in 😀


But i have i little question:


In a Link to the past for SNES, the camera switching areas are bigger and differ from map to map; not like the camera switches in Links worlds and dungeons in the GBC Games.


So: is there any possibility, to adjust the default 13*17 camera positions? Like in a notetag for each map where you can define x and y or something? I have no idea about scripting, so i have no clue, if it is easy or not 😛


Greetings!
Can you enable this script to maintain the camera lock even when you "teleport/transfer player" to a spot on the same map? It throws off the grid.
Awesome plugin! 
Great plugin!


But I found a gamebreaking bug that occurs when you set the map scrolltype to loop.


If you then go right "out of the map" to appear on the other side the camera will not follow the player, but scroll through the whole map and when it reaches the player it just starts going back and forward without ever stopping.
How the heck do you download this thing? I tried two different things, but it all ends up getting me a plugin with no information and it always results in a blank screen, or automatic crashes.
How the heck do you download this thing? I tried two different things, but it all ends up getting me a plugin with no information and it always results in a blank screen, or automatic crashes.



Go here: http://pastebin.com/raw/3LuUR0uf and select File > Save As in your browser.  Make sure the filename is "MapScroll.js".  Then place that file in the plugin section of your project.
Go here: http://pastebin.com/raw/3LuUR0uf and select File > Save As in your browser.  Make sure the filename is "MapScroll.js".  Then place that file in the plugin section of your project.

 WOAAAAAAHHH... Holy... Woah... I figured it out.


Ok, What I did was I ended up using Sublime Text 3 and just Copy-Pasted it into the program and saved it.


What my mistake was is that I didn't... copy this.



//=============================================================================
// MapScroll.js
//=============================================================================
/*:
 *Version 2.0
 *Change log:
 *11/5/2015:Scroll scales with window width/height.
 *   Added plugin commands to disable/enagle scrolling in game.
 *11/5/2015: v2.0 Auto grid snap more commands and notetags.
 *
 *
 * @plugindesc Scrolls the map when you get to the edge.
 * @author Jeremy Cannady
 *
 * @help Scrolls the map when you get to the edge, normal maps are 13 by 17
 *  
 *Plugin commands:
 * Map_Scroll_Disable ----> This will disable and revert to normal scrolling.
 * Map_Scroll_Enable  ----> This will enable scrolling.
 * Grid_Snap_Disable  ---> Disables grid auto snap.
 * Grid_Snap_Enable   ---> Enables grid auto snap (default)
 *
 *Note Tags:
 *<ScrollDisable> if put in the map note tags then scrolling will be back to normal instead of grid scrolling.
 *

*/


Huh... Anyway, Thanks for the help.
OK, NEW PROBLEM.


I got the script to work but it keeps going back and forth whenever I get to the edge and I have NO idea why. Here's the thing I got, No idea what's going on.


Come up with a fix if you want. I dunno...


//=============================================================================
// MapScroll.js
//=============================================================================
/*:
 *Version 2.0
 *Change log:
 *11/5/2015:Scroll scales with window width/height.
 *   Added plugin commands to disable/enagle scrolling in game.
 *11/5/2015: v2.0 Auto grid snap more commands and notetags.
 *
 *
 * @plugindesc Scrolls the map when you get to the edge.
 * @author Jeremy Cannady
 *
 * @help Scrolls the map when you get to the edge, normal maps are 13 by 17
 *  
 *Plugin commands:
 * Map_Scroll_Disable ----> This will disable and revert to normal scrolling.
 * Map_Scroll_Enable  ----> This will enable scrolling.
 * Grid_Snap_Disable  ---> Disables grid auto snap.
 * Grid_Snap_Enable   ---> Enables grid auto snap (default)
 *
 *Note Tags:
 *<ScrollDisable> if put in the map note tags then scrolling will be back to normal instead of grid scrolling.
 *
*/


(function(){
//Define a variable to enable/disable the scrolling
Game_Player.prototype._Map_Scroll_Enabled = true;
//Default grid snap
Game_Player.prototype.gridSnap = true;
 
//Superseding the updateScroll function. Don't scroll until we are on the edge.
Game_Player.prototype.updateScroll = function(lastScrolledX, lastScrolledY) {
        //If we have scroll diabled for this map then set scroll to false.
        if($dataMap.meta.ScrollDisable){
                Game_Player.prototype.Map_Scroll_for_this_Map = false;
        }else{
                Game_Player.prototype.Map_Scroll_for_this_Map = true;
        };
       
        var x1 = lastScrolledX;
    var y1 = lastScrolledY;
    var x2 = this.scrolledX();
    var y2 = this.scrolledY();
        var xScroll = Math.round(SceneManager._boxWidth/48);
        var yScroll = Math.round(SceneManager._boxHeight/48);
 
        if(Game_Player.prototype._Map_Scroll_Enabled && Game_Player.prototype.Map_Scroll_for_this_Map){
                //Checks to see if we move beyond the screen if we do then it scrolls it for us.
                if (x2 > xScroll-1) {$gameMap.startScroll(6,xScroll,6);};//Left
                if (x2 < -0.5) {$gameMap.startScroll(4,xScroll,6);};//Right
                if (y2 > yScroll-1) {$gameMap.startScroll(2,yScroll,6);};//Down
                if (y2 < -0.5) {$gameMap.startScroll(8,yScroll,6);};//Up       
        }else{//If we have it disabled then run the original code
                if (y2 > y1 && y2 > this.centerY()) {$gameMap.scrollDown(y2 - y1);};
                if (x2 < x1 && x2 < this.centerX()) {$gameMap.scrollLeft(x1 - x2);};
                if (x2 > x1 && x2 > this.centerX()) {$gameMap.scrollRight(x2 - x1);};
                if (y2 < y1 && y2 < this.centerY()) {$gameMap.scrollUp(y1 - y2);};     
        };
};//End of update scroll.
 
//Superseding the canMove function. Check if we are scrolling the screen.
Game_Player.prototype.canMove = function() {
    if ($gameMap.isEventRunning() || $gameMessage.isBusy()) {return false;}
    if (this.isMoveRouteForcing() || this.areFollowersGathering()) {return false;}
    if (this._vehicleGettingOn || this._vehicleGettingOff) {return false;}
    if (this.isInVehicle() && !this.vehicle().canMove()) {return false;}
        if (Game_Player.prototype._Map_Scroll_Enabled && $gameMap.isScrolling()){return false;};       
        return true;
};//End of canMove.
 
var alias_Game_Map_setDisplayPos = Game_Map.prototype.setDisplayPos;
Game_Map.prototype.setDisplayPos = function(x, y) {
        //If the grid snap is disabled then run the original code;
        if(Game_Player.prototype.gridSnap === false){
                alias_Game_Map_setDisplayPos.call(this,x,y);   
        }else{//If grid snap is enabled then snap the camera to the correct position.
                var xScroll = Math.floor(SceneManager._boxWidth / 48);
                var yScroll = Math.floor(SceneManager._boxHeight / 48);
                var newX = $gamePlayer._newX;
                var newY = $gamePlayer._newY;
                var gridX = Math.floor(newX / xScroll)
                var gridY = Math.floor(newY / yScroll)
                this._displayX = gridX * xScroll;
                this._displayY = gridY * yScroll;
                this._parallaxX = this._displayX;
                this._parallaxY = this._displayY;
        };
};//End of set display position.
 
//Define the pugin command for disable.
var Map_Scroll_Disable_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
        Map_Scroll_Disable_pluginCommand.call(this, command, args);
        if (command === "Map_Scroll_Disable") {
                //If we type in Map_Scroll_Disable then disable scrolling.
                Game_Player.prototype._Map_Scroll_Enabled = false;
        };
};
 
//Define the pugin command for enable.
var Map_Scroll_Enable_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
        Map_Scroll_Enable_pluginCommand.call(this, command, args);
        if (command === "Map_Scroll_Enable") {
                //If we type in Map_Scroll_Enable then enable scrolling.
                Game_Player.prototype._Map_Scroll_Enabled = true;
        };
};
 
var Grid_Snap_Disable_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
        Grid_Snap_Disable_pluginCommand.call(this, command, args);
        if (command === "Grid_Snap_Disable") {
                //If we type in Grid_Snap_Disable then disable grid snap.
                Game_Player.prototype.gridSnap = false;
        };
};
 
var Grid_Snap_Enable_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
        Grid_Snap_Enable_pluginCommand.call(this, command, args);
        if (command === "Grid_Snap_Enable") {
                //If we type in Grid_Snap_Enable then enable grip snap.
                Game_Player.prototype.gridSnap = true;
        };
};
 
})();


 


 
Note tag or plugin command is not working for me. I have rooms I don't want to scroll, but they will just start at the top rather than were I transfer into even if I set the notetag or put in the commands. Am I not getting something?


Nevermind that it is working the problem is that the camra start at the top left of the map and not were than character is help???
I'm not quite sure whats happening either. The camera is stuck in the upper right corner on a 21 x 12 map after I switch maps. I'm trying to make the camera automatically align itself to the dead centre of the map, but I'm not sure what I'm doing with code.
Is there a way to have it scroll before reaching the edge?
I'm using a HUD at the bottom of the screen but I don't want to walk into/under the HUD.
Great plugin! Thanks!
I'm not quite sure whats happening either. The camera is stuck in the upper right corner on a 21 x 12 map after I switch maps. I'm trying to make the camera automatically align itself to the dead centre of the map, but I'm not sure what I'm doing with code.

Having this same kind of issue. Oddly enough once I get my character centered on the screen it scrolls just fine and the problem won't happen again if I exit the map and come back.
So, I found a bug, of sorts? So when I go up, the camera goes up as intended, but then it goes back down again, resulting in an eternal loop of back and forth.
Don't mind me. just necroposting.
or is it allowed in this type of thread?

Original thread: https://forums.rpgmakerweb.com/threads/zelda-style-map-transitions.49264/