setting and using weapon variables in damage formula

If I want to store a variable based on weapon (and possibly also armor) equipped, and then use that in the damage formula of a skill, how do I do it? Do I need to run an event with control variables for every weapon at the beginning of the game, and then call those variables in the damage formula?

I want something like for example, long sword variable = 10. Then damage formula would be (a.atk - b.def) + long sword variable (i.e. 10)

Thank you in advance.
how different are those numbers?

by default MZ can assign different skills to be used as attack skill to the weapons, and using that with multiple skills would be the better solution unless you have literally hundred of different weapon numbers. And in that last case I would really question your game balance anyway...
The problem for me with using different skills per weapon is that I'd want the weapon variable bonus to be used even when different types of skills are used - whether that's attacking a single target multiple times, a multi-target attack, etc..
I'm a bit confused about the weapon variable part. You can already put values onto weapons and armor in how they modify parameters.

So how is what you're describing different from simply making your longsword modify ATK by 10? Then that would already be incorporated into your a.atk-b.def formula. And then if you needed to, like, add it more than once or multiply it or something, you can just reference the weapon's ATK value in your damage formula: a.weapons()[0].params[2]

...

To more specifically address your question...if you really need to have some extra value beyond what you're already entering into the database, you could add it as a notetag and then reference that notetag (the meta data) in your formula. I believe the syntax for that in MZ is slightly different than it was in MV, so I don't know it off the top of my head, but you should be able to Google it.
@ATT_Turan yeah...I'm brainstorming a way to use the 6 parameters for something else, while still having access to weapon variables.

Original thread: https://forums.rpgmakerweb.com/threads/setting-and-using-weapon-variables-in-damage-formula.151103/