Checking if Party Member x has State y

Hey everyone! So basically I'm making something where it needs to check if each party member has a certain state, and do stuff after. I can't use the If Actor x has State y because there are a few thousands of them.
So basically what I did is to store the 6 party member's Actor ID in a variable.

It looks like this:

$gameActors.actor($gameVariables.value($gameVariables.value(2))).???

(Basically, the var 2 store the current variable to use to get the actor's ID, and gradually increase in the loop.
So like, variable 2 = 18, then it will fetch the variable located in variable 18 which could be a goddamn 3000.)

What should I place instead of the ??? so that I can make a condition to check if the actor in that variable has a certain state?
Quick note, this is out of battle.
I can't tell you what the ??? should be replaced with, as I don't have MV with me right now. But the way you've got it, if variable 2 is 18, it will look at variable 18 and use that as the actor's id. That is not the state.
Yes, I know it will fetch the variable 18 as the actor ID, it's intended. As I said, in variable 18, 19, 20, etc. I stocked the Party Member 1, 2, 3, etc.'s actor ID. The variable 2 will keep increasing by 1 such as 18>19>20, fetching the variables that are in the variable of the same number.
Alternatively, it could be read as
$gameActors.actor((variable inside of 18)).??? - inside of 18, there is 4, so I want to check if the actor 4 has x state.
I've just copy pasted bluntly, but honestly the rest is irrelevant.
All I would love to is some help on how to ask the conditional branch "Does this actor has state x"
I've seen something similar in one of Yanfly's plugin which resembled to a.isStateAffected(x) but it seems that it's only for battles, as I
actually made something with isStateAffected(x) and it did work. Now I just need to know how to get it out of combat.
I might be totally wrong, that's why I'm asking for help. I've tried searching around and I couldn't get it to work.
I don't know if I even have a good lead with $gameActors.actor, but this is pretty much what I think is right.
I was just referring to your comment that

"So like, variable 2 = 18, then it will fetch the variable located in variable 18 which could be a cursing 3000." - you seemed to be indicating that variable 18 would have a state, not an actor id.

You should be able to use .isStateAffected(x) (that's the bit I wasn't sure of) - it uses a battler as the subject, and your $gameActors.actor() objects are battlers.

$gameActors.actor($gameVariables.value($gameVariables.value(2))).isStateAffected(20) will look at the value in variable 2, grab the value in that variable, use that as the actor id, and tell you if that actor has state 20.
Oh well it was just a small misunderstanding.

Also, I'm figuring out my problem. actor.isStateAffected(x) does indeed work, but the problem reign with Yanfly's passive state plugin - The states are here but not here at the same time. I tried adding the x state to every actor just before asking if .. actor had state x, and it worked. When I checked in the menu, I eventually saw twice the same state for some reason. What I want to do are basically "groups" (made with states) based on classes, and it will check if x actor is in this group. Since actor can change class in the game, I believe I can't just do it individually. Hell, I've tried the basic non-script way ("If: Actor is affected by State" from conditional branch) to check if my actor had the state, which it HAD, I could clearly see it and still had its own effect, but it still returned false.

I think I'll have to repost somewhere else to ask for help on that. Thanks for enlighting me, Shaz! Have a good day.
This is the first time you've stated that you're using a plugin. That's a really important thing to say right up front, otherwise people will make assumptions, like I did, and you'll end up going around in circles.

Good luck 🙂 I can't help you with the plugin as I've never used it.
Ah, well thanks. I just didn't think the source of the problem came from it, as all it does is apply states... Well, I guess I'll go on another board to make a thread about this. Thanks again! This thread can be closed.
If it's a plugin that modifies how states are applied, then it very likely modifies how you check to see if states are applied.

Just report your first post and ask for the thread to be closed, and a mod will take care of it 🙂
Thread closed IgnoreMe

Original thread: https://forums.rpgmakerweb.com/threads/checking-if-party-member-x-has-state-y.81532/