Animated Enemies MaxCall Error

I was testing out combat and got this error after the player attack:

Code:
RangeError: Maximum call stack size exceeded
    at Math.random (<anonymous>)
    at Object.Yanfly.Util.getRandomElement (YEP_X_AnimatedSVEnemies.js:2791)
    at Game_Enemy.svBattlerName (YEP_X_AnimatedSVEnemies.js:2083)
    at Game_Enemy.hasSVBattler (YEP_X_AnimatedSVEnemies.js:2088)
    at Game_Enemy.performDamage (YEP_X_AnimatedSVEnemies.js:2216)
    at Game_Enemy.performDamage (YEP_X_AnimatedSVEnemies.js:2217)
    at Game_Enemy.performDamage (YEP_X_AnimatedSVEnemies.js:2217)
    at Game_Enemy.performDamage (YEP_X_AnimatedSVEnemies.js:2217)
    at Game_Enemy.performDamage (YEP_X_AnimatedSVEnemies.js:2217)
    at Game_Enemy.performDamage (YEP_X_AnimatedSVEnemies.js:2217)
SceneManager.catchException @ Olivia_AntiPlayerStress.js:331

After asking people in various Discord server, the best answer I can at least understand somewhat is this
"Save the current (supposedly the original) perform damage function before rewriting it, because we're going use it instead of the new one if there's no SV battler"

Thing is at the line Yanfly.SVE.Game_Enemy_performDamage = Game_Enemy.prototype.performDamage; when it's supposed to store MV's original code for damage, it seems that instead it is storing itself.
Tinkering with the plugins, I found out that the cause seems to be with SRD_TimedAttackCore, but I don't know why.
Can anyone help me?

I dunno what your Discord people are talking about - that quoted line of code isn't "saving itself."

But, then, I also don't know what's going on with your plugin, because in my version 1.20 of SV Animated Enemies, there is no code on line 2217.

First step, always, is to double check the order of all your Yanfly plugins in your plugin manager against the order they're listed in on the Yanfly Engine Library Web site.

Then double check that you have the most recent versions - like I said, my copy doesn't even have any code on the repeated line from performDamage().

Tinkering with the plugins, I found out that the cause seems to be with SRD_TimedAttackCore
Does that mean that when you turn off that plugin the crash doesn't happen?

Then you need to try putting that plugin in a different place in your plugin manager and double check any notetags you have related to it - this error is most commonly a user mistake, wherein code in a notetag references itself and creates an infinite loop.
I dunno what your Discord people are talking about - that quoted line of code isn't "saving itself."

But, then, I also don't know what's going on with your plugin, because in my version 1.20 of SV Animated Enemies, there is no code on line 2217.

First step, always, is to double check the order of all your Yanfly plugins in your plugin manager against the order they're listed in on the Yanfly Engine Library Web site.

Then double check that you have the most recent versions - like I said, my copy doesn't even have any code on the repeated line from performDamage().


Does that mean that when you turn off that plugin the crash doesn't happen?

Then you need to try putting that plugin in a different place in your plugin manager and double check any notetags you have related to it - this error is most commonly a user mistake, wherein code in a notetag references itself and creates an infinite loop.
Okay, I check the plugin again, it looks like I haven't updated Animated Enemies to 1.20 like yours. It gave me a somewhat different error:
Code:
RangeError: Maximum call stack size exceeded
    at Math.random (<anonymous>)
    at Object.Yanfly.Util.getRandomElement (YEP_X_AnimatedSVEnemies.js:2791)
    at Game_Enemy.svBattlerName (YEP_X_AnimatedSVEnemies.js:2087)
    at Game_Enemy.hasSVBattler (YEP_X_AnimatedSVEnemies.js:2092)
    at Game_Enemy.performDamage (YEP_X_AnimatedSVEnemies.js:2220)
    at Game_Enemy.performDamage (YEP_X_AnimatedSVEnemies.js:2221)
    at Game_Enemy.performDamage (YEP_X_AnimatedSVEnemies.js:2221)
    at Game_Enemy.performDamage (YEP_X_AnimatedSVEnemies.js:2221)
    at Game_Enemy.performDamage (YEP_X_AnimatedSVEnemies.js:2221)
    at Game_Enemy.performDamage (YEP_X_AnimatedSVEnemies.js:2221)
