OcRam - Weather System (MZ/MV)

Works like a charm!

Thanks and good job!
Hi! Any way to activate a switch when starts to rain? Or something like that.
I want some states to be applied.

Thanks!
Hi! Any way to activate a switch when starts to rain? Or something like that.
I want some states to be applied.

Thanks!
Thank you for the message,

Something like that would be "Weather Variable" plugin parameter. If it's defined that variable returns current weather id. In your case -1 = "Rain" (if you ment that built-in core rain weather).

Also it's possible to retrieve weather id via JS: $gameVariables.value(my_weather_var_id)

In MZ only: If you have some JS knowledge you can extend OcRam.Weather_System.onNewWeather and do what ever you like (set switches and much more).

(All OcRam MZ -plugins are RETRO'able to MV)
Thank you for the message,

Something like that would be "Weather Variable" plugin parameter. If it's defined that variable returns current weather id. In your case -1 = "Rain" (if you ment that built-in core rain weather).

Also it's possible to retrieve weather id via JS: $gameVariables.value(my_weather_var_id)

In MZ only: If you have some JS knowledge you can extend OcRam.Weather_System.onNewWeather and do what ever you like (set switches and much more).

(All OcRam MZ -plugins are RETRO'able to MV)
Love it!
So, if I set something like:
Code:
if (OcRam.Weather_System.onNewWeather) {
if ($gameVariables.value(my_weather_var_id) === -1) {
set switch 100 ON;
}
}

I'd get what I want right?
Love it!
So, if I set something like:
Code:
if (OcRam.Weather_System.onNewWeather) {
if ($gameVariables.value(my_weather_var_id) === -1) {
set switch 100 ON;
}
}

I'd get what I want right?
If you want to extend JS function/method it's done in JS file after extendable method. In this case I'd create new plugin file.

So create "My_Weather_EX.js" file in your plugins folder. Edit it and write (copy/paste) code below:
JavaScript:
/*:
 * @target MZ
 * @plugindesc My weather extensions...
 * @author Me
 * @url https://mywebsite.com
 * @base OcRam_Weather_System
 * @
 *
 * @param Rain Switch Id
 * @type switch
 * @desc Rain switch to toggle
 * @default 0
 *
 * @help
 * My weather extensions...
 */

(function (parameters) { // Let's not pollute global name space...
    // Get our rain switch id, which we can adjust in plugin manager
    const _rainSwitchId = Number(parameters("Rain Switch Id") || 0);
    // Get weather variable id from OcRam_Weather_System
    const _weatherVarId = OcRam.Weather_System.parameters["Weather Variable"];
    const _OcRam_Weather_System_onNewWeather = OcRam.Weather_System.onNewWeather;
    OcRam.Weather_System.onNewWeather = function () {
        _OcRam_Weather_System_onNewWeather.call(this); // Important to call previously added stuff!
        if ($gameVariables.value(_weatherVarId) === -1) {
            $gameSwitches.setValue(_rainSwitchId, true);
        } else {
            $gameSwitches.setValue(_rainSwitchId, false);
        } console.log($gameVariables.value(_weatherVarId)); // Just prints weather variable to console (F12 in-game)...
    };
})(PluginManager.parameters("My_Weather_EX"));
// Anonymous function wrap up and pass plugin parameters.

Spoiler: My_Weather_EX in plugin manager
my_weather_ex.png

Just remember to set "Rain Switch Id" 🙂

That code also ensures it's imported/installed AFTER OcRam_Weather_System. Please let me know if this was working solution for you.
If you want to extend JS function/method it's done in JS file after extendable method. In this case I'd create new plugin file.

So create "My_Weather_EX.js" file in your plugins folder. Edit it and write (copy/paste) code below:
JavaScript:
/*:
 * @target MZ
 * @plugindesc My weather extensions...
 * @author Me
 * @url https://mywebsite.com
 * @base OcRam_Weather_System
 * @
 *
 * @param Rain Switch Id
 * @type switch
 * @desc Rain switch to toggle
 * @default 0
 *
 * @help
 * My weather extensions...
 */

(function (parameters) { // Let's not pollute global name space...
    // Get our rain switch id, which we can adjust in plugin manager
    const _rainSwitchId = Number(parameters("Rain Switch Id") || 0);
    // Get weather variable id from OcRam_Weather_System
    const _weatherVarId = OcRam.Weather_System.parameters["Weather Variable"];
    const _OcRam_Weather_System_onNewWeather = OcRam.Weather_System.onNewWeather;
    OcRam.Weather_System.onNewWeather = function () {
        _OcRam_Weather_System_onNewWeather.call(this); // Important to call previously added stuff!
        if ($gameVariables.value(_weatherVarId) === -1) {
            $gameSwitches.setValue(_rainSwitchId, true);
        } else {
            $gameSwitches.setValue(_rainSwitchId, false);
        } console.log($gameVariables.value(_weatherVarId)); // Just prints weather variable to console (F12 in-game)...
    };
})(PluginManager.parameters("My_Weather_EX"));
// Anonymous function wrap up and pass plugin parameters.

Spoiler: My_Weather_EX in plugin manager

Just remember to set "Rain Switch Id" 🙂

That code also ensures it's imported/installed AFTER OcRam_Weather_System. Please let me know if this was working solution for you.
It says here parameters is not a function!
It says here parameters is not a function!
Yup. I am so sorry for not testing this (over confidence lol).

For my defense I've done all the week VB.NET where array items are in parenthesis arr(i) 😀

So the line "const _rainSwitchId = Number(parameters("Rain Switch Id") || 0)" was invalid...

Tested and working code below:
JavaScript:
/*:
 * @target MZ
 * @plugindesc My weather extensions...
 * @author Me
 * @url https://mywebsite.com
 * @base OcRam_Weather_System
 * @
 *
 * @param Rain Switch Id
 * @type switch
 * @desc Rain switch to toggle
 * @default 0
 *
 * @help
 * My weather extensions...
 */

(function (parameters) { // Let's not pollute global name space...
    // Get our rain switch id, which we can adjust in plugin manager
    const _rainSwitchId = Number(parameters["Rain Switch Id"] || 0);
    // Get weather variable id from OcRam_Weather_System
    const _weatherVarId = OcRam.Weather_System.parameters["Weather Variable"];
    const _OcRam_Weather_System_onNewWeather = OcRam.Weather_System.onNewWeather;
    OcRam.Weather_System.onNewWeather = function () {
        _OcRam_Weather_System_onNewWeather.call(this); // Important to call previously added stuff!
        if ($gameVariables.value(_weatherVarId) === -1) {
            $gameSwitches.setValue(_rainSwitchId, true);
        } else {
            $gameSwitches.setValue(_rainSwitchId, false);
        } console.log($gameVariables.value(_weatherVarId)); // Just prints weather variable to console (F12 in-game)...
    };
})(PluginManager.parameters("My_Weather_EX"));
// Anonymous function wrap up and pass plugin parameters.
Any ways to add the Weather Volume option to VisuStella Option's Core menu?

Thanks
@OcRam Hey.
Any clues on why I get this error when I try to load a file from a save on MZ?
I have just saved and re-entered the game, no changes whatsoever.
1668625142288.png
@OcRam Hey.
Any clues on why I get this error when I try to load a file from a save on MZ?
I have just saved and re-entered the game, no changes whatsoever.
View attachment 245271
Thank you for the message,

Are you using latest version? And please remember to update all OcRam -plugins at the same time.
Thank you for the message,

Are you using latest version? And please remember to update all OcRam -plugins at the same time.
Yes I have updated all of the ones I am using!

- It didn't happen before the update though.

---It only happens on tagged <indoors> maps. if I save outside, it will be ok. clue?
Yes I have updated all of the ones I am using!

- It didn't happen before the update though.

---It only happens on tagged <indoors> maps. if I save outside, it will be ok. clue?
Thank you for the report,

I will take a look at this. Every piece of information can be clue.
Yes I have updated all of the ones I am using!

- It didn't happen before the update though.

---It only happens on tagged <indoors> maps. if I save outside, it will be ok. clue?
I have now hotfixed OcRam_Weather_System (v1.09) and it's downloadable from https://ocram-codes.net

Thanks again for letting me know this!
I have now hotfixed OcRam_Weather_System (v1.09) and it's downloadable from https://ocram-codes.net

Thanks again for letting me know this!
Good job, Ocram!
hi I want to ask how you changing the weather in the game like this
instead of changing the map/tileset
what scripts should I write and where should I put it
hi I want to ask how you changing the weather in the game like this
instead of changing the map/tileset
what scripts should I write and where should I put it

Thank you for the message,

Best way to learn this and a lot of other stuff, is to download OcRam -demo project from: https://ocram-codes.net
Sorry, no matter at all, the mistake was my fault.
I dont know hot to erase 🙂
Hello, I get an error when I use both of the Time System plugins (for MV) and the OcRam - Weather_EX plugin (for MV) at the same time. The error happens when I go to the menu.
Hello, I get an error when I use both of the Time System plugins (for MV) and the OcRam - Weather_EX plugin (for MV) at the same time. The error happens when I go to the menu.
I saw your error pic in my inbox.

Have setup weather variable id? This error comes if you show weather in menu, but Weather system has no correct weather variable id. Or weather variable contains invalid value (tampered outside weather system).
Heyyy

First of all, love this plugin, so thank you.

I'm trying to config a custom weather system using plugin commands from Visustella's weather plugin, but I have literally no coding experience and so far I only managed to make it work partially.

Would it be possible to trigger a common event instead of a plugin command? Or in addition to it. That would allow me to create a common event with the plugin command I want to use as a weather effect. It would make it so much easier to configure. Thanks in advance.

EDIT: I can pay of course, if needed.


Sorry wrong topic, I can't seem to find the option to delete the post.

Original thread: https://forums.rpgmakerweb.com/threads/ocram-weather-system-mz-mv.89721/