MV Giving DoTs an Element? (Yanfly)

Ok, so I have some DoT states that deal damage via <Custom Regerate Effect> notetags. The formula I use within the notetag accounts for the target's element rate as well. However, that only affects the damage/result value. I'd like to know how I can "tag" the DoT so that the game knows it's of a certain element. That way, if a character had a passive skill that did something whenever they are damaged by Fire, for example, the DoT from a Burn state would proc it. Btw, the <DoT Element: x> & <DoT Formula: x> notetags won't work in my case due to some plugin incompatibilities, so that's why I use <Custom Regerate Effect> instead.

Edit: Here's a highly simplified DoT formula to show what I got so far...
JavaScript:
<Custom Regerate Effect>
var value = Math.round(target.elementRate(4) * 100);
target.gainHp(-value);
</Custom Regerate Effect>

So if the target had a notetag like the following, the above DoT should trigger the effect...
JavaScript:
<Custom React Effect>
if (value > 0 && this.isHpEffect() && this.getItemElements().contains(4)) {
  //Do stuff...
}
</Custom React Effect>
This is my curse state, it's VERY weak, but has a long duration. But what makes it interesting is that every time the afflicted is hit by a specific element, the damage this state inflicts increases. This effect should contain what you're looking for.

Spoiler: Check for Element
<Custom Apply Effect>
if (target._stateTurns[75] >= 60) {
target._stateTurns[75] = 60;
}
this._curse = 1;
</Custom Apply Effect>

<Custom Apply Effect>
target._magicEffect = Math.ceil(origin.mat * 0.2 * target.elementRate(7));
</Custom Apply Effect>

<Custom Remove Effect>
target._magicEffect = undefined;
</Custom Remove Effect>

<Custom Regenerate Effect>
this._curse += 1;
if (this._curse > 3){
target._magicEffect = target._magicEffect || Math.ceil(origin.mat * 0.2);
// target.startAnimation(12);
target.gainHp(-target._magicEffect);
target.startDamagePopup();
if (target.isDead()) {
target.performCollapse();
}
target.clearResult();
}
</Custom Regenerate Effect>

<Custom Respond Effect>
if (target.result().hpDamage > 0) {
var elements = this.getItemElements();
while (elements.length > 0) {
var element = elements.shift();
if (element === 7) {
target._magicEffect = target._magicEffect + Math.ceil(origin.mat * 0.2 * target.elementRate(7));
target.startAnimation(149);
}
}
}
</Custom Respond Effect>
The issue here is that the react tag doesn't happen during the regenerate phase. React only happens when the afflicted battler is the target of a successful action. Since the damage is being done outside of an action, react effects do not trigger from it.

The quick solution would be the cause the DoT damage to be an action of some kind, likely through a forced action, which would trigger react effects on the target. Unfortunately, that'll probably cause issues, as traditionally forced actions are all kinds of buggy.

Another solution might be to set a flag on the target when they take DoT damage, and then have the react effect moved to a custom regenerate effect with a lower priority. However, this would cause issue where the react effect would happen every turn, regardless of whether it was triggered or not, so you'd need to probably keep the react section, and block off the regenerate section with an if check to make sure the flag was on first. Then after, make sure to turn it off again.

Code:
<Custom Regenerate Effect>
var value = Math.round(target.elementRate(4) * 100);
target.gainHp(-value);
target._tookDotDmg = true
</Custom Regenerate Effect>
Code:
<Custom Regenerate Effect>
if (target._tookDotDmg) {
  //Do stuff...
  delete target._tookDotDmg
}
</Custom Regenerate Effect>
Thank you guys, this has been extremely helpful. 🙏

Original thread: https://forums.rpgmakerweb.com/threads/giving-dots-an-element-yanfly.131845/