SceneManager.catchException @ Olivia_AntiPlayerStress.js:331
Currently now I'm trying to re-shuffle the plugins again and checking my notetags
And in that case, you should check all of your Yanfly plugins to make sure they're the latest version.

If you bought the bundle on itch, re-download it to get the latest versions of everything.

Also check your project's code version. Open rpg_core.js and see what it says at the top - you want 1.6 or higher.

If any combinations of your plugins/code are at different versions from each other, it may cause unpredictable errors.

You can also do a search in your plugins folder for the text "prototype.performdamage" and see what files come up. That could be causing this error, if you have a combination of plugins that are actually legitimately calling this function in a loop.
OK, let's get to the basics.
They keay part of the error message is:
Maximum call stack size exceeded

The stack is more than adequate on modern computers, and that means there is only a single possibility how it could have been exceeded: and that is a recursive function call, a function that calls itself again and again.

How can this happen?
The most common cause is if a plugin is installed twice
less likely but possible is two plugins modifying the same function in a way that is incompatible or in the wrong order..
and even less likely than that is a damaged or buggy plugin.

I think you should post screenshots of your plugin manager so that we can compare and look for known incompatibilities
And in that case, you should check all of your Yanfly plugins to make sure they're the latest version.

If you bought the bundle on itch, re-download it to get the latest versions of everything.

Also check your project's code version. Open rpg_core.js and see what it says at the top - you want 1.6 or higher.

If any combinations of your plugins/code are at different versions from each other, it may cause unpredictable errors.

You can also do a search in your plugins folder for the text "prototype.performdamage" and see what files come up. That could be causing this error, if you have a combination of plugins that are actually legitimately calling this function in a loop.
rpg_core.js v1.6.2, that's the version it says.
@ATT_Turan How do I search my plugin folder for the text "prototype.performdamage"? Do I have to search it in the folder's searchbar or do I have to open every Yanfly .js files in notepad+ and search using it's 'find' feature.
@Andar I've sent below my plugin list and the list of every plugins I have in my folder
I've sent below my plugin list and the list of every plugins I have in my folder
That is NOT what we asked for, because the file list does not tell us the order or the plugins in the plugin manager.

we wanted a screenshot of the main plugin manager window in the editor of your project, not a screenshot of your file list.
Depending on your version of Windows, you can type it into the search bar (it tends to not work correctly in Windows 11).

But if you have Notepad++, that has functionality to search in a directory built in, you don't need to open every file.

However, I'm not sure what Notepad+ is, I'm assuming it was a typo.
That is NOT what we asked for, because the file list does not tell us the order or the plugins in the plugin manager.

we wanted a screenshot of the main plugin manager window in the editor of your project, not a screenshot of your file list.
Sorry, had quite the day so I'm multi-tasking.
Depending on your version of Windows, you can type it into the search bar (it tends to not work correctly in Windows 11).

But if you have Notepad++, that has functionality to search in a directory built in, you don't need to open every file.

However, I'm not sure what Notepad+ is, I'm assuming it was a typo.
Yes, I was referring to Notepad++ but I'm unfamiliar with how to use the directory. I tried using the find function before (The one with the binocular symbol). Could you send some images instruction on how to search for it?
Could you send some images instruction on how to search for it?
No. I don't have sufficient interest in your problem to both be here in your thread offering suggestions and making pictorial tutorials on Notepad++ for you. 😛

It's literally on the Find screen that comes up, and if you can't see that/figure it out, Notepad++ has instructions and I'm sure there are articles or videos on it if you Google it.

I apologize if that comes across as mean, but if you're going to try to create an entire video game by yourself, you have to get used to a degree of self-motivation and independent learning.

