//=============================================================================
// CallCommonEventByName.js
//=============================================================================
// Copyright (c) 2015 Mokusei Penguin
// Released under the MIT license
// http://opensource.org/licenses/mit-license.php
//=============================================================================
/*:
* @plugindesc 【MPP ver.1.1】 Plugin command that calls Common Event by name.
* @author Mokusei Penguin
*
* @help Use "Plugin Command" to call the name of a common event
* 『Plugin Command』
* Ex- CallCommon arg1
* Calls the common event named arg1
*
* ※ About CallCommon
*
* Since it's called by Common Event name, there's no need to modify even if the ID changes.
*
* If there are multiple common events with the same names, the most recent will be called.
* (This includes deleting the previous event,
* If you create a new common event of the same name, you can overwrite it.)
*
* ================================
* Author : Mokusei Penguin
* URL : http://woodpenguin.blog.fc2.com/
*/
(function() {
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'CallCommon' && args.length > 0) {
for (var i = $dataCommonEvents.length - 1; i > 0; i--) {
var event = $dataCommonEvents[i];
if (event.name === args[0]) {
var eventId = this.isOnCurrentMap() ? this._eventId : 0;
this.setupChild(event.list, eventId);
break;
}
}
}
};
})();