Works like a charm!
Thanks and good job!
Thanks and good job!
Thank you for the message,
Love it!
if (OcRam.Weather_System.onNewWeather) {
if ($gameVariables.value(my_weather_var_id) === -1) {
set switch 100 ON;
}
}
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.
/*:
* @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.
It says here parameters is not a function!
Yup. I am so sorry for not testing this (over confidence lol).
/*:
* @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.
Thank you for the message,
Yes I have updated all of the ones I am using!
Thank you for the report,
I have now hotfixed OcRam_Weather_System (v1.09) and it's downloadable from https://ocram-codes.net
Good job, Ocram!
I saw your error pic in my inbox.
Original thread: https://forums.rpgmakerweb.com/threads/ocram-weather-system-mz-mv.89721/