this._spriteset with multiple spritesets?

I've added a second Spriteset to Scene_Battle because I want to display popups and animations in the foreground (e.g. above Window_BattleStatus) while retaining the battleback and enemy sprites where they are by default.

It seems to work properly, but I get one error with Yanly Battle Core. It's stuck on if (this._spriteset.isPopupPlaying()) return;, seen here:

Yanfly.BEC.BattleManager_endTurn = BattleManager.endTurn;BattleManager.endTurn = function() { if (this._spriteset.isPopupPlaying()) return; Yanfly.BEC.BattleManager_endTurn.call(this);};Is it safe to assume that the error occurs because I am using two Spritesets? If so, is it possible to specify the spritesets by their name rather than using this._spriteset?
Well, what did yu call your second spriteset? If you used the same name, then you've overwritten the first. If you turned it into an array, that'll cause problems. How did you name and store your spriteset?
Thanks Zal. Here's my plugin code:

Spoiler
//-----------------------------------------------------------------------------// Spriteset_Battle//// The set of sprites on the battle screen.// Need to learn how to not make this a global change:Spriteset_Base.prototype.createBaseSprite = function() { this._baseSprite = new Sprite(); this._baseSprite.setFrame(0, 0, this.width, this.height); this._blackScreen = new ScreenSprite(); // Hide default black screen // this._blackScreen.opacity = 255; this.addChild(this._baseSprite); this._baseSprite.addChild(this._blackScreen);};//-----------------------------------------------------------------------------// Spriteset_Battle//// The set of sprites on the battle screen.Spriteset_Battle.prototype.createLowerLayer = function() { Spriteset_Base.prototype.createLowerLayer.call(this); this.createBackground(); this.createBattleField(); this.createBattleback(); this.createEnemies(); // Stop Spriteset_Battle from loading actors. // this.createActors();};Spriteset_Battle.prototype.update = function() { Spriteset_Base.prototype.update.call(this); // Stop Spriteset_Battle from updating actors. // this.updateActors(); this.updateBattleback();};Spriteset_Battle.prototype.battlerSprites = function() { return this._enemySprites;};//-----------------------------------------------------------------------------// Yanfly Battle Core//// The set of sprites on the battle screen.// Make Yanfly Battle Core recognize the new SpritesetSpriteset_EthanBattleActors.prototype.isPopupPlaying = function() { return this.battlerSprites().some(function(sprite) { return sprite.isPopupPlaying(); });};//-----------------------------------------------------------------------------// Spriteset_EthanBattleActors//// The set of actor sprites on the battle screen.function Spriteset_EthanBattleActors() { this.initialize.apply(this, arguments);}Spriteset_EthanBattleActors.prototype = Object.create(Spriteset_Base.prototype);Spriteset_EthanBattleActors.prototype.constructor = Spriteset_EthanBattleActors;Spriteset_EthanBattleActors.prototype.createLowerLayer = function() { Spriteset_Base.prototype.createLowerLayer.call(this); this.createBattleField(); this.createActors();};Spriteset_EthanBattleActors.prototype.update = function() { Spriteset_Base.prototype.update.call(this); this.updateActors();};Spriteset_EthanBattleActors.prototype.createBattleField = function() { var width = Graphics.boxWidth; var height = Graphics.boxHeight; var x = (Graphics.width - width) / 2; var y = (Graphics.height - height) / 2; this._battleField = new Sprite(); this._battleField.setFrame(x, y, width, height); this._battleField.x = x; this._battleField.y = y; this._baseSprite.addChild(this._battleField);};Spriteset_EthanBattleActors.prototype.createActors = function() { this._actorSprites = []; for (var i = 0; i < $gameParty.maxBattleMembers(); i++) { this._actorSprites = new Sprite_Actor(); this._battleField.addChild(this._actorSprites); }};Spriteset_EthanBattleActors.prototype.updateActors = function() { var members = $gameParty.battleMembers(); for (var i = 0; i < this._actorSprites.length; i++) { this._actorSprites.setBattler(members); }};Spriteset_EthanBattleActors.prototype.battlerSprites = function() { return this._actorSprites;};Spriteset_EthanBattleActors.prototype.isAnimationPlaying = function() { return this.battlerSprites().some(function(sprite) { return sprite.isAnimationPlaying(); });};Spriteset_EthanBattleActors.prototype.isEffecting = function() { return this.battlerSprites().some(function(sprite) { return sprite.isEffecting(); });};Spriteset_EthanBattleActors.prototype.isAnyoneMoving = function() { return this.battlerSprites().some(function(sprite) { return sprite.isMoving(); });};Spriteset_EthanBattleActors.prototype.isBusy = function() { return this.isAnimationPlaying() || this.isAnyoneMoving();};
And at the top of Scene_Battle:

Scene_Battle.prototype.createDisplayObjects = function() { this.createSpriteset(); this.createWindowLayer(); this.createAllWindows(); this.createSpritesetActors(); BattleManager.setLogWindow(this._logWindow); BattleManager.setStatusWindow(this._statusWindow); BattleManager.setSpriteset(this._spriteset); BattleManager.setSpriteset(this._spriteset2); this._logWindow.setSpriteset(this._spriteset);};Scene_Battle.prototype.createSpriteset = function() { this._spriteset = new Spriteset_Battle(); this.addChild(this._spriteset);};Scene_Battle.prototype.createSpritesetActors = function() { this._spriteset2 = new Spriteset_EthanBattleActors(); this.addChild(this._spriteset2);};[/spoiler]And Yanfly Battle Core's snippet:

Code:
Yanfly.BEC.BattleManager_endTurn = BattleManager.endTurn;BattleManager.endTurn = function() {	if (this._spriteset.isPopupPlaying()) return;	if (this._spriteset2.isPopupPlaying()) return;    Yanfly.BEC.BattleManager_endTurn.call(this);};
Works properly if I comment out those two if statements, but I'd rather learn what I did incorrectly.Thanks again.
Is the error something like isPoppPlaying is not a function? Because you didn't define it for the base spriteset class, you defined it for your custom spriteset, and then tried to use it on the original one.
Edit: I found a suitable enough solution to this by killing the isPopup bit and replacing it with a generic wait that gives the popups time to clear.

The exact error is TypeError undefined is not a function, occurring at:

Code:
if (this._spriteset.isPopupPlaying()) return;
isPopupPlaying is defined for Spriteset_Battle in Yanfly's plugin, but I did also try mirroring it in mine and got the same undefined error. The behavior of isPopupPlaying is:

Code:
Sprite_Battler.prototype.isPopupPlaying = function() {    if (this._damages.length > 0) {      for (var i = 0; i < this._damages.length; ++i) {        return this._damages[i].isPlaying();      }    }    return false;};
I'm looking over Sprite_Battler right now. Maybe I need to modify something there...
The problem is that function is defined on a single battler sprte, not the spriteset. You're calling it on the whole set of sprites, so it's not defined there. That's why you're getting 'undefined is not a function'. 
Thanks Zal. I'll check it out.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.


at OP's request

Original thread: https://forums.rpgmakerweb.com/threads/this-_spriteset-with-multiple-spritesets.49887/