MZ Scripting needed to track Skill Use in battle

Good evening world!

I am currently utilizing (and loving) Fomar 0153's Equipment Skill System (with the base AP system driving it). It works as intended allowing AP to be gained after each battle and adding that AP to the current skills being learned via equipment.

What I would like is to modify the focus of AP gain to be based on Skill use, rather than Enemies Defeated.

IE: Equipment Skill is Fire I. If Fire I is used 15 times Then Fire I is mastered/permanently added to that actors skill list.

This implies the equipment has the same skills it teaches as a trait. Else the Actor wouldn't be able to perform the skill.

If possible/easier integration of the AP system that exists in VisuStellas Skill Learm System would be a bonus!

Thanks in advance. Happy to clarify if I was unclear anywhere!
What I would like is to modify the focus of AP gain to be based on Skill use, rather than Enemies Defeated.
The trick is the Fomar plugins are really simplistic. They're pretty small, and not customizable - so to do that you would basically...well, not use it 😛 The entirety of the Fomar AP plugin is based on treating AP like EXP, so it's calculated by the enemies in the troop and all actors get the same amount. If you want it to be different, you'd just scrap that plugin.

However, within the Equipment Skill plugin is the function:
Code:
Game_Actor.gainSkillAP(skillId, ap)

So if you're using the VisuStella Battle Core, you can simply give your skills this notetag:
Code:
<JS Post-Damage as User>
if (user.isActor())
    user.gainSkillAP(ID, AP);
</JS Post-Damage as User>

where ID is the ID of that skill, and AP is how many AP you want it to gain each use.

Or, if you're using the Skills and States, you could give each actor a passive state with this notetag:
Code:
<JS Post-Damage as User>
if (this.isSkill())
    user.gainSkillAP(this.item().id, 1);
</JS Post-Damage as User>

I haven't tested that, but it should give you 1 AP for the current skill you just used without needing to put code into every skill's notetag.
Or, if you're using the Skills and States, you could give each actor a passive state with this notetag:
Code:
<JS Post-Damage as User>
if (this.isSkill())
user.gainSkillAP(this.item().id, 1);
</JS Post-Damage as User>
I haven't tested that, but it should give you 1 AP for the current skill you just used without needing to put code into every skill's notetag.
This did it! Tested as a per actor passive and global setting. Granted I need to add <ap: x> into each skill to dictate its meter; I am now tracking per skill used for Fomars system. Thank you so much!

Next challenge if you're up for it:

Do you reckon there's any way to have VisuStellas SkillLearn system dictate when the third skill in Fomars Equipment Skill, becomes usable?

ie:

"Skill X = Fire I
Skill Y = Water I
Skill Z = Simmer

In order for the Actor to Use Boil and start to gain AP for that meter, Fire I and Water I need to have been completed/mastered first:

1661412332897.png
"


The curveball I'm struggling to hit is the only way I see to make a skill usable in my system (and thus able to gain AP with your wonderful fix) is to add it as a trait to the equipment the way I did for fire and water; this would however make Simmer usable immediately. I want the player to have to work for it was this skill is essentially an evolution of the two. So the need is for access to Simmer to be possible only after the actor permanently learns Fire I + Water I via the AP system.

I know we can set skill learning prereqs with VS. Im wondering if using note tags alone can impact when the third skill appears here.

If we can prevent the use of Simmer until its prereqs are met then my entire game's Equipment based Skills system would be set (so far) and I can go back to writing actual story elements xD

Separate but related ask.

The Aftermath messaging "Player Learned Fire I" seems to only occur if it isn't a trait skill. Is there any way to make this sort of messaging appear when a the AP mastery is completed.

ie: If Fire I has been used 15 out of 15 times to satisfy the AP meter, THEN "Ryogeti has mastered Fire I" appears after battle/when it is permantly learned.


Thanks again for all your help here so far @ATT_Turan !

UPDATE: Complete missed that mid battle it does the "Fire I Learned" message after completing AP meter. Still would be nice to have the naming be Actor Specific and follow the aforementioned ^ text string during aftermath instead tho!

Lastly,

Is there a usable plugin so that once a Skill is "Learned"/Mastered then its damage output can be increased.

The logic being if they are first practicing an attack it would naturally be weaker compared to after doing the same attack some minimum of 15 times to master it
Holy cow, that's a lot.
Do you reckon there's any way to have VisuStellas SkillLearn system dictate when the third skill in Fomars Equipment Skill, becomes usable?

I know we can set skill learning prereqs with VS. Im wondering if using note tags alone can impact when the third skill appears here.
I don't think it would affect the AP system unless you add code to the prior notetag to account for it. However, in the instructions for the VisuStella Skills and States there's a section labeled "Skill Accessibility Notetags" that includes Show if Learned Skill: x.

Is there a usable plugin so that once a Skill is "Learned"/Mastered then its damage output can be increased.
There's no need for a plugin for that, just include it in the damage formula.

Holy cow, that's a lot.
I tried to break them into separate messages but the mods merged them lol
I don't think it would affect the AP system unless you add code to the prior notetag to account for it. However, in the instructions for the VisuStella Skills and States there's a section labeled "Skill Accessibility Notetags" that includes Show if Learned Skill: x.
I've tried adding the variant of that "<Show if learned All Skills: x,x,x>" since I have 2 skill prereq. If I remove the last comma, I get "Unexpected number in JSON at position 2" in game when i navigate the skills menu
1661464395205.png


However in game the skill "Simmer" doesn't become visible after Fire I and Water I are permanently learned via the Equipment skill AP meter
1661464744644.png
1661464876841.png

The irony being that the Skill Shop recognizes that the Actor "already knows" the attack
1661465007009.png


