MV [SOLVED] Need help with conditonal branch script/code in a skill's notetags

Ok so basically I want a skill, when used, to check the current target of said skill for a certain state, if the check turns out to be false I want the target to have a state applied to them. Only issue is I dont know what script to plug in where it says "code" to get the result I want, can someone please provide me with the script I would plug into the notetag of this skill to have that happen when the skill is used?
1755319868118.png
You can try this:
Code:
if (!target.isStateAffected(x)){
target.addState(y);}
With X being the conditional state, and Y being the state you wanna add (State ID)
I'll try this later once im home!
You can try this:
Code:
if (!target.isStateAffected(x)){
target.addState(y);}
With X is the conditional state, and Y is the state you wanna add
You can try this:
Code:
if (!target.isStateAffected(x)){
target.addState(y);}
With X being the conditional state, and Y being the state you wanna add (State ID)

Ok so it adds the state, BUT it does it DESPITE not having the state in the "if" script.
This is how I plugged it in so maybe I messed something up potentially?

Also how would I make it and "if else" statement as I want the state to be applied only when the current state isnt already applied to the target?
1755400400305.png
OH I GOT IT, NEVERMIND
I did some searching and got this to work the way I wanted to! Thank you for helping tho!
1755401167890.png

Ok so it adds the state, BUT it does it DESPITE not having the state in the "if" script.
This is how I plugged it in so maybe I messed something up potentially?

Also how would I make it and "if else" statement as I want the state to be applied only when the current state isnt already applied to the target?
View attachment 347617

Original thread: https://forums.rpgmakerweb.com/threads/solved-need-help-with-conditonal-branch-script-code-in-a-skills-notetags.179594/