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

Via conditional branch.

Just want to check if all live members are affected by a certain state
Conditinal branches within conditinal branches. Sense you want to check for all, it doesn't matter who you check for first. You also don't need an else branch, and you can check for a state in one of the conditinal branch pages

Edit, you can also check if there HP is above 0. First use conditinal branches checking for party members HP above 0 for each party member, those you might need to use else branches. Then for each alive member, check if they have the state. It might look like a mess when your done, but im sure it will work
Code:
var allState = true;
var party = $gameParty.aliveMembers();
for (i = 0; i < party.length; i++) {
      //x = state ID
       if (!party[i].isStateAffected(x)) {
           allState = false;
       }
}

// y = switch ID... such as 18
$gameSwitches.setValue(y, allState)

You can run this in a troop event.
Capture.PNG

You can also run this in a Common Event as well but it won't run correctly in combat if it is a Common Event.
And they will be protected by Allstate. Are you in good hands? 😛
Yay it works, thanks guys
Another possible option is Conditional Branch > Script:
Code:
$gameParty.aliveMembers.every(function(m) { return m.isStateAffected(5); });
This should be true iff all living party members are affected by state 5. In battle it'll only count members active in battle, on the map it'll include reserve members as well. 🙂
Ah both are very useful, I'll keep that in my notes, thanks guys!

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