YEP Battle Engine - 'targets.slice is not a function'

While test playing battles in my game I've been getting the 'targets.slice is not a function' error message whenever an actor enters a specific state (it essentially just makes the actor attack an enemy at random). I haven't made any big changes to plugins recently so I'm not sure what the issue is here - the state's been working fine up until recently. The problem seems to be specifically the 'attack an enemy' restriction, because when I set the state restriction to 'none' it works fine?

I've attached the error messages and my plugin list in case it helps. Thanks for any help in advance.
Show us where you use target.slice and the other thing you use slice() method on object (target) and that's why you get error.

slice() is used to get a fragment of array and return it as new array:

Code:
const animals = ['ant', 'bison', 'camel', 'duck', 'elephant'];

console.log(animals.slice(2));
// expected output: Array ["camel", "duck", "elephant"]

console.log(animals.slice(2, 4));
// expected output: Array ["camel", "duck"]

console.log(animals.slice(1, 5));
// expected output: Array ["bison", "camel", "duck", "elephant"]

You could and should changing order of some plugins - I recommend you put all Yanfly's CORE plugins at the top of plugin list and the rest (with _X_ in name - at bottom)
Can I find that in the console? Sorry I don't know much about Javascript...

Also are you sure about rearranging he order? I just followed the recommended list on Yanfly's site.
Yanfly makes good plugins, but (s)he is not all-knowing and might be mistaken. Look at this:


This is how I arranged Yanfly's plugins and I have no issues...

And yes, you can run in console functions
I tried rearranging the plugins but it didn't help.

Do you know how exactly I can do that? The console is confusing, sorry...

Also it seems that the problem disappears when I start a new game but sooner or later ends up coming back.
Show me all your skills and states where you are using targets.slice()
Oh sorry for the late reply, the problem's been solved now anyway (I just set the problematic state to auto battle instead of using a restriction). Thanks for your help though.

Original thread: https://forums.rpgmakerweb.com/threads/yep-battle-engine-targets-slice-is-not-a-function.117076/