How to make Tonberry Everyone's Grudge attack skill?

I tried searching the forum and couldn't find anything.


I want to create a skill that can be used by both enemy and player characters that will deal more damage based on how many times a specific kind of enemy is killed. I know I can create a variable each time a specific kind of enemy is defeated, but how do I then tie this variable to the damage of a skill? I assume Yanfly's Equip plugin can I'm not sure how. 
just add the variable to the damage formula


you can use v[id] to get the value of the variable. Then the rest is math.
Thanks for the advice, I'll look for that. 
Yeah, adding v[id] is just causing the game to crash.


I saw an answer on a different forum ( https://rpgmakermv.co/threads/how-do-you-refernce-a-variable-in-the-damage-formula.454/ ) but when I replicate what he did, it doesn't do anything but crash the game. 


My damage formula for the skill right now looks like


v[004] * 50 + a.mat * 2 - b.def * 4 - b.mdf * 2


It says 'Unexpected error syntax token {' every time. 


I've tried different variations of v(004), v004, $gameVariables.value(004) and $gameVariables.value004


Update: Nevermind on that. I tried doing a normal attack and it caused the error, too. turns out it was Yanfly's Damage Core plugin that was causing the error. Not sure why.....got to figure that out.


Anyway, the damage formula that is working for me is,


$gameVariables.value(004) * 50 + a.mat * 22 - b.def * 4 - b.mdf * 2


just replace 004 with whatever your variable number is. 

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-tonberry-everyones-grudge-attack-skill.57742/