Skill SelfVariables

Requesting a small script where skills have their own variables stored per actor that can be accessed via script calls and in-battle grabbing the actor id then skill id.


I know of the Skill Proficiency Plugin however that plugin is incompatible with my current plugin setup (Yanfly Library) and the creator hasn't been active since November of last year


(Plugin in question)
Can you give an example of use?
For skill formula's, I'd imagine something like a.skill_var(skill_id) or skill_var(actor_id,skill_id) and the latter for a script call outside of battle.


The main usage of this will be to simulate skill levels/experience with only the experience factor. I'll primarily be increasing the variable via script calls (I can run a comment event if I need to increase it in battle). I figured it would be easier to approach using actual skills instead of tagging the actor with the variable.
use 

Code:
a.skillSelfVar = a.skillSelfVar || [];
a.skillSelfVar[x] = 'variable here';
Where would this go?


A script call tells me a is not defined.
Where would this go?


A script call tells me a is not defined.

the skill lunatic mode
That would cover the damage aspect, but there is no way to set this value before battle starts. I'm also pretty sure the variables can't be called outside the skill itself unless it's global.
Just make a script call with:


$gameActors.actor(actorId).skillVariables = {}
$dataSkills.forEach(function(skil) {
   if (skill) $gameActors.actor(actorId).skillVariables[skill.id] = 0;
}


This can be done anywhere, anytime, although it's better if done at game start to avoid issues, and should be done for each actor.


use this script call to set/change them


$gameActors.actor(actorId).skillVariables[skillId] = X // set the skill variable to X


$gameActors.actor(actorId).skillVariables[skillId]++ // adds 1 to the skill variable


You can use them in damage formulas with: a.skillVariables[skillId]


Or outiside of forumlas with: $gameActors.actor(actorId).skillVariables[skillId]


for example, to add the value of the skill Id 10 to the default attack damage formula you can use:


a.atk * 4 - b.def * 2 + a.skillVariables[skillId]
Works like a charm, thanks for the help everyone
@Lowell


Just a side note. This will work only for actors. If you have skills that use variables for enemies call this at the start of each battle (with a plugin or troop events)

Code:
$gameTroop.enemies().forEach(function(enemy) {
  enemy.skillVariables = {}
  $dataSkills.forEach(function(skil) { 
     if (skill)enemy.skillVariables[skill.id] = 0;
  }
}

Original thread: https://forums.rpgmakerweb.com/threads/skill-selfvariables.59185/