MZ Weather on specific tiles only

Looking for a plugin/script for game where buildings inside are "open" and on the same map with outside (walls with no visible roofs) and I want to make the weather effects only affect the specific tiles. I would love to affect the tiles with X tile ID, no regions, because sometimes I swap the tiles like in minecraft type game.

Is there anything like that? I've found topic about this and kind-of-solution, but for RMVXA, and I need this for MZ.

Any help would be much appreciated! Thank you.
I quickly tested it in the function where it updates the weather sprites by setting the sprite visibility to false depending on it's coordinate. It seemed to work quite nicely* (check below) when I checked for a region id, but for some reason it worked much poorer when checking for a tile id (even when checking just one layer, not all). Here's where checking the region id:

Weather.prototype._updateAllSprites = function() {
const maxSprites = Math.floor(this.power * 10);
while (this._sprites.length < maxSprites) {
this._addSprite();
}
while (this._sprites.length > maxSprites) {
this._removeSprite();
}
for (const sprite of this._sprites) {
this._updateSprite(sprite);
sprite.x = sprite.ax - this.origin.x;
sprite.y = sprite.ay - this.origin.y;

const regionId = 1;
if ($gameMap.regionId($gameMap.canvasToMapX(sprite.x), $gameMap.canvasToMapY(sprite.y)) === regionId) {
sprite.visible = false;
} else {
sprite.visible = true;
}
}
};

Then I also tried to check coordinates I pushed into a game variable array (which can be easily modified), and it seemed to work quite nicely there too (hope I didn't manage to confuse myself here LOL). So the conditional was like:

if ($gameVariables.value(20).some(value => value[0] === $gameMap.canvasToMapX(sprite.x) && value[1] === $gameMap.canvasToMapY(sprite.y)))


*Now when I say quite nicely, the biggest problem was that the sprites could still appear at the very top of the screen for a small while. If you want to get rid of that, I guess you have to mofidy the _rebornSprite method to make it not able to throw the sprites to certain x-coordinates depending on whatever you're using.

Then there's also the dimmer sprite, that darkens the screen for weather effects. If you don't want the darkness to apply to the house insides, you'll have to modify that too. As I understand you should be able to slice parts away with clearRect(), you just need to get the correct coordinates on your screen where the regions/tileIds/coordinates are and then use that and fill in the update method. No idea how efficiently that runs though.

Well, maybe someone can tell you how to do it cleanly, anyway good luck LOL!

EDIT: Not sure but the sprites flashing at the top might only happen at the very top of the map? Also, the biggest storm sprites will overlap somewhat the rightmost tiles.
Hey, that kind of works! With regions I mean, but what about terrain tags then? Maybe it would be easier than the tile ids? Can you help, please? Not sure what should I change. Tried like this, but it works like: no weather when you step on tile with terrain tag = X. Not what I wanted ^^'

Code:
Weather.prototype._updateAllSprites = function() {
    const maxSprites = Math.floor(this.power * 10);
    while (this._sprites.length < maxSprites) {
        this._addSprite();
    }
    while (this._sprites.length > maxSprites) {
        this._removeSprite();
    }
    for (const sprite of this._sprites) {
        this._updateSprite(sprite);
        sprite.x = sprite.ax - this.origin.x;
        sprite.y = sprite.ay - this.origin.y;

        const terrainTag = 1;
        if ($gamePlayer.terrainTag($gameMap.canvasToMapX(sprite.x), $gameMap.canvasToMapY(sprite.y)) === terrainTag) {
        sprite.visible = false;
        } else {
        sprite.visible = true;
        }
    }
};
Yeah cool, in your modified script you're checking for the $gamePlayer.terraintag. Check the sprites:
if ($gameMap.terrainTag($gameMap.canvasToMapX(sprite.x), $gameMap.canvasToMapY(sprite.y)) === terrainTag)

Also note the edit I wrote at the end of my last post.
Yeah cool, in your modified script you're checking for the $gamePlayer.terraintag. Check the sprites:
if ($gameMap.terrainTag($gameMap.canvasToMapX(sprite.x), $gameMap.canvasToMapY(sprite.y)) === terrainTag)

Also note the edit I wrote at the end of my last post.
Yes, I'll try with them, too, but it works like this!!!
So, I have:

Code:
Weather.prototype._updateAllSprites = function() {
    const maxSprites = Math.floor(this.power * 10);
    while (this._sprites.length < maxSprites) {
        this._addSprite();
    }
    while (this._sprites.length > maxSprites) {
        this._removeSprite();
    }
    for (const sprite of this._sprites) {
        this._updateSprite(sprite);
        sprite.x = sprite.ax - this.origin.x;
        sprite.y = sprite.ay - this.origin.y;

        const terrainTag = 1;
        if ($gameMap.terrainTag($gameMap.canvasToMapX(sprite.x), $gameMap.canvasToMapY(sprite.y+48)) === terrainTag) {
        sprite.visible = false;
        } else {
        sprite.visible = true;
        }
    }
};

And just tried to add +48 to y, and looks the rain does not overlap the upper parts of the tiles. Anyway, it's just enought for me like this! This is perfect, exatcly what I wanted and needed! Thank you so much! I'll credit you for this for sure.

Original thread: https://forums.rpgmakerweb.com/threads/weather-on-specific-tiles-only.180571/