Thoughts?


There's no need for a plugin for that, just include it in the damage formula.
Noted. Ill learn me that next!
I've tried adding the variant of that "<Show if learned All Skills: x,x,x>" since I have 2 skill prereq.
That's incorrect syntax. You should not have a comma at the end if there's not another item, and you never use leading 0s before IDs.

I know that's how they're displayed in your database, but trying to do that anyplace in the editor or code will make it nonfunctional.
know that's how they're displayed in your database, but trying to do that anyplace in the editor or code will make it nonfunctional
VisuStella must be super sensitive cause those 0s don't hurt Fomars EquipmentSkills haha.

Regarding the addition comma. When I removed it previously I would get the "Unexpected number in JSON at position 2" error in game when i navigate the skills menu. I'll try it without the comma and the leading 0s and see how it goes
VisuStella must be super sensitive cause those 0s don't hurt Fomars EquipmentSkills haha.
I haven't looked very closely at Fomar plugins, but that is a syntax rule in JavaScript: numbers starting with 0 will be interpreted as octal value, which is never what any of us intend.

It's possible that you're looking at a plugin parameter field with a drop-down list that references the skill IDs as shown in your database but it doesn't actually use that printed value internally.
Gotcha!

Removing the 0s the the extra comma did it. The third skill is no longer usable until the preqreqs are satisified!!!!! TYSVM @ATT_Turan . If I ever get around to publishing you are definitely getting credited for how much you contributed here ^_^
Hey @ATT_Turan quick thing that came to mind in testing this morning.

Is there any way to have a message pop up like "Ryogeti can now use Simmer" once the skill learn prereqs have been satisfied in the Fomars Equip AP system.
use case:

Ryogeti uses Fire I twice in battle: "Learned Fire I"
Next battle Ryogeti uses Water I twice in battle: Learned Water I
These two already happen with the AP system^

Ideally afterThose 2 happen:

"Simmer can now be used"
Is there any way...
Um. Technically yes, but at first mental glance it would be tedious/complex to code.

What you're asking to do is every time you learn a skill, scan through the entire database of skills to see if there's another skill that can be used now.

And the only way I could think of to do that reliably would be to make some sort of list every time you enter battle of which skills each actor can use, then every time they master a skill make a new list and compare them.

Unless someone else has a different idea, that's what I can think of.
I guess the clearer ask would be to reverse engineer the "<show if all learned skills:> Note Tag Simmer is hidden by once those conditions have been met. That way once any skill per actor (granted this game will likely be primarily 1 actor only) that can now be used will announce as much.

I was thinking a workaround could be what I'm trying to accomplish with Felskis skill tree by having switch(es) activate once certains skill(s) are learned to enable the next node when needed.


As my wife has already said, I'm making this hella complicated and I recognize that lol. But such is the nature of trying to make a first if it's kind kinda system
I didn't read the back and forth between you @Ryogeti and @ATT_Turan because it looked like a lot, but wanted to recommend taking a peek at a "proficiency" plugin I wrote for myself that... well, tracks skill usage and allows you to define what happens when you reach X amount of usages in a given skill (or skills) by means of either plainly learning a skill or some arbitrary javascript snippet. It also enables a new "p" variable in damage formulas of skills so you could leverage it there, too, if ya wanted.

It is worth noting that I built it for use with JABS, and the data displayed currently is only implemented in my own custom skill screen, so it may not fit your needs precisely, but... perhaps it could work in tandem with other things if you wanted?

(if you opt to use the plugin, I'd encourage also reaching out directly to me for any additional help, this plugin is a part of my personal project so it hasn't been heavily tested outside of that context)
I didn't read the back and forth between you @Ryogeti and @ATT_Turan because it looked like a lot, but wanted to recommend taking a peek at a "proficiency" plugin I wrote for myself that... well, tracks skill usage and allows you to define what happens when you reach X amount of usages in a given skill (or skills) by means of either plainly learning a skill or some arbitrary javascript snippet. It also enables a new "p" variable in damage formulas of skills so you could leverage it there, too, if ya wanted.

It is worth noting that I built it for use with JABS, and the data displayed currently is only implemented in my own custom skill screen, so it may not fit your needs precisely, but... perhaps it could work in tandem with other things if you wanted?

(if you opt to use the plugin, I'd encourage also reaching out directly to me for any additional help, this plugin is a part of my personal project so it hasn't been heavily tested outside of that context)


While this does look to be a really dope plug in. Skill Usage translating to Skill Learning and Unlocking are already tied into the aforementioned plugin I'm using and has been thankfully solved for without me having to do too much advanced digging into any JS (I'm still a newb here). I will however keep a copy of your plugin to see how it might possibly address a related issue I am facing with enabling skills via a Skill tree
@Puppet Knight
If you still need the name of the character who learned the spell to work in Formar's Equipment Skills Plugin this is what I did.

In the line (116 on mine):
$gameMessage.add(TextManager.obtainSkill.format($dataSkills[skillId].name));

Change it to this:
$gameMessage.add(`${this._name} learned \\I[${$dataSkills[skillId].iconIndex}]${$dataSkills[skillId].name}`);

This will show the player who learned it and the skill icon/skill name. I changed the 'learned' to 'mastered' as it fits my needs better.
This was a big add!

Change it to this:
$gameMessage.add(`${this._name} learned \\I[${$dataSkills[skillId].iconIndex}]${$dataSkills[skillId].name}`);
Thank you a ton brother this is the exact thing I needed. I also will be using mastered xD

Original thread: https://forums.rpgmakerweb.com/threads/scripting-needed-to-track-skill-use-in-battle.150779/