RPG Maker Forums

Code:
Game_Interpreter.prototype.checkOverflow = function() {
    if (this._depth >= 100) {
        throw new Error('Common event calls exceeded the limit');
    }
};
So this is how I have my function set up.
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);
}
This function is called every frame and manages permadeath conditions for characters. However the common events are all Called with switches. four total.
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.

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,035
Messages
1,018,454
Members
137,821
Latest member
Capterson
Top