How would I go about making a skill obtained from an equipped weapon permanently (and automatically) learned after mastering it? I'm using Visustella plugins (Skill Mastery and Skill Learn System) There was another post I saw suggesting using this notetag to do what I assumed was what I was looking for, but I still can't seem to get it to work.
<JS Learn Show>
const maxSkillLevel = x;
visible = $actorSkillMasteryLevel(user.actorId(), skillId) === maxSkillLevel;
</JS Learn Show>
Any help would be appreciated
Haven't used those plugins but it says that that notetag is for deciding whether the skill shows up in the skill learn menu (to be bought).
If you want your actor to learn the skill automatically (assuming skills gained from weapons gain that skill mastery stuff normally), I guess it would be something like (actor notetags or wherever you want to put the checks), change x and y:
<JS Post-End Battle>
const maxSkillLevel = x;
const skillId = y;
if ($actorSkillMasteryLevel(user.actorId(), skillId) === maxSkillLevel)
user.learnSkill(skillId);
</JS Post-End Battle>
That works perfectly but I can't seem to figure out how to add multiple skill ids to it. I don't know much about JS code but I feel dumb for not being able to figure this part out on my own
Hmmm, I think you can just go through all the skills like below (you could also go through just the weapon trait skills, but don't have motivation to get script for that LOL, I don't think it matters that you loop through the learned skills too). Also, if you have varying max levels with notetags, you need to read the meta property of the skill. But if not, just change y below:
<JS Post-End Battle>
user.skills().forEach(skill => {
const maxSkillLevel = y;
if (skill && $actorSkillMasteryLevel(user.actorId(), skill.id) === maxSkillLevel)
user.learnSkill(skill.id);
})
</JS Post-End Battle>
That's exactly what I need, thanks for the help!