i gave some of my friends a test build of a game im working on and they found a bug with a plugin im using that creates another .json for common events that says 'ReferenceError $dataCommonEvents2 is not defined'
anyway to fix this error?
(im unsure how popular this plugin is so ill put a spoiler for the code here)
anyway to fix this error?
(im unsure how popular this plugin is so ill put a spoiler for the code here)
JavaScript:
/*:
@help
By using the following plugin command, I have been able to use the command event with the event command until now.
You can use it in the same way as when you called it.
If you want to call a newly created common event after chapters 1 and 3
in the plugin command
Enter the name of the common event with a space after call.
call the name of the common event
into the plugin command.
2. If you want to call the common event created in Chapter 2
in the plugin command
Enter the name of the common event with a space after call2.
call2 the name of the common event
into the plugin command.
*/
(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 = $dataCommonEvents2.length - 1; i > 0; --i) {
if ($dataCommonEvents2[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 = $dataCommonEvents2[this._commonEventsHash[args[0]]];
var eventId = this.isOnCurrentMap() ? this._eventId : 0;
this.setupChild(event.list, eventId);
}
if (command === 'call2' && 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);
}
};
})();