Is it possible to store all damage done by an actor as a variable

I want the damage to be stored with the variance for one actor across all of his skills. Would I have to put something in every damage formula box or is there a way using Yanfly's Plugins where I can store the damage after the attack?
I'd give the actor an invisible passive state using Yanfly's Auto Passive States. Put the following into the state's notebox (from Yanfly's Buffs and States Core):
JavaScript:
<Custom Establish Effect>
   $gameVariables.setValue(x, $gameVariables.getValue(x) + value);
</Custom Establish Effect>
Replace x with the id of the variable you want to store the damage in. Also use an event at the start of the game to initialize the variable at 0.
I'd give the actor an invisible passive state using Yanfly's Auto Passive States. Put the following into the state's notebox (from Yanfly's Buffs and States Core):
JavaScript:
<Custom Establish Effect>
   $gameVariables.setValue(x, $gameVariables.getValue(x) + value);
</Custom Establish Effect>
Replace x with the id of the variable you want to store the damage in. Also use an event at the start of the game to initialize the variable at 0.
Minor correction: the function for getting the value is just value, not getValue. This also wouldn't differentiate between damage to dealt to enemies and healing on allies, so it may not be as accurate as OP intended.
Minor correction: the function for getting the value is just value, not getValue.
Dang, I was like "that's so simple, I don't need to look it up." 😅

This method also counting healing should be fixable though. Instead put in the notetag:
JavaScript:
<Custom Establish Effect>
   if(this.isDamage())
      $gameVariables.setValue(x, $gameVariables.value(x) + value);
</Custom Establish Effect>
Dang, I was like "that's so simple, I don't need to look it up." 😅

This method also counting healing should be fixable though. Instead put in the notetag:
JavaScript:
<Custom Establish Effect>
   if(this.isDamage())
      $gameVariables.setValue(x, $gameVariables.value(x) + value);
</Custom Establish Effect>
Personally I would go with the condition

this.isHpEffect() && value > 0

to avoid including MP damage and ensure inclusion of drain effects.

Original thread: https://forums.rpgmakerweb.com/threads/is-it-possible-to-store-all-damage-done-by-an-actor-as-a-variable.152331/