Last active
October 12, 2022 14:01
-
-
Save elleonard/3d8a29d60f2ac7ef90f5916fa6ddd457 to your computer and use it in GitHub Desktop.
変数61, 62をセットしてコモンイベント1を呼ぶプラグインコマンドのサンプル
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
/*:ja | |
* @plugindesc 変数61,62をセットしてコモンイベント1を呼ぶプラグインコマンド | |
* | |
* @target MV | |
* @help | |
* プラグインコマンド callCommon1WithVariable6162 を定義する | |
* | |
* 呼び出し例: 変数61に1, 変数62に2を代入した上でコモンイベント1を呼び出す | |
* callCommon1WithVariable6162 1 2 | |
*/ | |
(() => { | |
'use strict'; | |
const PLUGIN_COMMAND_NAME = 'callCommon1WithVariable6162'; | |
const COMMON_EVENT_ID = 1; | |
const _pluginCommand = Game_Interpreter.prototype.pluginCommand; | |
Game_Interpreter.prototype.pluginCommand = function (command, args) { | |
if (command === PLUGIN_COMMAND_NAME) { | |
const variable61 = Number(args[0]); | |
const variable62 = Number(args[1]); | |
$gameVariables.setValue(61, variable61); | |
$gameVariables.setValue(62, variable62); | |
const commonEvent = $dataCommonEvents[COMMON_EVENT_ID]; | |
if (commonEvent) { | |
const eventId = this.isOnCurrentMap() ? this._eventId : 0; | |
this.setupChild(commonEvent.list, eventId); | |
} | |
return; | |
} | |
_pluginCommand.call(this, command, args); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
2022/10/12
reserveCommonEvent
では、イベント中に割り込んでコモンイベントを発生させられないため、イベントコマンドのコモンイベント呼び出しと同じ処理に差し替え。