Skip to content

Instantly share code, notes, and snippets.

@elleonard
Last active October 12, 2022 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elleonard/3d8a29d60f2ac7ef90f5916fa6ddd457 to your computer and use it in GitHub Desktop.
Save elleonard/3d8a29d60f2ac7ef90f5916fa6ddd457 to your computer and use it in GitHub Desktop.
変数61, 62をセットしてコモンイベント1を呼ぶプラグインコマンドのサンプル
/*: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);
};
})();
@elleonard
Copy link
Author

2022/10/12
reserveCommonEvent では、イベント中に割り込んでコモンイベントを発生させられないため、
イベントコマンドのコモンイベント呼び出しと同じ処理に差し替え。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment