How could I give an enemy a state upon attacking an ally with a state?

Hello all you cool RPG people. This is my first post here, so sorry if I've missed a similar question that's already been answered or if I've done something wrong. I'm also not too experienced with RPG Maker, so you may have to bear with me.

I'm trying to make a piece of armor that, if the wearer is hit by an enemy, will cause that enemy to gain a state (state #5). I'm using the Yanfly AutoPassiveStates plugin, so having the armor equipped will automatically inflict an invisible state on the user (state #13). Now I just need to figure out a way to make an enemy attacking an ally with state #13 to cause that enemy to gain state #5.
I'm sure that there's probably a way to script this, but I'm not knowledgeable in writing script at all. Any ideas? I'm open to any plugins that would make this possible if needed
You only need Yanfly's Buffs & States.

Code:
<Custom React Effect>
if (this.isDamage() && value>0)
    user.addState(5);
</Custom React Effect>
You only need Yanfly's Buffs & States.

Code:
<Custom React Effect>
if (this.isDamage() && value>0)
    user.addState(5);
</Custom React Effect>
Thank you!
I knew it'd be something simple. Works perfectly.

Original thread: https://forums.rpgmakerweb.com/threads/how-could-i-give-an-enemy-a-state-upon-attacking-an-ally-with-a-state.154141/