MV Chrono engine raise variable upon attack contact?

So my idea here is fairly straightforward, I've done my best to browse through the help files of all chrono engines various plugins to find an attack note tag or a command I could use but I haven't found anything. Essentially I just want to raise a designated variable by a particular amount when an attack is used but only if it makes contact with an enemy
You use Yanfly Buffs and States core and the patch for it in my Chrono Engine Advanced guide

Most Buff and State Core scripts will work fine in Chrono Engine


Relevant

If this effect is tied to the weapon you could also use the chain action hit comment to make the user use a blank follow up tool that increases a variable instead of Buffs and States core. It's just two ways to do it
You use Yanfly Buffs and States core and the patch for it in my Chrono Engine Advanced guide

Most Buff and State Core scripts will work fine in Chrono Engine


Relevant

If this effect is tied to the weapon you could also use the chain action hit comment to make the user use a blank follow up tool that increases a variable instead of Buffs and States core. It's just two ways
Disregard, figured it out.

You use Yanfly Buffs and States core and the patch for it in my Chrono Engine Advanced guide

Most Buff and State Core scripts will work fine in Chrono Engine


Relevant

If this effect is tied to the weapon you could also use the chain action hit comment to make the user use a blank follow up tool that increases a variable instead of Buffs and States core. It's just two ways to do it
Ok... so I have a state applied to my attack that lasts for 1 turn and using Yanfly's buffs and state core along with your patch I have the notetag:

<Custom Apply Effect>
$gameVariables.setValue(42, $gameVariables.value(42) + 1);
</Custom Apply Effect>

on the state I mentioned. Game boots up and runs fine until I strike with the attack in question, then I get the error "Cannot read property 'textColor' of undefined".
Could you press F8 or F12 when that error pops up and get the console log? I think it's from MOG_DmgPopUpEffects but not sure.
Could you press F8 or F12 when that error pops up and get the console log? I think it's from MOG_DmgPopUpEffects but not sure.
BuffNStatesError.png

I have no idea what I'm looking for here or how to read this so I'll just send a screenshot
Oh, it's coming from the Show Turns parameter in Buffs and States core. I'll have to look into it. Turn it off and it'll work
1748228426527.png
Oh, it's coming from the Show Turns parameter in Buffs and States core. I'll have to look into it. Turn it off and it'll work
View attachment 341496
Awesome, works perfectly now!

Here's a question for you though, The killing blow on any enemy doesn't seem to count. The variable increases on all hits fine until the enemy gets knocked out
Hmm, is that also an issue in the regular battle scene or is it Chrono Engine specific?
Hmm, is that also an issue in the regular battle scene or is it Chrono Engine specific?
Ive only tried it using the chrono engine battle system

I'm wondering if maybe the state just isn't counting because its registering the enemy as dead before it can be applied?
Well, I asked because it would narrow down where to look to fix it.
Well, I asked because it would narrow down where to look to fix it.
It was because the knockout state was registering before the variable state. I fixed it by setting my attack to run a switch that starts a parallel common event that waits for a portion of a frame before turning itself off and then using chrono engine and setting a switch to go off when the enemy dies I run another parallel event in the background that checks if the attack switch is on and adds one to the variable if it is.

Original thread: https://forums.rpgmakerweb.com/threads/chrono-engine-raise-variable-upon-attack-contact.177843/