Question about Weather Class

I have a question about weather. So I copied the weather class and made a new one. I also made all the same implementations, such as when to create, update, etc.

However I don't know what exactly happens how to call it.

So my questions is:

In the normal weather, how do you manually set a weather? I can't seem to find a proper plugin script call or anything.

This is the sample copy plugin in question:

Spoiler
Code:
function SampleWeather() {    this.initialize.apply(this, arguments);}SampleWeather.prototype = Object.create(PIXI.DisplayObjectContainer.prototype);SampleWeather.prototype.constructor = SampleWeather;SampleWeather.prototype.initialize = function() {    PIXI.DisplayObjectContainer.call(this);    this._width = Graphics.width;    this._height = Graphics.height;    this._sprites = [];    this._createBitmaps();    this._createDimmer();    this.type = 'none';    this.power = 0;    this.origin = new Point();};SampleWeather.prototype.update = function() {    this._updateDimmer();    this._updateAllSprites();};SampleWeather.prototype._createBitmaps = function() {    this._rainBitmap = new Bitmap(1, 60);    this._rainBitmap.fillAll('white');    this._stormBitmap = new Bitmap(2, 100);    this._stormBitmap.fillAll('white');    this._snowBitmap = new Bitmap(9, 9);    this._snowBitmap.drawCircle(4, 4, 4, 'white');};SampleWeather.prototype._createDimmer = function() {    this._dimmerSprite = new ScreenSprite();    this._dimmerSprite.setColor(80, 80, 80);    this.addChild(this._dimmerSprite);};SampleWeather.prototype._updateDimmer = function() {    this._dimmerSprite.opacity = Math.floor(this.power * 6);};SampleWeather.prototype._updateAllSprites = function() {    var maxSprites = Math.floor(this.power * 10);    while (this._sprites.length < maxSprites) {        this._addSprite();    }    while (this._sprites.length > maxSprites) {        this._removeSprite();    }    this._sprites.forEach(function(sprite) {        this._updateSprite(sprite);        sprite.x = sprite.ax - this.origin.x;        sprite.y = sprite.ay - this.origin.y;    }, this);};SampleWeather.prototype._addSprite = function() {    var sprite = new Sprite(this.viewport);    sprite.opacity = 0;    this._sprites.push(sprite);    this.addChild(sprite);};SampleWeather.prototype._removeSprite = function() {    this.removeChild(this._sprites.pop());};/** * @method _updateSprite * @param {Sprite} sprite * @private */SampleWeather.prototype._updateSprite = function(sprite) {    switch (this.type) {    case 'rain':        this._updateRainSprite(sprite);        break;    case 'storm':        this._updateStormSprite(sprite);        break;    case 'snow':        this._updateSnowSprite(sprite);        break;    }    if (sprite.opacity < 40) {        this._rebornSprite(sprite);    }};SampleWeather.prototype._updateRainSprite = function(sprite) {    sprite.bitmap = this._rainBitmap;    sprite.rotation = Math.PI / 16;    sprite.ax -= 6 * Math.sin(sprite.rotation);    sprite.ay += 6 * Math.cos(sprite.rotation);    sprite.opacity -= 6;};SampleWeather.prototype._updateStormSprite = function(sprite) {    sprite.bitmap = this._stormBitmap;    sprite.rotation = Math.PI / 8;    sprite.ax -= 8 * Math.sin(sprite.rotation);    sprite.ay += 8 * Math.cos(sprite.rotation);    sprite.opacity -= 8;};/** * @method _updateSnowSprite * @param {Sprite} sprite * @private */SampleWeather.prototype._updateSnowSprite = function(sprite) {    sprite.bitmap = this._snowBitmap;    sprite.rotation = Math.PI / 16;    sprite.ax -= 3 * Math.sin(sprite.rotation);    sprite.ay += 3 * Math.cos(sprite.rotation);    sprite.opacity -= 3;};SampleWeather.prototype._rebornSprite = function(sprite) {    sprite.ax = Math.randomInt(Graphics.width + 100) - 100 + this.origin.x;    sprite.ay = Math.randomInt(Graphics.height + 200) - 200 + this.origin.y;    sprite.opacity = 160 + Math.randomInt(60);};Spriteset_Map.prototype.createLowerLayer = function() {    Spriteset_Base.prototype.createLowerLayer.call(this);    this.createParallax();    this.createTilemap();    this.createCharacters();    this.createShadow();    this.createDestination();    this.createWeather();    this.createAdvancedWeather();};Spriteset_Map.prototype.createAdvancedWeather = function() {    this._weatherX = new SampleWeather();    this.addChild(this._weatherX);}Spriteset_Map.prototype.updateWeatherX = function() {    this._weatherX.type = $gameScreen.weatherType();    this._weatherX.power = $gameScreen.weatherPower();    this._weatherX.origin.x = $gameMap.displayX() * $gameMap.tileWidth();    this._weatherX.origin.y = $gameMap.displayY() * $gameMap.tileHeight();};Spriteset_Map.prototype.update = function() {    Spriteset_Base.prototype.update.call(this);    this.updateTileset();    this.updateParallax();    this.updateTilemap();    this.updateShadow();    this.updateWeather();    this.updateWeatherX();};Game_Screen.prototype.clear = function() {    this.clearFade();    this.clearTone();    this.clearFlash();    this.clearShake();    this.clearZoom();    this.clearWeather();    this.clearWeatherX();    this.clearPictures();};Game_Screen.prototype.weatherTypeX = function() {    return this._weatherTypeX;};Game_Screen.prototype.weatherPowerX = function() {    return this._weatherPowerX;};Game_Screen.prototype.clearWeatherX = function() {    this._weatherTypeX = 'none';    this._weatherPowerX = 0;    this._weatherPowerTargetX = 0;    this._weatherDurationX = 0;};Game_Screen.prototype.changeWeatherX = function(type, power, duration) {    if (type !== 'none' || duration === 0) {        this._weatherTypeX = type;    }    this._weatherPowerTargetX = type === 'none' ? 0 : power;    this._weatherDurationX = duration;    if (duration === 0) {        this._weatherPowerX = this._weatherPowerTargetX;    }};Game_Screen.prototype.update = function() {    this.updateFadeOut();    this.updateFadeIn();    this.updateTone();    this.updateFlash();    this.updateShake();    this.updateZoom();    this.updateWeather();    this.updateWeatherX();    this.updatePictures();};Game_Screen.prototype.updateWeatherX = function() {    if (this._weatherDurationX > 0) {        var d = this._weatherDurationX;        var t = this._weatherPowerTargetX;        this._weatherPowerX = (this._weatherPowerX * (d - 1) + t) / d;        this._weatherDurationX--;        if (this._weatherDurationX === 0 && this._weatherPowerTargetX === 0) {            this._weatherTypeX = 'none';        }    }};Game_Interpreter.prototype.setWeatherEx = function() {    if (!$gameParty.inBattle()) {        $gameScreen.changeWeatherX(this._params[0], this._params[1], this._params[2]);        if (this._params[3]) {            this.wait(this._params[2]);        }    }    return true;}; 
In RpgmakerMV you can change the weather manually via script call. 
For example you would do $gameScreen.setWeather("weather", power, duration);

The script call can also be found here: 
https://docs.google.com/spreadsheets/d/1-Oa0cRGpjC8L5JO8vdMwOaYMKO75dtfKDOetnvh7OHs/edit#gid=0
Of course, thanks a lot. 😀

Somehow recreating more effects isn't hard at all.

Original thread: https://forums.rpgmakerweb.com/threads/question-about-weather-class.51810/