Created
October 19, 2023 14:30
-
-
Save triacontane/118577fcf035a880aa0ba47d349624d3 to your computer and use it in GitHub Desktop.
天候に応じたスイッチの自動切り替え
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*: | |
* @plugindesc 天候に応じたスイッチの自動切り替え | |
* @author ChatGPT | |
* @target MZ | |
* | |
* @param Rain Switch | |
* @text 雨スイッチID | |
* @desc 雨のときにONになるスイッチのID | |
* @type switch | |
* @default 1 | |
* | |
* @param Storm Switch | |
* @text 嵐スイッチID | |
* @desc 嵐のときにONになるスイッチのID | |
* @type switch | |
* @default 2 | |
* | |
* @param Snow Switch | |
* @text 雪スイッチID | |
* @desc 雪のときにONになるスイッチのID | |
* @type switch | |
* @default 3 | |
* | |
* @help | |
* このプラグインを使うと、天候に応じてスイッチが自動で切り替わります。 | |
*/ | |
(() => { | |
const parameters = PluginManager.parameters('WeatherSwitch'); | |
const rainSwitch = Number(parameters['Rain Switch'] || 1); | |
const stormSwitch = Number(parameters['Storm Switch'] || 2); | |
const snowSwitch = Number(parameters['Snow Switch'] || 3); | |
const _Game_Screen_changeWeather = Game_Screen.prototype.changeWeather; | |
Game_Screen.prototype.changeWeather = function(type, power, duration) { | |
_Game_Screen_changeWeather.call(this, type, power, duration); | |
this.updateWeatherSwitch(type); | |
}; | |
Game_Screen.prototype.updateWeatherSwitch = function(weatherType) { | |
$gameSwitches.setValue(rainSwitch, false); | |
$gameSwitches.setValue(stormSwitch, false); | |
$gameSwitches.setValue(snowSwitch, false); | |
switch (weatherType) { | |
case 'rain': | |
$gameSwitches.setValue(rainSwitch, true); | |
break; | |
case 'storm': | |
$gameSwitches.setValue(stormSwitch, true); | |
break; | |
case 'snow': | |
$gameSwitches.setValue(snowSwitch, true); | |
break; | |
} | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ChatGPTと対話して作りました。
https://chat.openai.com/share/44f97175-d0af-4bae-906a-c919160f13e2