(function () {
Game_System.prototype.commonEventData = function() {
return this._commonEventData || [];
};
Game_System.prototype.addEventData = function(id) {
this._commonEventData = this._commonEventData || [];
this._commonEventData.push(id);
};
var new_levelUp = Game_Actor.prototype.levelUp;
Game_Actor.prototype.levelUp = function() {
new_levelUp.call(this);
if (this._actorId < 5) $gameSystem.addEventData(this._actorId);
};
Game_Interpreter.prototype.setupReservedCommonEvent = function() {
if ($gameTemp.isCommonEventReserved()) {
this.setup($gameTemp.reservedCommonEvent().list);
$gameTemp.clearCommonEvent();
return true;
} else {
//--------------------------------------------------------
if (!this.isRunning()) {
if ($gameSystem.commonEventData().length > 0){
var evId = $gameSystem.commonEventData().shift();
$gameTemp.reserveCommonEvent(evId);
}
}
//--------------------------------------------------------
return false;
}
};
}())();