MV Yanfly Selection Control (Interesting Question/Find) *Important Read

I found something interesting. It's hard to explain, but it's really important.

Code:
  <Custom Select Condition>
   if (user.name() !== 'Harold') {
     condition = true;
   } else {
     condition = false;
   }
  </Custom Select Condition>
[/ICODE]
So if you base the selection condition at all regarding the user, it will pass the same results to every actor after. It doesn't seem to effect Troops. So for example, if I put this in random skill that all the actors can use, if the first actor that goes is Harold then it will disable to option to use the skill. This will also happen to all the other actors too despite the condition being true for them.


Code:
Game_BattlerBase.prototype.hasValidTargets = function(item) {
    if ($gameTemp.isSelectionControlCached(item)) {
     // return $gameTemp.getSelectionControlCache(item);
     .....rest of the code

I commented out this line and everything seems to work fine now. Maybe I am just tired and I missed something while doing this, please let me know. If I am correct then there are MANY projects that use this plugin where most people are never going to notice this issue. I have been working on a project for over a year and it was just randomly when I was testing something out that it even happened to me. It was actually an enemy that was going first and with the <Custom Selection> it would do check if it had a weapon, and if not that it would punch. But within the punch skill I had a check to see rows and subtracting it from the target's row. I then happened to not be using a weapon randomly on the first actor and after all these events happened, I then noticed my punch skill was disabled.

***If someone has the time to just retest this as my brain is fried atm, please let me know your results. If it is true then it's a serious issue that most people won't find out till deployment and endless testing.
I have moved this thread from JS Plugin Releases (RMMV) to JavaScript/Plugin Support.
1 - I can't duplicate this bug. I gave everyone access to the default Heal skill, and gave it the notetag:
Code:
<Custom Select Condition>
condition = user.name()=="Harold";
</Custom Select Condition>

It worked exactly as expected. Harold was the first actor to input for the turn, and he was able to select and queue the skill. All other actors were unable to select a target.

2 - This doesn't appear to be best usage of this plugin. It doesn't make a lot of sense from the player UX perspective to let them select a skill to be used, but then targets aren't available.

It would make more sense, I think, to use Skill Core notetags to disable the skill (so it's greyed out) if the current actor can't use it. (not getting into why actors who can't use the skill are getting it in the first place, that's some other part of your game design 🙂 )
I have recreated countless times over the past few days. This is the plugin list. I've recreated with Troops using a skill that is user specific for condition and it blocks it for the actors also.


1706802701910.png
1706803029309.png
1706803070209.png
1706803087736.png
1706803109070.png
That's different from the conditions you described in your first post.

Edit: Misunderstood stuff.

Edit: Your screenshots don't appear to be related to the notetag you're working with. Having no valid selections will not disable (grey out) the skill, it will allow you to choose the skill but you have no targets you can select.

I still think something is glitching your battle system. I duplicated your setup and it's not doing it for me.
So yes, it will effect other monsters too. I've been testing this out like crazy for the past few days. So I have been able to fix it in my project, but unless you do exactly like I did you're going to experience VERY rare bugs that almost no one is going to catch.

I've been looking through every thread I can find with this plugin and almost every person who got help was given information that would fail at random times that most will never catch. I saw a lot of people using the Custom Select to determine the row distance between battlers. This will work most of the time correctly, but in rare cases it will not.

If I am correct with this, there are MOST projects that use this plugin will have this flaw/bug and most people will never catch it. They will think it's a funky glitch like I did for over a year.
Do you have a sample project that demonstrates the problem that you can zip and upload for others to see? Do not distribute Yanfly plugins inside that download.

I have done exactly what you did, as far as I can see from your screenshots, but I just am not getting the glitch at all.
I'll send it to you privately first the yanfly files. I am assuming you own them cause of how much you respond and interact on the forums.

I started a conversation with you and sent the link.
Yes, I can drop in copies of the plugins. Please send me the project (or just post it here, I'm not the only one who can troubleshoot code) and exact instructions on what to select in what order to produce the bug.
I sent you the link to download it.
So for example, if I put this in random skill that all the actors can use, if the first actor that goes is Harold then it will disable to option to use the skill. This will also happen to all the other actors too despite the condition being true for them.
does this happen to specific skills or all skills by chance? i remember months back a similar thing happened where i encountered a quirk with the selection plugin that greyed out all player commands if an enemy considered using a particular skill via the ai core. but instead of looking into it further i just sidestepped it entirely.
does this happen to specific skills or all skills by chance? i remember months back a similar thing happened where i encountered a quirk with the selection plugin that greyed out all player commands if an enemy considered using a particular skill via the ai core. but instead of looking into it further i just sidestepped it entirely.
It can happen to any skill/spell. Do you have any <Custom Select Conditions> that check user/a/subject? If you do, can you post one or two in here?

*Edit. Right now we are just investigating. This could just be a silly mistake on my part. But I've been able to reproduce the problem so many times that I feel confident that something is amiss.
I'm beginning to think there's something going on for me, also.

From looking at the code, it looks like having no valid selections should disable the skill, but it's not doing it in my test project.

However, my test project is working correctly in terms of each actor being able to select or not based on the notetag.

I have no idea why my test project and yours are acting differently, I've replaced all of the files in your project with the plugins and core scripts from my install folders.

I can confirm that changing the line you reference in your first post causes your project to work correctly - however, that's probably not the best solution, as the cache was designed for a reason.

I'd encourage you again to put your project up for others to download and test, without including the Yanfly plugins.

I'll keep poking at it a bit, but I'm stumped as to why the two projects would function differently.
Do you have any <Custom Select Conditions> that check user/a/subject?
yes actually. At the time i had used the plugin's way of specifying not the user. when it happened, i saved a copy of the enemy, but ive long since overwritten the skill. im trying to see if i have a backup anywhere that might have it, else ill have to remember what i did and recreate it.

P.S wow. that took no time to recreate at all, but my situation may be a bit different cause i had used the <Enemy or Actor Select> tag along with it. A cursory look - For me, a skill with:
Code:
<Enemy or Actor Select>
<Select Conditions>
Not User
</Select Conditions>
when considered by an enemy causes all skills within an actor's skill list that target enemies to get greyed out (it happens most turns, but the AI level is 80, so i had just associated the 2)

skill 171-
1706807897773.png

1706808272047.png

1706808294589.png
1706808307716.png
Yeah I don't get it.
yes actually. At the time i had used the plugin's way of specifying not the user. when it happened, i saved a copy of the enemy, but ive long since overwritten the skill. im trying to see if i have a backup anywhere that might have it, else ill have to remember what i did and recreate it.

P.S wow. that took no time to recreate at all, but my situation may be a bit different cause i had used the <Enemy or Actor Select> tag along with it. A cursory look - For me, a skill with:
Code:
<Enemy or Actor Select>
<Select Conditions>
Not User
</Select Conditions>
when considered by an enemy causes all skills within an actor's skill list that target enemies to get greyed out

skill 171-
View attachment 293797
View attachment 293798
View attachment 293799View attachment 293800

Yep! I actually recreated this exact problem last night. You have no idea how many hours I spent doing this. I was able to get it to bug out and disable my skills too by using Not User on an enemy using a skill.
I'm beginning to think there's something going on for me, also.

From looking at the code, it looks like having no valid selections should disable the skill, but it's not doing it in my test project.

However, my test project is working correctly in terms of each actor being able to select or not based on the notetag.

I have no idea why my test project and yours are acting differently, I've replaced all of the files in your project with the plugins and core scripts from my install folders.

I can confirm that changing the line you reference in your first post causes your project to work correctly - however, that's probably not the best solution, as the cache was designed for a reason.

I'd encourage you again to put your project up for others to download and test, without including the Yanfly plugins.

I'll keep poking at it a bit, but I'm stumped as to why the two projects would function differently.
What files should I upload? The entire project minus the yanfly plugins? It's insane to me that you are unable to recreate it. I even used my other laptops to test it out and I had the same problems.
Exactly. It's against Yanfly's terms to distribute their plugins (and I think some of these are paid), so you just delete them from the plugins folder and zip the entire project. The person testing drops their own copies of the plugins in.

It wouldn't be a computer-specific problem, I have your project and mine and they're behaving differently.
Exactly. It's against Yanfly's terms to distribute their plugins (and I think some of these are paid), so you just delete them from the plugins folder and zip the entire project. The person testing drops their own copies of the plugins in.

It wouldn't be a computer-specific problem, I have your project and mine and they're behaving differently.
Ok zipping one now. Quick question, do you replace all the files in the project I sent you? And did you adjust the plugin options? I think the only ones I changed were in Yanfly Selection, but I didn't find a difference when I toggled them.

*Were you in any way possible to recreate it outside of my project? By replacing every file? It's kinda bugging me that it's only happening within the framework of my project.
This is the project. You will need to add Yanfly Target Core, Selection Core, and Row Formation plugins.

Okay, let me see whose experience I get when I try it. One sec.

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-selection-control-interesting-question-find-important-read.165356/