Yanfly's Lunatic States help

Hi, so I'm using Yanfly's Lunatic States for VX Ace, found here.
https://yanflychannel.wordpress.com/rmvxa/battle-scripts/lunatic-states/

My goal is to create the state Flames, such that when the main character attacks an enemy who has Flames the main character is inflicted with a seperate state, Burning.

I tried to implement State A by making a state with the following notes:
Code:
<shock effect: COMMON SHOCK>

and in Yanfly's script, I edited COMMON SHOCK like this.

Code:
when /COMMON SHOCK/i
        $game_actors[32].add_state(57)

The problem is that when the enemy attacks the main character, COMMON SHOCK is also triggered for some reason.
I thought shock was supposed to trigger when the holder of the state takes damage, but it's triggering when the holder of the state deals damage as well.

How can I prevent this?


Side notes:

I reproduced the bug in a new project by adding the same notetag to a new state and giving it to a slime, and replacing the common shock script to poison the actor. So I'm pretty sure the issue is what I think it is.

I'm aware of the double looping bug in yanfly's lunatic states. the bug occured when I left the double loop in, and the bug still occurs as described when I take the two instances of the double loop out.
This post was a solution, I'm erasing it because it was wrong.

Still have no idea how to pull this off.
Alright, for anyone who wants to know, I figured it out.
Events under COMMON SHOCK will always happen when anyone takes damage, even when you don't call for a shock event.
To call a specific shock event with a specific state, include the notetag <shock event: YOUREVENTNAME> in your state.

Right above the "Do not edit under this line" comment, write a script with the same format as the common events, but with YOUREVENTNAME instead of COMMON WHATEVER. Whatever script you write there can then be called by <xxx event: YOUREVENTNAME> and will otherwise not run.

Original thread: https://forums.rpgmakerweb.com/threads/yanflys-lunatic-states-help.113146/