MV Issue with Yanfly's Selection Control Plugin

I have selection control in my plugins loadout, but for some reason, my basic attack skill will target the player's party leader first. This happens even with all the plugin settings that could be affecting who gets targeted first turned off, and the notetag <Enemy or Actor Select> put on my attack skill.

I think I've read something about how attack animations with this plugin are determined by who your leftmost party member is on the battle screen, which doesn't make a lot of sense because I'm using the first-person battle screen with the Yanfly Battle Core to make the sideview sprites visible, and also, the information I found was about the order in which characters would be affected by a single target skill being converted to a multi target skill when targeting the whole party, not who is targeted first by default when you select "Attack".
Do you have your mouse cursor sitting over that actor?

Check the order of your Yanfly plugins against the order they're listed in on the Yanfly Engine Web page.
Do you have your mouse cursor sitting over that actor?

Check the order of your Yanfly plugins against the order they're listed in on the Yanfly Engine Web page.

I've been making sure to keep my mouse cursor off the game when playtesting for a while now, and all my plugins are in the correct order.

In fact, the most recent thing I've tried to fix this has been to turn off the ability to select your actors with the mouse (which works on their sprites) but still doesn't resolve the issue.
It looks like you have a metric ton of plugins.

Someone else might have some thoughts, but all I can say is that plugin doesn't do that by default...so all I can suggest is you do some basic, logical troubleshooting.

Turn off everything except Battle Core, Target Core, Selection Control. Make sure it works properly then.

If it still doesn't, it has to be something in your configuration. If it does work then, you turn plugins back on a few at a time until you figure out what the conflict is.
It looks like you have a metric ton of plugins.

Someone else might have some thoughts, but all I can say is that plugin doesn't do that by default...so all I can suggest is you do some basic, logical troubleshooting.

Turn off everything except Battle Core, Target Core, Selection Control. Make sure it works properly then.

If it still doesn't, it has to be something in your configuration. If it does work then, you turn plugins back on a few at a time until you figure out what the conflict is.

Okay, sorry, but that's really not the problem here. The screenshot was to show you that I do, in fact, have all the yanfly plugins in the correct order- most of them are disabled, and I've only been turning on the ones I need when I need them. The fact of the matter is that I've turned off all the settings in the Selection Control plugin that could possibly affect how a skill targets enemies, and added the <Enemy or Actor Select> tag on my Attack skill exactly as the documentation told me to do, and the skill still targets the party leader first. I do have a few other plugins turned on after the yanfly plugins, but it doesn't matter, when I turned off every plugin except for battle core, target core, and selection control, the problem was still there.

I took some time to experiment, and it looks like the problem is actually somewhere in BattleCore, when the parameter "Enemy Auto Select" is set to "0", it targets the leftmost thing on the screen whether it's an actor or an enemy, and with my Phantasy Star 4 style combat screen, this defaults to the party leader. I can move an enemy's sprite so far left that it goes offscreen, and that's enough to force the game to recognize that it's supposed to target the enemy first. If it's set to "this.furthestRight()", then it correctly selects the enemy to the furthest right first, even if there's a party member much further to the right than the enemy's sprite, but I would rather have it select the enemy to the furthest left first: if it were possible to do this with javascript, that would be great, otherwise I'm going to have to come up with an ugly skill category based hack to fix it, because while a friend of mine wants me to include the ability to attack the other party members based off the way my combat system works, what I really need this plugin for is the ability to create states that prevent the player from targeting the boss until all the special shield nodes are destroyed.
The screenshot was to show you that I do, in fact, have all the yanfly plugins in the correct order
That's cool, but I, for one, am not going to sift through a list of someone else's plugins comparing them to a Web page in another tab to see if they're in the right order 😉 Plus, your screenshot only shows, like, a tenth of your extensive plugin list, so it's not proof of anything to us.

As to the rest...I can't duplicate your bug.

I looked at the code, and the auto select should pick the left/right-most target from the skill's original scope.

I already use the Selection Control in my project to let actors attack party members, I changed the auto select parameter in the Battle Engine Core and it did not act the way you describe.

Are you sure the actual Scope for Attack is 1 Enemy?

Have you verified, per my previous post, that it works this way using only those three required plugins?

Can you duplicate it in a new project?
That's cool, but I, for one, am not going to sift through a list of someone else's plugins comparing them to a Web page in another tab to see if they're in the right order 😉 Plus, your screenshot only shows, like, a tenth of your extensive plugin list, so it's not proof of anything to us.

As to the rest...I can't duplicate your bug.

I looked at the code, and the auto select should pick the left/right-most target from the skill's original scope.

I already use the Selection Control in my project to let actors attack party members, I changed the auto select parameter in the Battle Engine Core and it did not act the way you describe.

