Code:
Game_Interpreter.prototype.checkOverflow = function() {
if (this._depth >= 100) {
throw new Error('Common event calls exceeded the limit');
}
};
Code:
Game_Player.prototype.updateParams = function() {
var index=null;
var despairEnd=false;
var insanityEnd=false;
var hungerEnd=false;
if ($gameUnit.deadMembers().length > 0) {
$gameSwitches.setValue(Tamamo.Params.SoulSwitch, true);
}
HungerTimer+=1;
if(HungerTimer===3600){
HungerTimer=0;
}
for (var i = 0; i < 4; i++) {
actor = $gameParty.actors[i].actorId;
//hungertimer
if(HungerTimer===0){
$gameParty.actors[i].gainMp(-1);
var shorthand =index+Tamamo.Params.HungerVariable;
if($gameParty.actors[i].mp===0){
$gameVariables.setValue($gameVariables.value(shorthand)+1);
$gameParty.actors[i].gainMp($gameParty.actors[i].mmp);
}
}
//dead ends
//despair
if($gameVariables.value(index+Tamamo.Params.DespairVariable)===1000) {
despairEnd=true;
}
//insanity
else if($gameVariables.value(index+Tamamo.Params.InsanityVariable)===1000) {
insanityEnd=true;
}
//hunger
else if($gameVariables.value(index+Tamamo.Params.HungerVariable)===4) {
hungerEnd=true;
}
}
if (despairEnd) $gameSwitches.setValue(Tamamo.Params.DespairSwitch, true);
if (insanityEnd) $gameSwitches.setValue(Tamamo.Params.InsanitySwitch, true);
if (hungerEnd) $gameSwitches.setValue(Tamamo.Params.HungerSwitch, true);
}
Basically I want to prevent any of these four common events from being called until one finishes. Do to the per frame basis. They would wind up stacking. And exceed the 100 limit. 60 frames = 1 second. So give it 4 seconds. And boom it explodes if enough of the conditions are met each frame that it runs. The function is called in Game_Player.update() btw.
Basically they have a limit of one. leaving space for the other common events the game might need.
How can I do this?
edit: updated the code with the correct way of doing it.
Last edited:
