MV [SOLVED] Yanfly Action Sequences: checking state not working

I'm using Action Sequences and trying to implement a certain code on a Skill that has a chance of putting the target to sleep. If the target is put to sleep, it plays an animation. If the skill misses, however, it will instead display text showing that the skill failed. However, even though I am sure I got the code right, it doesn't seem to be working properly.

<target action> action animation wait for animation action effect if $gameParty.members[0].isStateAffected(10) == true animation 62: target wait for animation else common event: 62 end </target action>

1693180701591.png


I've double checked that state 10 is the sleep state. Common event 62 is the event displaying the text. There is only one party member, so the target will always be index 0 (though i tested with other numbers just in case).

Every time I use the skill, even if the target is put to sleep, it displays the text from the common event as though it had failed.

1693180667245.png


I have no idea what I'm doing wrong, my syntax looks fine as far as I can tell. I could use some guidance here.
What happens if you put parentheses around the if statement, i.e.

if($gameParty.members[0].isStateAffected(10) == true)
Uhh. I don't think you need "== true"
Tried both of these suggestions (individually and together), result was the same.

if ($gameParty.members[0].isStateAffected(10) == true) if $gameParty.members[0].isStateAffected(10) if ($gameParty.members[0].isStateAffected(10))
It's members(), not members

Action Sequences do not need the parentheses for if.

Also, note that what you're doing is a bit odd. You're checking member 0 of the party, when it seems to me you'd want to be checking the target of your attack.

Especially since you proceed to play the animation on the target, why isn't that what you're checking?
It's members(), not members

Action Sequences do not need the parentheses for if.

Also, note that what you're doing is a bit odd. You're checking member 0 of the party, when it seems to me you'd want to be checking the target of your attack.

Especially since you proceed to play the animation on the target, why isn't that what you're checking?
In retrospect, I must have copied over an argument from a script call and not from an action sequence; I thought I had the syntax right when I compared it to other sequences, but now I see what you mean.

To answer your question, that was just the first thing that came to mind. This is a short game with only one character, and this is an enemy-only skill, so member 0 is the one who would be the target of this skill.

I wasn't sure off the top of my head how to check the target of the attack, but I just guessed and put in
if target.isStateAffected(10) == true
And apparently that was correct! The Action Sequence now performs like it should.

I'm considering this solved, thanks for your help!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-yanfly-action-sequences-checking-state-not-working.160683/