YEP Skill Mastery effective also out of battles?

Unless I'm very mistaken, for a skill to gain points and in turns levels, it needs to be used in battles.
But I was wondering if it'd be possible to allow some skills to gain points (and levels also whenever they are cast on the map?
I quickly put this together and it seems to work, if you're using Skill Core you can slap it on whatever skills that are usable outside of battle.

<After Eval>
if (!$gameParty.inBattle()) {
user.gainSkillMasteryUses(item.id, 1);
}
</After Eval>
Definitely seems to work on my side too.
Thanks for your help and brilliant knowledge!
@zaraku
The way I read this bit:
user.gainSkillMasteryUses(item.id, 1);

I have the impression it could be used with Skill Rewards too?
Like a specific condition (eg Killing, Critical etc) gives an extra +1 to the skill mastery.

Is it something you could insert to the usual Skill Mastery tags like for instance
<Defeat Reward: X>
?
@zaraku
The way I read this bit:
user.gainSkillMasteryUses(item.id, 1);

I have the impression it could be used with Skill Rewards too?
Like a specific condition (eg Killing, Critical etc) gives an extra +1 to the skill mastery.

Is it something you could insert to the usual Skill Mastery tags like for instance
<Defeat Reward: X>
?

Hmm.. I'm not using that plugin and there seems to be no way of inserting your own code effect for those conditions. I think editing the plugin instead of using Skill Core/Buff & States Core tags might be easier depending on how many conditions you want to apply this to. Something like:

<Defeat Reward: +1 Mastery>

I'll see if I can do that tomorrow, but can I ask what conditions that you want to increase skill mastery with, just in case it doesn't work out?

EDIT: I'm blind, I didn't see that you can add more effects via plugin parameters. No need to edit the plugin directly.
I'm thinking of these 3

  • Defeat
  • Critical
  • Weakness

Thanks!
I'm thinking of these 3

  • Defeat
  • Critical
  • Weakness

Thanks!

Open up the "Effect Code" in the Skill Reward plugin parameters, and add this snippet near the bottom, above the "Add new effects above this line" comment.

JavaScript:
// ----------------
// Mastery
// ----------------

} else if (data.match(/([\+\-]\d+)[ ]MASTERY/i)) {
if (isSkill) {
    var gain = parseInt(RegExp.$1);
    user.gainSkillMasteryUses(skill.id, gain);
    animation = animation || miscAnimation;
} else {
    skip = true;
}

It should work like the earlier example: <Defeat Reward: +x Mastery>.
@zaraku
This one doesn't seem to work.

I did the following and use the tag <Defeat Reward: +1 Mastery> but nothing happened.

1591341993482.png
@zaraku
This one doesn't seem to work.

I did the following and use the tag <Defeat Reward: +1 Mastery> but nothing happened.

View attachment 146641
It won't work if you put it in the js file, you have to set it here, but it's my mistake for mentioning earlier that you'd have to edit the plugin.

1d733b3a7c500fa7fd42c9ffc99c4aef.png
Now working, brilliant addition, thank you.
@zaraku
I've thought something, and please do let me know if I'm getting annoying.

Is it possible, via the Note field again, to add effects only if the skill has reached a given level of Mastery.
For instance (just for the sake of giving a concrete example), if Mastery level > 6, the skill adds a debuff to the enemy?
@zaraku
I've thought something, and please do let me know if I'm getting annoying.

Is it possible, via the Note field again, to add effects only if the skill has reached a given level of Mastery.
For instance (just for the sake of giving a concrete example), if Mastery level > 6, the skill adds a debuff to the enemy?
It's probably better to use Skill Core notetags in that case, unless you want to edit the Skill Rewards effects, but that would mean you can't ever use those effects for skills that have a master level <= 6.

An example of the former would be:

<Post-Damage Eval>
if (user.skillMasteryLevel(item.id) > 6) {
target.addDebuff(0, 2); // debuff mhp for 2 turns
}
</Post-Damage Eval>

For the latter, go to the effect code that you wish to alter (again, this will apply universally). In this case we're adding a debuff:

JavaScript:
} else if (data.match(/ADD[ ](.*)[ ]DEBUFF,[ ](\d+)[ ]TURN/i)) {
  var str = String(RegExp.$1).toUpperCase();
  var turns = parseInt(RegExp.$2);
  var paramId = DataManager.getParamId(str);
  if (paramId >= 0) {
    user.addDebuff(paramId, turns);
  } else {
    skip = true;
  }
  animation = animation || debuffAnimation;

If there's already an if condition, you can just add "&& user.skillMasteryLevel(skill.id) > 6" to it, like this:
if (paramId >= 0 && user.skillMasteryLevel(skill.id) > 6) {

If not, just add "if (user.skillMasteryLevel(skill.id) > 6)" right before the code(s) that add the effect:
if (user.skillMasteryLevel(skill.id) > 6) user.addDebuff(paramId, turns);

Also be aware that for checking mastery level, skill core would use "item.id" while skill rewards uses "skill.id".

Original thread: https://forums.rpgmakerweb.com/threads/yep-skill-mastery-effective-also-out-of-battles.122381/