Raise a variable when you hit a target for Weakness?

So strange question, one that I'm not sure is possible without a plugin. I want a variable to go up when the player hits a target for weakness. By weakness, I mean hitting a target with an element at or above 101% as defined in the enemy's traits window.

1579746930196.png

When the player uses a skill or attack that hits for fire on this particular enemy, I want to increase a variable of my choice by 1. The variable isn't specific to fire or this enemy, just any time an enemy has it's weakness exploited.

Is this doable through events or will this need a plugin? If it is doable but only through a battle event that processes whenver it's hit via a troop event, I don't think that will be viable, but please let me know how to do it anyway.
You can do this in the damage formula by using something like this:

Code:
if (b.elementRate(this.item().damage.elementId) > 1) {v[variableId]++}; damageFormula;

replace variableId with the id of the variable you want to increase. Also make sure the variable has a numeric value or this will not work. Replace damageFormula with the skills normal damage formula.

If you want this to happen on all skills I would advise a plugin rather than trying to use the damage formula or an event, just for simplicity's sake.
Yes, I understand. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/raise-a-variable-when-you-hit-a-target-for-weakness.117540/