How do I check if all ALIVE party members have a state?

What script do I need for that? Thanks
Although you ask for a script, I'm not moving this to JS Plugin Requests as this can be done with basic eventing.

Do a conditional check for each actor. Does the actor have the knockout state? If no, a second conditional checking for the state. Both these are on the second tab of the conditional commands.
I need a skill to damage all alive members with a death mark state.
I have 100+ actors and doing the conditional branch would be inefficient. I used this script

if ($gameTroop.aliveMembers().some(function(member) { return member.isStateAffected(X) })) {

to check if all enemies alive have a state and I just need a version of this script for the party.
I forgot to say they need to be at least 2

if ($gameTroop.aliveMembers().some(function(member) { return member.isStateAffected(X) })) { > 2
Try $gameParty instead of $gameTroop
It works! Thank you so much.
if ($gameTroop.aliveMembers().some(function(member) { return member.isStateAffected(X) })) {

to check if all enemies alive have a state and I just need a version of this script for the party.

I might have missed something, but are you sure that this works? Have you tested all of the cases (like when 2 party members have the state and 2 party members do not have the state)?

The thread title is "How do I check if all ALIVE party members have a state?" but you're using the some function. The some function is true if at least one party member (i.e. some) party members have the state.

Let me know if I misunderstood something about your question, but if I'm reading it right then I think we can help you a bit more to tweak it to work.
.some() checks if some members have the state. It will return true if they all do, but it will also return true if only one does. Your thread title says you want to know if they ALL have it, and then in a later post you said there needs to be at least two.

So which is it - ALL, ANY, or AT LEAST TWO?

Code:
$gameParty.aliveMembers().filter(function(member) { return member.isStateAffected(X) }).length > 1

in the Script line of a conditional branch will return true if at least two living party members have the state. It does not check for all of them though, so may need to be changed depending on what you actually want, which seems a bit up-in-the-air at the moment.
Oh sorry! I posted the wrong formula. This is what I used:
Code:
$gameTroop.aliveMembers().every(function(member) { return member.isStateAffected(100) })

I wanted ALL alive members but didn't know the party version of gameTroop.
It's all fine now.
Nice - I was looking for .all() but couldn't find it. Learned something new 🙂

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-check-if-all-alive-party-members-have-a-state.88781/