Battle Test error whenever attempt to change equipment

I've been trying to set up a battle in which the player character's equipment changes. What happens as soon as the battle reaches the change equipment event in Battle Test mode, is that I get this error in the console):
TypeError: Cannot read property 'forEach' of undefined
at Game_Player.makeEncounterTroopId (rpg_objects.js:7575)
at Game_Player.executeEncounter (rpg_objects.js:7601)
at Scene_Map.updateEncounter (rpg_scenes.js:768)
at Scene_Map.updateScene (rpg_scenes.js:716)
at Scene_Map.update (rpg_scenes.js:591)
at Function.SceneManager.updateScene (rpg_managers.js:2024)
at Function.SceneManager.updateMain (rpg_managers.js:1983)
at Function.SceneManager.update (rpg_managers.js:1907)

In normal gameplay tests, it just makes the battle end automatically.

I can't replicate the error in a clean test so far, and without too much knowhow of the RPG Maker code or javascript, I'm not even sure where to start to look for the issue.

Does anyone know what I might have messed up to cause this kind of error?
Does anyone know what I might have messed up to cause this kind of error?
one of the first things to show would be the event you were using. especially since the trace is coming from the map scene and is seemingly trying to start an encounter, but you said this is during a battle test
This is the event that I'm using to test. The second event page is empty for testing purposes. On a clean save it works just fine.

Equipment Change error.png


However, I actually think I found the start of the issue. I have been using the Visual Equipment mod made by Rexal. I had thought it was turned off when I did my testing, but after a little more fiddling around, it turns out that's the culprit.

It's really unfortunate, because I was hoping to be using that plugin's functionality actively in battle.
in Battle Test mode,
that could be the problem.

as soon as plugins are used, the database battletest becomes unreliable.

please make a true battleprocessing event on your starter map and test in playtes with new game.

The problem is that the database battletest skips part of the regular game initialisation to get to the battle faster, but there are a number of plugins that require those "new game" initialisations in order to work correctly.
ONLY if the regular battle in a new game has the same error, then we can look for the cause.
As in my first post, I did run a true battle event on my starter map. The game automatically left the battle and returned to the map without throwing any errors, but there wasn't any event that would've left the battle in my battle events.

Alright, so, with some help from a friend, I managed to find a simple fix, but I honestly don't know if it'll cause more problems.

In line 219 of Rexal's Visual Equipment, all I had to do is modify the line like so:
JavaScript:
if(!(SceneManager._scene instanceof Scene_Battle)) SceneManager.goto(Scene_Map);


especially since the trace is coming from the map scene
This above hint was exactly the issue. The plugin was trying to return to the map scene whenever Change Equipment was called, which both caused a crash for the Battle Test, and immediately ended the battle in a normal playtest. For some reason, wrapping it in a check for whether it's a battle solves this issue completely, and even lets me see visual effects in battle without any other work. (Meanwhile, it causes the plugin to stop functioning if I remove the line completely)

Original thread: https://forums.rpgmakerweb.com/threads/battle-test-error-whenever-attempt-to-change-equipment.172224/