How to make ED5_ScrollWheelZoom centre on player character properly when zooming?

Hey! A friend recommended I try this plugin as it’s better than a zoom plugin that I already use for RPGMaker MV. This plugin lets you zoom in if you scroll using your mouse, but I noticed that it doesn’t centre well on your character, also it hides the timer countdown when it zooms in. Does anyone know how to fix these issues? I really like this plugin, but I don’t know what to do about the hidden timer, and the bad centering.

Also it seems to conflict with a northern lights plugin that I paid someone a lot of money to make. It makes the northern lights follow you when you zoom instead of staying in one place. Is there a way to fix that too?

Here’s the plugins below, I really hope someone can help me fix these issues. I don’t know any other decent alternatives.

DRAGON_NorthernLights.zip (25.2 KB)

ED5_ScrollWheelZoom.zip (30.0 KB)

Does anyone know how to fix this…? Please?

I think the timer is getting zoomed along with the map. In MV the timer sprite lives inside the map’s spriteset, so when the zoom scales everything around your player, the timer up in the top right corner gets pushed off screen. What if you pulled it out of the spriteset so the zoom can’t touch it? Save this as a new .js file in js/plugins and turn it on in the Plugin Manager:

(function() {
    var _Scene_Map_createDisplayObjects = Scene_Map.prototype.createDisplayObjects;
    Scene_Map.prototype.createDisplayObjects = function() {
        _Scene_Map_createDisplayObjects.call(this);
        var timer = this._spriteset._timerSprite;
        if (timer) {
            this._spriteset.removeChild(timer);
            this.addChildAt(timer, this.children.indexOf(this._windowLayer));
        }
    };
})();

I’m wondering if the bad centering shows up mostly near the edges of the map. The plugin zooms around wherever your player is on screen. So once the camera stops scrolling at a map edge and your player walks off center, the zoom keeps them off center too, even when there’s still map it could show. In ED5_ScrollWheelZoom.js, inside the updateZoom function, try swapping these lines:

            const playerX = $gamePlayer.screenX();
            const playerY = $gamePlayer.screenY();
            $gameScreen.setZoom(playerX, playerY, zoom);

for this, so it picks the zoom point that puts your player in the middle of the screen and only holds back when that would run past the map edge:

            const tw = $gameMap.tileWidth();
            const th = $gameMap.tileHeight();
            let zoomX = $gamePlayer.scrolledX() * tw + tw / 2;
            let zoomY = $gamePlayer.scrolledY() * th + th / 2;
            if (zoom > 1.001) {
                zoomX = (zoomX * zoom - Graphics.width / 2) / (zoom - 1);
                zoomY = (zoomY * zoom - Graphics.height / 2) / (zoom - 1);
                zoomX = Math.min(Math.max(zoomX, 0), Graphics.width);
                zoomY = Math.min(Math.max(zoomY, 0), Graphics.height);
            }
            $gameScreen.setZoom(zoomX, zoomY, zoom);

Then further down in setDestination, change the zoomX and zoomY lines to this so click to move still lines up when the zoom point lands on 0 at a map edge:

        const zoomX = $gameScreen.zoomX();
        const zoomY = $gameScreen.zoomY();

Is your northern lights show command using screen mode? That’s the plugin’s default, and screen mode pins the lights to the screen itself. So when the zoom moves the map around your player, the lights stay put on screen and look like they’re following you. Map mode places them in map pixels so they zoom and scroll with the map:

DRAGON_NorthernLights:show <mode: "map", x: 0, y: 0, width: 0, height: 0>

In map mode x and y count from the top left of the map, and a width or height of 0 uses the screen size. If your map is bigger than the screen, I’d set the width to the map’s width in tiles times 48.