制作中の副産物ですが公開しておきます。
すでにあるかもしれないですね。
コード: 全て選択
/*:
@plugindesc コモンイベントを名前で呼び出します。
@author おのき
@help コモン番号の末尾から検索するので同名があれば後ろ優先で呼び出します。
一度呼び出すことでハッシュに登録して検索の手間を省いています。
プラグインコマンドから実行してください。
callのあとに半角スペースを入れてコモンイベント名を続けてください。
call コモンイベント名
間違いがあればご指摘ください。
可能であれば対応させていただきます。
*/
(function() {
'use strict';// 厳格モード
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.apply(this, arguments);
if (command === 'call' && args.length > 0) {
this._commonEventsHash = new Object();
if (!(args[0] in this._commonEventsHash)) {
for (var i = $dataCommonEvents.length - 1; i > 0; --i) {
if ($dataCommonEvents[i].name === args[0]) {
this._commonEventsHash[args[0]] = i;
break;
} else if (i === 1) {
throw new Error('The pluginCommand \"' + command + ' ' + args + '\" is invalid');
}
}
}
var event = $dataCommonEvents[this._commonEventsHash[args[0]]];
var eventId = this.isOnCurrentMap() ? this._eventId : 0;
this.setupChild(event.list, eventId);
}
};
})();