How to check if Variable has state OR if GameParty.members has state (Solved)

Hello.

I have been stumped on this for quite a while. I have a state that I would like to implement in my evented turn-based system. I have the state made, and the state gives the actor that has the state an extra turn. I have a lot of party members, so I figured that instead of saying "If Actor is affected by state," I would connect it to my GameParty.members.

That state works fine, but I need a script call that would allow me to check if each party member has the state by their placement and not by their actor ID.

Spoiler
1714711736075.png
I know the code is a little messy and I'm not entirely sure that this is the correct way to even consider doing something like this, but whenever playtest it, image 40 shows even when the variable (actor 1) isn't affected by state 8. Any idea?
No idea how your system works and the stuff in your event looks like it wouldn't work(?), but since you asked how to check party members by their positions, I think it's:

$gameParty.members()[X].isStateAffected(Y)

Where X is the position, starting from 0 and Y is the state id. That will return true if they have the state and false if they don't.
No idea how your system works and the stuff in your event looks like it wouldn't work(?), but since you asked how to check party members by their positions, I think it's:

$gameParty.members()[X].isStateAffected(Y)

Where X is the position, starting from 0 and Y is the state id. That will return true if they have the state and false if they don't.
wow! Thank you so much! I had tried a similar code to this one, I tried $gameParty.members(X).isStateAffected(Y), but I didn't realize that I needed that empty parenthesis there. I also didn't realize that that it started from 0 so that was messing me up. It works perfectly now. thank you!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-check-if-variable-has-state-or-if-gameparty-members-has-state-solved.168292/