MZ VisuStellaMZ - Skill Learn System [Requirements] with Skill Mastery [Level max]

(English is not my native language, sorry for my english google translate)

I'm looking for different ways to unlock skills, and I came up with an idea (not necessarily original).
I would like to know if there is a way to unlock skills from a maximum level (Skill Mastery) of another skill?

Skill Learn System has the notetag <Learn Require Level: x>* and I know this isn't what I'm looking for, but I think it comes close to the idea.
(* Actors must be at least the required level in order for the skill to be enabled in the Skill Learn System menu)

Simple example :
When Skill "Fire1" reaches its maximum level, Skill "Fire2" is enabled in the Skill Learning System menu.
(I hope I'm clear enough)

I imagine that with the notetag below we should be able to do quite a few interesting things, but it's not really my area:
Spoiler: JS Learn Requirements
<JS Learn Requirements>
code
code
enabled = code;
</JS Learn Requirements>

- Used for: Skill Notetags
- Replace 'code' with JavaScript code to determine if the skill will be
enabled for learning in the Skill Learn System menu.
- The 'enabled' variable must result in a 'true' or 'false' value to
determine if the skill will be enabled.
- The 'user' variable can be used to reference the actor who will be
learning the skill.
- The 'skill' variable can be used to reference the skill that will be
learned by the actor.
- Any other requirement conditions must be met, too.

I haven't seen a notetag in Skill Mastery that could use switch or variables, which could have been practical to get there.

At first glance I have the impression that it is not feasible, but If anyone knows how to do it, I'm interested.
I did this for my game! See Aery's Elemental Odyssey in my signature. It's abandoned LOL but I hope to pick it up again at some point.

You're basically using the javascript they've included $actorSkillMasteryLevel(actorID, skillID) to check the level and then do something with it.

My code was kinda complicated with arrays to check lots of different mastery levels, but here it is cleaned up a bit:
Code:
var actorID = 1;
var masterySkillID = 12;
var requiredLevel = 7;
var skillToLearn = 19;

if ($actorSkillMasteryLevel(actorID, masterySkillID) >= requiredLevel) {
    $gameActors.actor(actorID).learnSkill(skillToLearn);
}
So it checks skill 12 on actor 1 and if it's greater than or equal to a level (7 in this case), then the actor will learn skill 19.

I think lol.
Thanks for the reply. This will help me a lot!

Code:
var actorID = 1;
var masterySkillID = 12;
var requiredLevel = 7;
var skillToLearn = 19;

if ($actorSkillMasteryLevel(actorID, masterySkillID) >= requiredLevel) {
    $gameActors.actor(actorID).learnSkill(skillToLearn);
}

If I understand correctly, this code, as it stands, will only work for "actorID 1" ?

But if the player has several actors in his party, it should work for each of them.

I guess I can't just put each actor ID into the var actorID .
That would be too simple, wouldn't it?

How can I get the ID of the actor I'll be on the Skill Learn System menu with?
@Akou Sorry I totally skipped the part you wanted to use Skill Learn System. My immediate thought is to put the code I gave above into a common event, and check it from time to time. Then instead of, "gameActors learnSkill" code, you could set a variable or a switch. Then use either

<Learn Show Switch: x>
or
<JS Learn Show>
code
code
visible = code;
</JS Learn Show>

You might be able to put all of the information in an array? But I don't know JS enough to make that for you! Sorry 🙁

It would be cool if the plugin ran a common event whenever a mastery leveled up. That'd make this a lot easier.
Instead of <Learn Show>, isn't it better to use <Learn Require> ?
Depending on what you want to do, I imagine that both remain interesting, even necessary.
You might be able to put all of the information in an array? But I don't know JS enough to make that for you! Sorry 🙁

No problems. Just knowing that i can use $actorSkillMasteryLevel(actorID,skillID) is a good start.

Now I just need to figure out how to transform the code so that it does what I want.

It would be cool if the plugin ran a common event whenever a mastery leveled up. That'd make this a lot easier

I might make a suggestion on the VisuStella discord if I can't figure out how to do this relatively easily.

A notetag like this would be very useful if it existed:
<Learn Show Skill MaxLevel: id>
Or another version:
<Learn Show Skill id Level: x>
(they don't exist, please don't use them)​

The problem is, I don't know if it's feasible for them to do it (but I hope so).
We'll see.
Hmmm, replace 'skillId' with the id of the skill that has to be at max mastery level.

<JS Learn Requirements>
const maxSkillLevel = 10;
enabled = $actorSkillMasteryLevel(user.actorId(), skillId) === maxSkillLevel;
</JS Learn Requirements>
<JS Learn Requirements>
const maxSkillLevel = 10;
enabled = $actorSkillMasteryLevel(user.actorId(), skillId) === maxSkillLevel;
</JS Learn Requirements>

I did some tests, and it works perfectly 😎

You need to check the skill/class/actor notetag carefully for this to work properly, but otherwise I have nothing to report.

It's in these moments that we see that having knowledge in JS really helps a lot.

Anyway thanks for the help!


EDIT :

I also tested with this notetag :
Code:
<JS Learn Show>
const maxSkillLevel = x;
visible = $actorSkillMasteryLevel(user.actorId(), skillId) === maxSkillLevel;
</JS Learn Show>

I just wanted to say that it works too.

Original thread: https://forums.rpgmakerweb.com/threads/visustellamz-skill-learn-system-requirements-with-skill-mastery-level-max.179232/