Getting hit by an element put enemy in state

I'm trying to make something similar to persona 5, where if certain enemies are hit by certain elements, they enter into a knocked down state. I am using yanfly's buff and states script and here is what I have as a passive state in my enemies notebox.

<Custom Respond Effect>

Get the element ID of the the attack the target received.

var element = this.item().damage.elementId;

// Check if it is damage based and if the element matches the interrupting element.

if (this.isDamage() && element === 2) {

self.add_state(33)

}

</Custom Respond Effect>

However when my enemy is hit by the fire element(element 2), they don't enter into this state, i'm wondering if I did something wrong.

Here is the link to the script being used.
http://www.yanfly.moe/wiki/Buffs_&_States_Core_(YEP)
I believe u need a semicolon after (33)
Like so:

if (this.isDamage() && element === 2) {
self.add_state(33);
}

I am assuming the syntax for everything else is correct, I haven't actually tried testing it out, but the semicolon thing was the 1st thing I noticed was missing.
I believe u need a semicolon after (33)
Like so:

if (this.isDamage() && element === 2) {
self.add_state(33);
}

I am assuming the syntax for everything else is correct, I haven't actually tried testing it out, but the semicolon thing was the 1st thing I noticed was missing.
Oh yeah I forgot about that, fixed that, but it still isn't working.
Hmmm....
Instead of

self.add_state(33);

use

target.addState(33);

I think that's all you need.
Hmmm....
Instead of

self.add_state(33);

use

target.addState(33);

I think that's all you need.

Thanks! it's working now, I also put "//" before the comment "Get the element ID of the the attack the target received."

Original thread: https://forums.rpgmakerweb.com/threads/getting-hit-by-an-element-put-enemy-in-state.114229/