MZ Increase Variable when Certain Target is hit

I trying to create thresholds so when a boss is hit by an actor's Action Sequence Common Event attack, that common event increases this threshold by X amount depending on the power of that attack.

How can I make it so the game check if the attack lands on the boss ? Like, if the attack damages the boss target, then increase this threshold by every successful hit.

If the attack damage a mob, don't increase the threshold.

If the attack is set to hit all targets, only increase the threshold by every successful hit on the boss.

By successful hits I mean it should increase the threshold each time it takes damage and not increase the threshold when ithe boss evades or the hit misses.

Each Action Sequence can hit a variety of times by calling multiple Action Effects so basically for every successful Action Effect that dealt damage, then increase the threshold (only if it damages the boss)

Using MZ.
it sounds like you can pull it off by making a passive for your boss that has a custom respond effect from yanfly's buffs & states and passive plugins to increase the threshold. you said its a variable, so with the assumption that its a game variable. youd hve to do something like this

JavaScript:
<Custom Respond Effect>
if (this.item().id==y){
$gameVariables.setValue(x, $gameVariables.value(x)+1);
}
</Custom Respond Effect>

itll check if the attack the boss is hit by is the skill youre looking for, and if it does damage, every time they take damage from that skill, that variable increments itself
EDIT: nvm, didnt see the MZ comment, but i do believe there are MZ equivalents for this, yeah?
it sounds like you can pull it off by making a passive for your boss that has a custom respond effect from yanfly's buffs & states and passive plugins to increase the threshold. you said its a variable, so with the assumption that its a game variable. youd hve to do something like this

JavaScript:
<Custom Respond Effect>
if (this.item().id==y){
$gameVariables.setValue(x, $gameVariables.value(x)+1);
}
</Custom Respond Effect>

itll check if the attack the boss is hit by is the skill youre looking for, and if it does damage, every time they take damage from that skill, that variable increments itself
EDIT: nvm, didnt see the MZ comment, but i do believe there are MZ equivalents for this, yeah?
Could work, but where would I place this? In the enemy notetag or a state notetag?
check if the attack lands on the boss ?
That depends on how do you define the "boss".

As described above there are many ways to do what you want, but they all depend on having a definition on what is the boss and what is a minion.
That needs to be marked or defined somehow before any solution can work.
For the base engine all enemies are identical and there is no automatic definition for "boss".

Again there are ways to do that, but we don't know which way will fit you best without more details on how your game defines that.
Could work, but where would I place this? In the enemy notetag or a state notetag?
what i gave would be a state by itself, and then you'd put <Passive State: x> into that boss's notebox to give it that passive, but what i gave before was for MV and the yanfly plugins. I believe Visustella for MZ has equivalents for passives and respond effects but I dont know if the tags are the same or not. I dont use MZ and never looked at visustella plugins to see the differences between it and yanfly's stuff
The exact implementation depends on what you mean by "increase the threshold". But if you want to increase the value of a variable by 1 every time a specific enemy takes damage, then (assuming you're using Battle Core), I believe you could put this in the enemy's note box in the database:

Code:
<JS Post-Damage as Target>
  if (this.isHpEffect() && value > 0) {
      $gameVariables.setValue(x, $gameVariables.value(x) + 1);
  }
</JS Post-Damage as Target>
Just replace both of the x's with the ID of the variable (without leading zeroes).

Original thread: https://forums.rpgmakerweb.com/threads/increase-variable-when-certain-target-is-hit.157585/