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.
Where would this go?
A script call tells me a is not defined.
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