Are you sure the actual Scope for Attack is 1 Enemy?

Have you verified, per my previous post, that it works this way using only those three required plugins?

Can you duplicate it in a new project?

1 - Literally the only thing I changed about the Attack skill was I deleted everything in the notebox and replaced it with <Enemy or Actor Select>.

2 - Yes, I did. I explicitly said I did right before I explained how I thought the bug worked.

3 - It's very easy to replicate this bug in a blank project. Step 1 is to set the battle to front view. Step 2 is to go to Battle Engine Core and change the "enemy auto select" parameter from "this.furthestRight()" to "0".
1 - Literally the only thing I changed about the Attack skill was I deleted everything in the notebox and replaced it with <Enemy or Actor Select>.

2 - Yes, I did. I explicitly said I did right before I explained how I thought the bug worked.

3 - It's very easy to replicate this bug in a blank project. Step 1 is to set the battle to front view. Step 2 is to go to Battle Engine Core and change the "enemy auto select" parameter from "this.furthestRight()" to "0".
been a bit since i've fiddled with the MV files but if memory and a quick glance over serve me right, thanks to the way Yanfly's plugins rewrite the functions Window_BattleEnemy.prototype.sortTargets and Window_BattleEnemy.prototype.autoSelect and adds the function Window_BattleEnemy.prototype.addExtraSelectTargets, skills marked with <Enemy or Actor Select> will create the action's enemy array with the party first, as they're valid targets and thus "enemies", which is why you're always the default target in the array(your first party member is stored at value 0, the default target for your settings).

There's a cleaner/more elegant solution but as a quick and easy fix if you go into the Selection Core file and add this
Spoiler: autoselect function
Code:
Window_BattleEnemy.prototype.autoSelect = function() {
    if (Yanfly.Param.BECEnemyAutoSel === 0 ||
    Yanfly.Param.BECEnemyAutoSel === '0') {
      var length = this._enemies.length;
      var selectIndex = 0;
      for (var i = 0; i < length; ++i) {
        var member = this._enemies[i];
        if (member && member.isEnemy() && selectIndex == 0) selectIndex = i;
        }
    } else {
      var selectIndex = this.furthestRight();
    }
    this.select(selectIndex);
};
right below the Window_BattleEnemy.prototype.furthestRight function, which ends on line 1622 for me, it seems like it'll handle your issue without messing anything else up. Haven't tested it extensively obviously, so use at your own risk
You could chill a little bit. We're trying to help you - if you need to repeat yourself or clarify something to assist in that process, one would think that's a minor effort on your part.

I missed the part in the middle of multiple lines of text in your first post that said
I'm using the first-person battle screen

Once I went to front-view, I did duplicate the bug.

Good luck with your project.
been a bit since i've fiddled with the MV files but if memory and a quick glance over serve me right, thanks to the way Yanfly's plugins rewrite the functions Window_BattleEnemy.prototype.sortTargets and Window_BattleEnemy.prototype.autoSelect and adds the function Window_BattleEnemy.prototype.addExtraSelectTargets, skills marked with <Enemy or Actor Select> will create the action's enemy array with the party first, as they're valid targets and thus "enemies", which is why you're always the default target in the array(your first party member is stored at value 0, the default target for your settings).

There's a cleaner/more elegant solution but as a quick and easy fix if you go into the Selection Core file and add this
Spoiler: autoselect function
Code:
Window_BattleEnemy.prototype.autoSelect = function() {
    if (Yanfly.Param.BECEnemyAutoSel === 0 ||
    Yanfly.Param.BECEnemyAutoSel === '0') {
      var length = this._enemies.length;
      var selectIndex = 0;
      for (var i = 0; i < length; ++i) {
        var member = this._enemies[i];
        if (member && member.isEnemy() && selectIndex == 0) selectIndex = i;
        }
    } else {
      var selectIndex = this.furthestRight();
    }
    this.select(selectIndex);
};
right below the Window_BattleEnemy.prototype.furthestRight function, which ends on line 1622 for me, it seems like it'll handle your issue without messing anything else up. Haven't tested it extensively obviously, so use at your own risk

Okay, this is an immense help. Thank you so much for this. The only thing that would make this better is if there were some way to adjust the controls. As it stands, up and down cycle through enemies (or actors if you've highlighted one), and left and right cycles through everyone in a linear fashion. If it were possible to swap between targeting enemies and actors with up and down, that would make it perfect.
You could chill a little bit. We're trying to help you - if you need to repeat yourself or clarify something to assist in that process, one would think that's a minor effort on your part.

I missed the part in the middle of multiple lines of text in your first post that said


Once I went to front-view, I did duplicate the bug.

Good luck with your project.

Sorry.

Original thread: https://forums.rpgmakerweb.com/threads/issue-with-yanflys-selection-control-plugin.161972/