MV Yanfly Learn Skills Issue

I am trying to create a class-skill system where-in on the learn skill menu the player will only ever see skills that are learnable based on class and subclass. I have done the following to try to solve my problem but none seem to work:

  1. I have tried using a custom show eval that uses actor class id
  2. I have tried using a learn show eval that uses actor class id
  3. I have tried using a learn require eval that uses actor class id
  4. I have tried relegating the skill to a specific type (named after the class I want the skills restricted to)
  5. I have googled the many different variations of how one might have searched for an answer

As an example of what I want to achieve:

I have a skill named pummel that is a physical fighter skill; meaning only an actor with the class "fighter" can use it. When any actor, regardless of class, goes into the learn skill menu the only actor that will be able to see & learn it will be the actor that meets all requirements including the requirement of class. If Mary sue who is a mage goes to her learn skills then she will only see spells such as fire, ice, wind; but if john doe the fighter goes into his learn skills menu he will see the skill pummel (plus other fighter skills) but not the spells such as fire, ice, wind.

I have done many variations of the note-tags and looked the wiki pages for the learn skills plugin, the class plugin, the subclass plugin, the states plugin, and any other variation of plugins that I can attach a notated "requirement" tag to a skill with. Is there anyone who has solved this problem or knows of a note tag variation that will solve the problem? Again, I only want fighter-related skills to show up when an actor's class is fighter and mage-related skills to show up when an actor's class is mage. I want this to also be able to work for subclasses. I have spent 2-3 hours of googling and forum searching here and its always possible I just missed it.
This is something I was looking into to, but never managed to get that far either. You say you replaced the code in the Yanfly script that shows learnable skills with your own conditional show eval? That sounds like it would work if done correctly.

Here is an idea I got from reading this thread: https://forums.rpgmakerweb.com/inde...skills-regardless-of-the-requirements.149265/

You can hide the skills if the actor doesn't know a specific skill. You could set a dummy skill for each class, and have that skill learned when the actor is the matching class (Dummy Brawler skill = learned when switching to Brawler class/subclass, etc), and have that skill be unlearned if actor is not that class or subclass.

Then simply require all Brawler skills to require the dummy Brawler skill in order to be learned.

In the skills you want only Brawler to learn set:

<Learn Require Skill: x>
This is something I was looking into to, but never managed to get that far either. You say you replaced the code in the Yanfly script that shows learnable skills with your own conditional show eval? That sounds like it would work if done correctly.

Here is an idea I got from reading this thread: https://forums.rpgmakerweb.com/inde...skills-regardless-of-the-requirements.149265/

You can hide the skills if the actor doesn't know a specific skill. You could set a dummy skill for each class, and have that skill learned when the actor is the matching class (Dummy Brawler skill = learned when switching to Brawler class/subclass, etc), and have that skill be unlearned if actor is not that class or subclass.

Then simply require all Brawler skills to require the dummy Brawler skill in order to be learned.

In the skills you want only Brawler to learn set:

<Learn Require Skill: x>


Im going to be honest, that thought never occured to me. I could just create a basic class specific skill for every class I have then just piggy back on that skill. So I tried implementing it works but I think I failed to specify more detail in my initial post that makes this implementation, as far as I can tell, not useable. I have subclasses that are stemmed from the main class:

Fighter has access to Soldier, Mercenary, & Warlord
Mage has access to Arcanist, Spellblade, Elementalist

If I want spellblade to know a skill that Fighter has but only when Fighter is of a specific level, then the tag system of "requires skill" would prevent this. I would need to know the dummy fighter skill but then that would open up every other skill fighter had access to. I would also like to clarify that while I used the eval tag, I could have used it incorrectly and I did find the post you had linked. However, I think im going to take another stab at that eval condition but my issue is probably that I don't know enough about the scripts itself to get it right.
Yea, I think I might be lacking some details here as your setup sounds a bit different than the default way classes and subclasses are set up. Are you using Yanfly class + subclass plugins for this?

Assuming we only have to deal with classes/subclasses, try making two new states, each called 'Brawler1' and 'Brawler2', and put this code in Brawler1's notebox:

