Conditional Branch with State Afflicted

Hi, so basically I'm making a sort-of stance switching skill. When you use the skill, a common event will check which of two stances (which are just states) the user has afflicted then swap to the opposite one. The problem I'm facing is that since I want to have more than one party member but they each use this stance switching skill, I can't seem to check on a conditional branch for "if user of skill is afflicted by x state". Is there any way to do this? I'm fully open to anything involving scripting or external plugins.

Thanks,
Spak
no need for scripts.

most people use an invisible state for this.
you make a state without icon and without messages named "skill xy used" and have the skill apply that state to the user in addition to the common event.
then in the common event you check which user has that invisible state, do whatevery you want for that actor and then remove the state before the common event ends.
no need for scripts.

most people use an invisible state for this.
you make a state without icon and without messages named "skill xy used" and have the skill apply that state to the user in addition to the common event.
then in the common event you check which user has that invisible state, do whatevery you want for that actor and then remove the state before the common event ends.
Ok, the only thing I can't seem to find is how to check which party member has "skill xy used" applied. I'm assuming it's in conditional branches.
Do you want me to make a different branch for every party member with "check if x member has state afflicted"?
Yes, you'd need to check all possible actors with the approach Andar describes.

Alternatively you can do this via the damage formula, e.g.
Spoiler: Damage formula
JavaScript:
if (a.isStateAffected(20)) { a.removeState(20); a.addState(21) } else { a.removeState(21); a.addState(20) }; 0
I.e. swap states 20 & 21, then do 0 damage or healing, depending on the skill's Damage Type. You can change the numbers as needed~

Original thread: https://forums.rpgmakerweb.com/threads/conditional-branch-with-state-afflicted.130982/