MV Conditional Branch Checks Entire Party Instead of X Actor?

Hi, this might make some people laugh but.

So in my monster collecting fan-remake game im making, when the actors eat food they get a bathroom state at a 25% chance.

There are toilets around the map that would remove the state. The issue is, I need it to be done through a conditional branch that checks the entire party for the state, instead of x actor for the state (I have over 1500 actors and that event would be so long it would probably lag if i did a conditional branch for each actor check..)

It has to check for the state to remove it because I also have to add a "care point" when the toilets are used if they need to go bathroom. Otherwise, they cant use the toilet and dont get any extra care points.

Is there any plugin/script call that I can use to check the entire party for the state, then use it in a conditional branch?
How exactly are you handling the care points? Do you have a game variable for each actor? One variable as an array? How exactly are the toilet events set up? (Is it like one choice for the player "go to toilet" -> every party member that can uses the toilet? Or is it like "Actor A go to toilet", "Actor B go to toilet", ...?)
All I am looking for is a way to do is:

Conditional Branch
If
"Any Actor In Party" has Bathroom State <-- "the part I need." instead of x actor, x actor, x actor etc.
Then
Add Care Point to "afflicted Actors" and <-- "Other part I need"
remove bathroom state from afflicted actors.
Else
Show Text "None of your actors need to use the bathroom right now".
End

Edit:

Sorry made a mistake im tired lol fixed it.
If that information was relevant I would have mentioned it.
If that information was not relevant to my answer I would not have asked for it :rsrs:
Use the script option of the conditional branch and insert the following:
JavaScript:
$gameParty.members().filter(m => m.isStateAffected(stateId)).length > 0
Replace stateId with the ID of the bathroom state.

However I believe what you actually want is something like the following script (no need for conditional branches):
JavaScript:
$gameParty.members().filter(m => m.isStateAffected(stateId)).forEach(a => {a.removeState(stateId); a.addParam(3,1)});
However I could not provide you with that script if you didn't tell me how you are handling your care points.
Ah okay sorry about that thank you. I misunderstood. Sorry ive been up all night and am super tired. My apologies.

Ill try this out tomorrow 🙂


for the add param, what value references m.defense? 3?
@DevTP92

magic defense would be 5, here is the complete list for reference:

0 - Max HP
1 - Max MP
2 - Attack
3 - Defense
4 - Magic Attack
5- Magic Defense
6 - Agility
7 - Luck

Original thread: https://forums.rpgmakerweb.com/threads/conditional-branch-checks-entire-party-instead-of-x-actor.150823/