JavaScript:
<Custom Passive Condition>
if (
user.currentClass().id == x)
{
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>


then in Brawler2's notebox put this:

JavaScript:
<Custom Passive Condition>
if (
user.subclass() !== null && user.subclass().id == x)
{
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>

let x = the class id you are setting up.

In each of these states, set up a trait in the upper right box to 'add skill', this will be your piggyback skill.

Then in Yanfly Learn Skills, set the skill, 'pummel' in your example to require the piggyback skill to be learned.

Outside of this, I am not sure what your other specifications are, but you could always add more conditions to this state based on what your criteria is.


One final note, you could actually get away with using only a single state like the one below, but I am not 100% I have the formatting right. I think this would work however.

JavaScript:
<Custom Passive Condition>
if (
user.currentClass().id == x || user.subclass() !== null && user.subclass().id == x)
{
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>

Oh, I did forget something though. You will need to put this tag inside the notebox of the class in question. You will also need the Yanfly passive states plugin for this to work.

Code:
<Passive State: y>
<Passive State: n>


This may be a bit redundant considering you can simply add the piggyback skill to the class in question in the traits box, but the conditionals allow you to insert other requirements that match your specific situation.
I feel like this has a much simpler solution than the complicated stuff going into lots of notetags being offered, but can you please explain the problem more clearly?

You say what you want, but you don't say how that's different from what you currently have. So I don't understand what you need changed.

Please provide a screenshot of your skill learning screen and describe how it should be different.
Yea, I think I might be lacking some details here as your setup sounds a bit different than the default way classes and subclasses are set up. Are you using Yanfly class + subclass plugins for this?

Assuming we only have to deal with classes/subclasses, try making two new states, each called 'Brawler1' and 'Brawler2', and put this code in Brawler1's notebox:

JavaScript:
<Custom Passive Condition>
if (
user.currentClass().id == x)
{
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>


then in Brawler2's notebox put this:

JavaScript:
<Custom Passive Condition>
if (
user.subclass() !== null && user.subclass().id == x)
{
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>

let x = the class id you are setting up.

In each of these states, set up a trait in the upper right box to 'add skill', this will be your piggyback skill.

Then in Yanfly Learn Skills, set the skill, 'pummel' in your example to require the piggyback skill to be learned.

Outside of this, I am not sure what your other specifications are, but you could always add more conditions to this state based on what your criteria is.


One final note, you could actually get away with using only a single state like the one below, but I am not 100% I have the formatting right. I think this would work however.

JavaScript:
<Custom Passive Condition>
if (
user.currentClass().id == x || user.subclass() !== null && user.subclass().id == x)
{
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>

Oh, I did forget something though. You will need to put this tag inside the notebox of the class in question. You will also need the Yanfly passive states plugin for this to work.

Code:
<Passive State: y>
<Passive State: n>


This may be a bit redundant considering you can simply add the piggyback skill to the class in question in the traits box, but the conditionals allow you to insert other requirements that match your specific situation.
I dont know what that did but having a passive state with custom code in it with a class containing that passive state just prevented my play test from functioning. If I remove the state entirely or even the code, I cna boot up the playtest easily.

However, I did stumble across another post: https://forums.rpgmakerweb.com/index.php?threads/learn-skill-condition-js-code-help-please.69622/

It mentions that for the "learn skill window" it insinuates that doing "this.{variable}" would be more appropriate. Specifically doing something like this._actor.classId() maybe? I tried it in the skill using this tag:


<Learn Require Eval>
if(this._actor.actorId() === 10)
{ visible = true; }
else
{ visible = false; }
</Learn Require Eval>

It just didn't work.


I feel like this has a much simpler solution than the complicated stuff going into lots of notetags being offered, but can you please explain the problem more clearly?

You say what you want, but you don't say how that's different from what you currently have. So I don't understand what you need changed.

Please provide a screenshot of your skill learning screen and describe how it should be different.


There'sa lot of screenshots but to make it simple:

I have a Spellblade (Subclass of mage) and I have a Fighter (Class)
Fighter can learn Pummel. I want Spellblade to be able to learn Pummel as well.
Now I can just go into the class and specify every single skill I want individually or group them. But I have way more than 2 class/subclasses and doing so would be a LOT of work.
It would also mean that if I want to modify, change, add, or remove skills at a later date. I would have to go back into the classes and through every note tag to add, remove, or modify appropriately.
It would be easier if I could have some kind of custom evaluation method so I only need to modify one or two variables either for/on a class note-tag or skill note-tag.


I am starting to think that I can only do this within the plugin and not without. At any rate what specific screenshots are you looking for? Just a picture of the skill learning screen per actor? The fighter knows pummel but the spellblade doesn't; or rather it can't even learn it.
Hmm, maybe Turan can help you out. He is a lot more experienced than I am at js. The only reason I can think the code I gave wouldn't work is if you do not have the Yanfly Passive States plugin, or you did not change x/y/n to the skill/state ids.

Take it away, @ATT_Turan
Hmm, maybe Turan can help you out. He is a lot more experienced than I am at js. The only reason I can think the code I gave wouldn't work is if you do not have the Yanfly Passive States plugin, or you did not change x/y/n to the skill/state ids.

Take it away, @ATT_Turan
Its not that it didn't work. Its more that when I loaded my playtest the splash screen was running at like 1 fps. I could visibly see the splash screen "fading out" one frame at a time.
I have a Spellblade (Subclass of mage) and I have a Fighter (Class)
There's no difference between a subclass and a class. They are both entries in your class database.

Fighter can learn Pummel. I want Spellblade to be able to learn Pummel as well.
Now I can just go into the class and specify every single skill I want individually or group them. But I have way more than 2 class/subclasses and doing so would be a LOT of work.
So do many of us - that's just how it works 😛 You need to tell the game which skills belong to which class(es).

If you've already made lots of skill entries and you need to regroup them, the Web store has a utility to rearrange your database. Using the x to y notetag is by far the most efficient method.

It would also mean that if I want to modify, change, add, or remove skills at a later date. I would have to go back into the classes and through every note tag to add, remove, or modify appropriately.
True. That's a good reason to design and plot out the entirety of your class/skill system before you implement it in RPG Maker. But things can happen during the playtest/polish process...I've had to change skills and notetags before. It's a part of working with the software.

It would be easier if I could have some kind of custom evaluation method so I only need to modify one or two variables either for/on a class note-tag or skill note-tag.
Like what? What would the skills be evaluated on?
Its not that it didn't work. Its more that when I loaded my playtest the splash screen was running at like 1 fps. I could visibly see the splash screen "fading out" one frame at a time.
paste the code here that you put into the state notetag as well as the class notetag verbatim, as well as the id of the states and skill you are working with. I have no idea why your game would crash, I just copied and pasted the code out of my game here and replaced the numbers "11" with x, "12" with y, and 13 with "n" etc. Assuming you didn't leave the x/y/n present, I can only think you have another plugin that is not working with passive states. I know there are several different passive state plugins, do you have more than 1 installed?
There's no difference between a subclass and a class. They are both entries in your class database.


So do many of us - that's just how it works 😛 You need to tell the game which skills belong to which class(es).

If you've already made lots of skill entries and you need to regroup them, the Web store has a utility to rearrange your database. Using the x to y notetag is by far the most efficient method.


True. That's a good reason to design and plot out the entirety of your class/skill system before you implement it in RPG Maker. But things can happen during the playtest/polish process...I've had to change skills and notetags before. It's a part of working with the software.


Like what? What would the skills be evaluated on?

restricted classes[] = {...};
If (restrictedClasses[].contains(learn skill screen of selected actorA.classA)) //where i can be a single digit or array of digits
//show skill x on learn screen
else
//do not show skill x on learn screen
Sorry, that doesn't really make any sense.

Instead of trying to make up what you think the code would look like, please just answer the question as asked.

Are you saying you would want to enter all of that in the notes of a skill to list which classes don't learn it, instead of just using the existing notetags in the notes of the classes to list which skills they do learn?
Sorry, that doesn't really make any sense.

Instead of trying to make up what you think the code would look like, please just answer the question as asked.

Are you saying you would want to enter all of that in the notes of a skill to list which classes don't learn it, instead of just using the existing notetags in the notes of the classes to list which skills they do learn?

I am saying I am trying to devise a way to reference An actors class I'd that determines which skills show up in the learn skill window. Some classes will share skills of others but I don't want to explicitly state the skill number. I don't want to do this in case i delete a skill, change a skill, or modify classes. While I can use the tag x to y the problem arises that the overlap may not always be in bunches but only specific skills from one class will be used in another.

In the case of being explicit the amount of note tag changes would be a huge amount And can result easily in failure to remove a tag. The latter only requires a single change per note tag and it's in one place/variable check.

Tbc it is quite possible that any of the attempts I previously stated I made could have been done incorrectly. So if you have a way that might work but falls under any of the previous attempts I made, please let me know. I've been trying this for a few hours now and it could be that I just need an outside view on the problem.
I am saying I am trying to devise a way to reference An actors class I'd that determines which skills show up in the learn skill window.
And what I asked is how - by what criteria?

There is no connection in the database between a class and a skill unless you:
A - add it to the class' Skills to Learn list, in which case you'd automatically get them at levels and not use your learn skills system

B - add additional data via notetags, which is the method already provided to you in the plugin
And what I asked is how - by what criteria?

There is no connection in the database between a class and a skill unless you:
A - add it to the class' Skills to Learn list, in which case you'd automatically get them at levels and not use your learn skills system

B - add additional data via notetags, which is the method already provided to you in the plugin

In the skill note tag being able to reference the actor ID of the skill learning window to dictate if that skill is drawn into the skill learning window. The problem thus far is finding a way to do this. Unless there is something I missed, there's currently no way using the standard note tagging (without custom scripting) to signify a skill is learnable by Class A or B only "A with B"; meaning an actor would have to have both classes A and B unlocked to even see/learn a skill which is not how I want it set up.

For a specific example:

Fighter Primary Class can use 10 fighter skills.
Spellblade sub class can use 3 of those fighter skills. But spellblade subclass IS NOT ACCESSIBLE to an actor whose primary class is Fighter and an actor can not change their "primary class".


I can easily just go into spellblade and say "learn these three skills". However, I would be doing that to about 40 classes (primary + subclass). I do not wish to do that on the classes. Instead I'd like to be able to do it on the skill tags because then all I need to do if I ever want to change which skill any given class can use is look in one particular place and not 17 diff places (the class note tags). Plus if I ever need to re-arrange the skills or rename them, I don't have to go back into the classes that all connect to that skill and change a number/name. If I am able to reference a list of classes that are "accessible" to a skill through its skill note tag, I can then just change the list in the specified note tag of that skill; or if I want to move the position of a skill in the list for some reason I can just copy paste it and with that the notetags.

Further into that, I am using the following Plugins of Yanfly:
Class Core
-> Sub Class
Job Points
Multi-Type Skills
Skill Learn System


The point here is to allow the use of JP to dictate how the player accepts which skills and when while also having select skills not shown until the appropriate level of a specific primary/sub class.
It's right in the custom requirements section of the instructions.

1711496858622.png


If you put
Code:
<Learn Show Eval>
value = user._classId == 4;
</Learn Show Eval>
the skill will only show up when the actor is whatever class is ID 4.

The current subclass is user.subclassId and OR in JavaScript is ||.

So if they can learn the skill whether class ID 4 is their primary or subclass, it would be
Code:
value = user._classId == 4 || user.subclassId == 4;

That's why I was trying to get you to compress everything, get rid of the super long descriptive posts, the attempts at what you think the code ought to be, just state the exact need more clearly 🙂

Good luck with your project.

So the issue arises from using "user._currentClass()" and not "user._classId"

I had to have been doing something wrong in my eval. I just tried 50 diff things that trying to list every single individual instance over the course of 7 hours was not going to be possible.
So the issue arises from using "user._currentClass()" and not "user._classId"
There's no such thing as user._currentClass()

There is a user.currentClass(), but
- there's no underscore before it
- that returns a Class object, not the ID.

So you would have to do user.currentClass().id which is just an unnecessarily inefficient way of directly accessing user._classId
There's no such thing as user._currentClass()

Yanfly's plugins add a user.currentClass(), but
- there's no underscore before it
- that returns a Class object, not the ID.

So you would have to do user.currentClass().id which is just an unnecessarily inefficient way of directly accessing user._classId
Just to be clear, is this worded incorrectly?
<Learn Show Eval>
value = true;
value = false;
</Learn Show Eval>
For using a custom code to hide or show the skill, you can use these
notetags. Returning value as true will cause the skill to appear
regardless of all other requirements being unmet while returning value as
false will cause the skill to appear regardless of all other requirements
being met.

Am i misreading that? I read it as:

If value = true -> then show the skill regardless of unmet criteria
If value = false -> then show the skill regardless of met criteria

Are these not the same thing? Because my code below:

<Learn Show Eval>
var restrictedClasses = [2];
value = !restrictedClasses.contains(user._classId);
</Learn Show Eval>


Will only show the skill if the users class is mage and not fighter. So Actor A who is a Fighter does not see the skill but Actor B who is a mage does. Wouldn't it show regardless?

Or am I misinterpreting the situation in which the eval gets used? Meaning if I labeled a requirement of level 10 on the skill then the Fighter won't see it even at level 10 but the Level 5 Mage will have it seen/learnable?

I only ask because the criteria is being met and not met of "is the user class the required class?" but I assume the criteria to be met/unmet is excluding the criteria from WITHIN the eval.
Just to be clear, is this worded incorrectly?
No, it's worded correctly.

Or am I misinterpreting the situation in which the eval gets used? Meaning if I labeled a requirement of level 10 on the skill then the Fighter won't see it even at level 10 but the Level 5 Mage will have it seen/learnable?
I assume that's because you have the wrong syntax - JavaScript arrays don't have a contains() method, they have includes().

So that notetag is erroring out as nonfunctional, which means any other tags you have (a minimum level) are being used as the only criteria.

Note that if you want the level requirement to be a criterion for the skill being shown (as opposed to enabled/not greyed out), you'd need to include it in the Learn Show Eval. Per the description, that notetag makes the skill shown or not regardless of all other notetags.

Will only show the skill if the users class is mage and not fighter. So Actor A who is a Fighter does not see the skill but Actor B who is a mage does. Wouldn't it show regardless?
Impossible to answer, "Fighter" and "mage" are not IDs, so I don't know what values you're testing with.

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-learn-skills-issue.167146/