You never answered the question about whether the error goes away if you turn off or reposition the Timed Attack plugin. Have you done any basic troubleshooting, like turn off all but the required plugins, see if it works? Then turn plugins back on one at a time?

You can ask for help, but also help yourself.
No. I don't have sufficient interest in your problem to both be here in your thread offering suggestions and making pictorial tutorials on Notepad++ for you. 😛

It's literally on the Find screen that comes up, and if you can't see that/figure it out, Notepad++ has instructions and I'm sure there are articles or videos on it if you Google it.

I apologize if that comes across as mean, but if you're going to try to create an entire video game by yourself, you have to get used to a degree of self-motivation and independent learning.

You never answered the question about whether the error goes away if you turn off or reposition the Timed Attack plugin. Have you done any basic troubleshooting, like turn off all but the required plugins, see if it works? Then turn plugins back on one at a time?

You can ask for help, but also help yourself.
Code:
Search "prototype.performdamage" (13 hits in 4 files of 92 searched)
  D:\SMG4 Is tired of making memes and decided to take a vacation\SMG4 RPG Ver Non-Sideview\NonSideview-RPG\js\plugins\DreamX_SideViewFrames.js (3 hits)
    Line 480:         Yanfly.SVE.Game_Enemy_performDamage = Game_Enemy.prototype.performDamage;
    Line 481:         Game_Enemy.prototype.performDamage = function () {
    Line 485:             Game_Battler.prototype.performDamage.call(this);
  D:\SMG4 Is tired of making memes and decided to take a vacation\SMG4 RPG Ver Non-Sideview\NonSideview-RPG\js\plugins\KELYEP_DragonBones.js (2 hits)
    Line 1323: Game_Enemy.prototype.performDamage = function() {
    Line 1324:   Game_Battler.prototype.performDamage.call(this);
  D:\SMG4 Is tired of making memes and decided to take a vacation\SMG4 RPG Ver Non-Sideview\NonSideview-RPG\js\plugins\YEP_BattleEngineCore.js (5 hits)
    Line 3837:   Game_Battler.prototype.performDamage;
    Line 3838: Game_Battler.prototype.performDamage = function() {
    Line 4434: Yanfly.BEC.Game_Enemy_performDamage = Game_Enemy.prototype.performDamage;
    Line 4435: Game_Enemy.prototype.performDamage = function() {
    Line 4437:       Game_Battler.prototype.performDamage.call(this);
  D:\SMG4 Is tired of making memes and decided to take a vacation\SMG4 RPG Ver Non-Sideview\NonSideview-RPG\js\plugins\YEP_X_AnimatedSVEnemies.js (3 hits)
    Line 2218: Yanfly.SVE.Game_Enemy_performDamage = Game_Enemy.prototype.performDamage;
    Line 2219: Game_Enemy.prototype.performDamage = function() {
    Line 2223:     Game_Battler.prototype.performDamage.call(this);
Right, sorry. I did do some basic troubleshooting. Disabling all the plugins and finding out which ones cause the error.

I disable the entire Timed Attack plugins down to their sub-plugins. After that the error is gone. So I tried to enable that particular plugin starting with it's core and immediately greeted by the error again.
What you see above is the list of every plugins with the "prototype.performdamage". Oddly enough, TimedAttackCore doesn't appeared here since I though it was caused by it.
The DreamX shouldn't be causing a problem, placed under SV Enemies.

The Dragonbones could be causing issues because it doesn't alias the original code at all. You're using both Dragonbones and SV enemies in your project? I don't think they're really intended to go together. Dragonbones flat out overwrites code from SV enemies.
The DreamX shouldn't be causing a problem, placed under SV Enemies.

The Dragonbones could be causing issues because it doesn't alias the original code at all. You're using both Dragonbones and SV enemies in your project? I don't think they're really intended to go together. Dragonbones flat out overwrites code from SV enemies.
No, that was recently added during me trying to update all my plugins, I didn't turn it on or add it in the Plugin Manager.
Well if it appears to be a conflict between the Timed Attack and the rest of your stuff, reverse engineer it.

Turn off everything except the SRD timed attack stuff, see if it functions properly. If not, then it's a problem with your setup of those plugins.

If yes, then figure out which Yanfly/other plugin causes the conflict when it gets activated, and that'll tell you what specifically to look at.
1) I'm not sure but some of your yanfly battle plugins might be in the wrong order - and the coreupdater should definately not be under the battleengine.
Please check against yanfly's main list and reorder them where needed.
Attention: reordering plugins will make the old savefiles incompatible.

2) it is not a direct problem but can cause problems later, especially after deployment:
MV creates HTML5-based games, and all browsers have problems with spaces in their filenames.
You should move the project to a simpler folder than the one reveraled in your text search output...
Well if it appears to be a conflict between the Timed Attack and the rest of your stuff, reverse engineer it.

Turn off everything except the SRD timed attack stuff, see if it functions properly. If not, then it's a problem with your setup of those plugins.

If yes, then figure out which Yanfly/other plugin causes the conflict when it gets activated, and that'll tell you what specifically to look at.
Okay, after turning off everything except SRD, the error appeared when I enabled DreamX's SideviewFrames (I double checked turning it on and off again to be certain), specifically whenever I attack a certain enemy with the note tag:

<GIF:Troompa>, This call uses the Plugin PKD_VPlayer that allows player to use .gif files to be used if they're converted to .webm

1) I'm not sure but some of your yanfly battle plugins might be in the wrong order - and the coreupdater should definately not be under the battleengine.
Please check against yanfly's main list and reorder them where needed.
Attention: reordering plugins will make the old savefiles incompatible.

2) it is not a direct problem but can cause problems later, especially after deployment:
MV creates HTML5-based games, and all browsers have problems with spaces in their filenames.
You should move the project to a simpler folder than the one reveraled in your text search output...
Alright, it's a bit long way from deployment. Do I move it directly into D: or do I need to make an empty folder with an underscore in it?

Like for example


D:\SMG4 Is tired of making memes and decided to take a vacation\SMG4 RPG Ver Non-Sideview\NonSideview-RPG
This is where I put it now right? Should I make a folder that's outside "D:\SMG4 Is tired of making memes and decided to take a vacation" with no spaces?


Also, below is my current plugin setup, moving the coreupdate below core and DreamX's to try and find the right setup. So far the error still persist.
Also sorry about the late respond.
after turning off everything except SRD, the error appeared when I enabled DreamX's SideviewFrames...specifically whenever I attack a certain enemy with the note tag: <GIF:Troompa>
So you're saying even with the Sideview Frames, if you have the PKD plugin off, it works?

Did you then turn everything except the PKD back on? Does it all work if you don't use that plugin?

I don't really understand your description of the point of that plugin...RPG Maker can play webm files, so if you convert a GIF to webm you can play it without a plugin.
So you're saying even with the Sideview Frames, if you have the PKD plugin off, it works?

Did you then turn everything except the PKD back on? Does it all work if you don't use that plugin?

I don't really understand your description of the point of that plugin...RPG Maker can play webm files, so if you convert a GIF to webm you can play it without a plugin.
What I meant is, the error is still there when PKD is turned off. I was turning on each plugin, one by one, each without the error appearing. The error appeared when I turned on Sideview Frames (PKD is still turned off while I'm doing this.)

I used the PKD Plugins to give enemies a looping animation in their battle sprites. The link below is where I got the plugin:
with no spaces
this is the key - it doesn't really matter where you store tha files or how many folders deep as long as no foldername contains spaces.
That is basically going back to pre-windows when you typed commands into your keyboard and space was the seperator that blocked and divided argument parts of the line. That functionality is too deep into the structures handling the internet to be ever replaced, all overrides that pretend to dallow spaces have their own problems.
Is this better?
D:\RPG_PROJECT\SMG4_RPG_Ver_Non-Sideview\NonSideview-RPG

Original thread: https://forums.rpgmakerweb.com/threads/animated-enemies-maxcall-error.162622/