MZ Help Writing Script for use with Vizustella SillsStatesCore

Hello. I am using the Visustella SkillsStatesCore for the passive states options. I have created a passive state, and now would like to make a skill that triggers only if target enemy has said passive state. I've posted what I currently have below; but I'm brand new to JS and am not sure where the hiccup is. Currently the skill does not add the desired state. I am trying to make a skill called Turn Undead that when used on an enemy with the passive state "undead" it applies the state "stun". Is something incorrect with the JS I wrote, or what I am trying to do in general? Thank you for any help.

Undead State.png
Undead Enemy.png
Turn Undead.png
Turn Undead Common Event.png
Hello. I am using the Visustella SkillsStatesCore for the passive states options. I have created a passive state, and now would like to make a skill that triggers only if target enemy has said passive state. I've posted what I currently have below; but I'm brand new to JS and am not sure where the hiccup is. Currently the skill does not add the desired state. I am trying to make a skill called Turn Undead that when used on an enemy with the passive state "undead" it applies the state "stun". Is something incorrect with the JS I wrote, or what I am trying to do in general? Thank you for any help.

View attachment 254697View attachment 254698View attachment 254701View attachment 254702
states() doesn't include passives. You need to use b.hasState(105).

But also I would put this in a <JS Post-Apply> tag in the skill, rather than calling a common event.
Thank you so much for your quick reply. After playing around with the <JS Post-Apply> tag for a little bit, I was able to get my desired affect using:

<JS Post-Apply>
if (b.hasState(105)) b.addState(13);
</JS Post-Apply>

Thank you again.

Original thread: https://forums.rpgmakerweb.com/threads/help-writing-script-for-use-with-vizustella-sillsstatescore.155433/