Yanfly BattleEngineCore ("TypeError: Cannot read property of 'scope' of null")

Still need help resolving this.


This error only seems to show up whenever the party is defeated, but the enemy has another move to make - like, if the enemy can do 2 attacks during its turn, but kills the party on the first attack. The error shows up while the damage pop-up from the first attack is still showing, so before the next attack is even initiated. This error prevents the Game Over message and screen to appear.


TypeError
Cannot read property of 'scope' of null


This error occurs with only the Yanfly BattleEngineCore enabled.
Does it also happen in a new project without external plugins?
Does it also happen in a new project without external plugins?



Then, it doesn't.
So the problem is probably one of your plugins.
It could be something the author themselves didn't notice, or it could be caused by an update on the maker after the release of the plugin.
What makes an enemy attack twice in the same turn?


You could do something that remove all enemies actions whenever the whole party is defeated or make the actors immortal until the next turn but visually it might not be what you want.
So the problem is probably one of your plugins.
It could be something the author themselves didn't notice, or it could be caused by an update on the maker after the release of the plugin.



So I should go down the list of plugins until I find out which one causes it?
What makes an enemy attack twice in the same turn?


You could do something that remove all enemies actions whenever the whole party is defeated or make the actors immortal until the next turn but visually it might not be what you want.



I use common events that forces them to do another action. I already tried doing something that calls the Game Over screen when all party members are defeated in the common event that the attack of the enemy uses, but I still get the error.
It is probably doable to avoid this error by changing your common events by putting variables that if all party members are dead do nothing else force action.


I'm guessing it's Yanfly Target Core that causes the error, getting an edit will be next to impossible and Yanfly will not consider that a bug(let's not get into that...).


Of course, you can always spend money but it could leads to other bugs.


Try some things and if you want me to take a look you can screenshot me your CE and I'll try to make something for you.
It is probably doable to avoid this error by changing your common events by putting variables that if all party members are dead do nothing else force action.


I'm guessing it's Yanfly Target Core that causes the error, getting an edit will be next to impossible and Yanfly will not consider that a bug(let's not get into that...).


Of course, you can always spend money but it could leads to other bugs.


Try some things and if you want me to take a look you can screenshot me your CE and I'll try to make something for you.



I just went through my plugins, and I found I can keep everything on, except Yanfly's BattleEngineCore to keep the error from happening. Keeping the BattleEngineCore on, but the plugins that require it off, doesn't make it go away, so it's definitely the BattleEngineCore.


I shortened the common event that's called upon use of the skill to show the part where it forces another attack. At the top of the event, it calls for the Game Over check, which I made to check if all the party members are dead, and if so, to call the Game Over screen.


The conditional branch basically does this: the enemy always attacks at least 3 times in a row, and after that its changes of attacking again that same turn grow smaller.


RPG_Attack.png
The force actions still happen even with the gameover inside the Game Over check CE?


If so, l would try to put inside the gameover check CE a switch on if the game over should occur, conditional branch:


At the beginning on your main CE with all the force actions inside,      If switch ON: jump to label abc


At the very end, on that same CE, put the label abc. gameover should occur automatically without you needing to put it there.


If the error still occur, it must be because of some other force action somewhere.
Never mind, it worked because he ran out of attacks. It's still happening. I checked, and the error screen occurs while the damage pop-up is still visible, so before the next attack is even initiated.
Yanfly will not consider that a bug(let's not get into that...).

I disagree, let us get into that.


Because it was confirmed it is caused by one of his plugins, even if not Target Core, and he apparently uses no plugin to do it, just eventing, so it is a but. If he can reproduce it in a new project with just the plugin causing the problem and the required ones for said one, why would Yanfly not consider it a bug?
I disagree, let us get into that.


Because it was confirmed it is caused by one of his plugins, even if not Target Core, and he apparently uses no plugin to do it, just eventing, so it is a but. If he can reproduce it in a new project with just the plugin causing the problem and the required ones for said one, why would Yanfly not consider it a bug?



Yeah, I just tried it in a completely new project, with only the BattleEngineCore plugin, and I get the same error when the enemy is made to do another attack after the party is wiped.
I've moved this thread to Plug-In Support. Please be sure to post your threads in the correct forum next time. Thank you.
Still need help resolving this.
I've gotten an error message similar to that before.  It means that the variable 'scope' is supposed to find an array that either doesn't exist or isn't an array.  I think the problem is that you're attempting to do something in the common event that can't be done during the attack.  The attack may work better if you did something with Yanfly's Skill Core.  An attack like this can probably be done with Lunatic Mode, maybe in combination with action sequences and a well-built loop...maybe?  I'm thinking for the loop, create a var right before it that increases after each attack in the loop, then when the check fails, break out.  This can replace the common event so that the error won't occur.
@shockra, if it needs to be done with Lunatic Mode, I*m going to need help with it, as I'm not familiar with how writing code works. Is there no way to force-stop the common event from running when all party members are dead?

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-battleenginecore-typeerror-cannot-read-property-of-scope-of-null.70036/