Maximum Call Stack Size Exceeded error

Hello,

I recently began using Yanfly's Animated Sideview Enemies, and it's a great plugin.

However, when an actor uses a certain skill, I get this error:

upload_2019-9-24_18-8-38.png


The skill's notebox is this:


Spoiler: Skill Notebox
<whole action>
motion sleep: user
if (user.isActor())
wait: 50

motion spell: user
if (user.isActor())
wait: 50


</whole action>

<target action>
action animation: target
action effect: target
death break
</target action>

And the enemy has only the <Breathing> tag in its notebox.

This simply didn't happen before I started mixing static (with the breathing effect) and animated (with animation sheets in the sv_actors folder) enemies. I used only the breathing effect before, but now that I'm using both styles of battler, this error occurs.

Does anyone know what could be happening here?

Thanks in advance for your help.
Wrong plugin order perhaps?
Wrong plugin order perhaps?

I didn't even think of that. I checked the order:

upload_2019-9-25_12-34-53.png


But it doesn't seem like anything's wrong, at least to my untrained eye. The only thing I could think about being a problem is the Side View Frames plugin, and it specifically states to put it directly under the animated enemies plugin.

I know you're the JavaScript master on this forum- if anyone knows, it's you.

Does anything look wrong?
This is the recommended order of Yanfly plugins.
After looking at the plugins though, I've seen that DreamX's plugin is indeed incompatible with Yanfly's SVEnemies plugin.
Maximum call stack size exceeded can either mean wrong plugin order or, more likely, plugin incompatibility. Luckily I know how to fix it.
Yanfly's SV plugin
Code:
Yanfly.SVE.Game_Enemy_performDamage = Game_Enemy.prototype.performDamage;
Game_Enemy.prototype.performDamage = function() {
   if (!this.hasSVBattler()) {
     return Yanfly.SVE.Game_Enemy_performDamage.call(this);
   }
   Game_Battler.prototype.performDamage.call(this);
   if (this.isSpriteVisible()) {
     this.requestMotion(this.damageMotion());
   } else {
     $gameScreen.startShake(5, 5, 10);
   }
   SoundManager.playEnemyDamage();
};

DreamX's plugin
Code:
Yanfly.SVE.Game_Enemy_performDamage = Game_Enemy.prototype.performDamage;
       Game_Enemy.prototype.performDamage = function () {
           if (!this.hasSVBattler()) {
               return Yanfly.SVE.Game_Enemy_performDamage.call(this);
           }
           Game_Battler.prototype.performDamage.call(this);
           if (this.isSpriteVisible()) {
               this.requestMotion(this.damageMotion());

               // new
               var frames = this.DXNumFrames();
               var frameSpeed = this.battler().motionSpeed();
               var waitTime = (frames * frameSpeed) - 12;
               if (waitTime > 0) {
                   BattleManager._logWindow._waitCount += waitTime;
               }

           } else {
               $gameScreen.startShake(5, 5, 10);
           }
           SoundManager.playEnemyDamage();
       };
They have one identical thing - Yanfly.SVE.Game_Enemy_performDamage. I suspect it was an oversight from DreamX, when he copy pasted the performDamage function.
Either way, since this has been defined 2 times, it will try to call itself perpetually. That's where the Maximum call stack size exceeded comes from.
This bug happens only when the enemy doesn't have an SV battler.
To fix it, take DreamX's plugin and replace all occurences of
Yanfly.SVE.
with
DreamX.SideviewFrames.

Since we're not clear whether we can share our edits or not, I will not do it. But js files are UTF-8 formatted text files that can be opened in any text editor.
This is the recommended order of Yanfly plugins.
After looking at the plugins though, I've seen that DreamX's plugin is indeed incompatible with Yanfly's SVEnemies plugin.
Maximum call stack size exceeded can either mean wrong plugin order or, more likely, plugin incompatibility. Luckily I know how to fix it.
Yanfly's SV plugin
Code:
Yanfly.SVE.Game_Enemy_performDamage = Game_Enemy.prototype.performDamage;
Game_Enemy.prototype.performDamage = function() {
   if (!this.hasSVBattler()) {
     return Yanfly.SVE.Game_Enemy_performDamage.call(this);
   }
   Game_Battler.prototype.performDamage.call(this);
   if (this.isSpriteVisible()) {
     this.requestMotion(this.damageMotion());
   } else {
     $gameScreen.startShake(5, 5, 10);
   }
   SoundManager.playEnemyDamage();
};

DreamX's plugin
Code:
Yanfly.SVE.Game_Enemy_performDamage = Game_Enemy.prototype.performDamage;
       Game_Enemy.prototype.performDamage = function () {
           if (!this.hasSVBattler()) {
               return Yanfly.SVE.Game_Enemy_performDamage.call(this);
           }
           Game_Battler.prototype.performDamage.call(this);
           if (this.isSpriteVisible()) {
               this.requestMotion(this.damageMotion());

               // new
               var frames = this.DXNumFrames();
               var frameSpeed = this.battler().motionSpeed();
               var waitTime = (frames * frameSpeed) - 12;
               if (waitTime > 0) {
                   BattleManager._logWindow._waitCount += waitTime;
               }

           } else {
               $gameScreen.startShake(5, 5, 10);
           }
           SoundManager.playEnemyDamage();
       };
They have one identical thing - Yanfly.SVE.Game_Enemy_performDamage. I suspect it was an oversight from DreamX, when he copy pasted the performDamage function.
Either way, since this has been defined 2 times, it will try to call itself perpetually. That's where the Maximum call stack size exceeded comes from.
This bug happens only when the enemy doesn't have an SV battler.
To fix it, take DreamX's plugin and replace all occurences of
Yanfly.SVE.
with
DreamX.SideviewFrames.

Since we're not clear whether we can share our edits or not, I will not do it. But js files are UTF-8 formatted text files that can be opened in any text editor.

Thanks, @Poryg - you're phenomenal! That worked perfectly.

I've added your name to my game's credits for your help. 🙂

Thank you again!

Original thread: https://forums.rpgmakerweb.com/threads/maximum-call-stack-size-exceeded-error.113625/