MV (YEP) Auto Passive States: Custom Condition Targeting?

Hi there. I couldn't figure this out after a few days of research and trial and error, so I decided to bite the bullet and just ask.

I've been fiddling with the Auto Passive States (YEP) plugin, trying to see if I could somehow set it up to apply passive states to an actor when they are in a specific party position. Basically if an actor is in position 0, they get passive state A, but if they are in position 1, they get passive state B, etc.

Unfortunately, I can't quite seem to figure out a way to set it up so that only the actor that actually triggers a custom condition gets the state. As long as the condition is fulfilled, the state applies to every potential target instead. So if I set a state to trigger if an actor is in position 0, all potential actors get passive state A regardless of where they are.

I did come up with a work-around, but it's kind of cumbersome. If I allocate a passive state to only to a specific actor, and give it the following condition:

Code:
  <Custom Passive Condition>
  if ($gameParty.members().indexOf($gameActors.actor(X)) == Y) {
    condition = true;
  } else {
    condition = false;
  }
  </Custom Passive Condition>

This lets me apply a specific passive state to actor (X) only if they are in a specific party position (Y). This does do what I want, but it would require me to make separate duplicate states for every actor in every position to actually implement. Not ideal.

Is there a better way to do this that I haven't figured out? It seems like there has to be, but my actual coding/Javascript ability is basically just amateur tinkering level, so I could be mistaken.
My first thought is that you could instead use Yanfly's Buffs & States plugin to just make states that change how they act based on the battler's position in the lineup. If every actor automatically had this state passively, then it would probably work as you want it to, unless the effect you want the state to apply is somehow unachievable through code.
Code:
  if ($gameParty.members().indexOf($gameActors.actor(X)) == Y) {
This is the wrong approach - you don't want to be checking for specific actors in your notetag, you want to know where this actor that has the state is.

The plugin instructions give you access to the user variable to reference that actor.

So you'd just do:
Code:
<Custom Passive Condition>
condition=user.index()==Y;
</Custom Passive Condition>

Then you can have a passive state per position.

You can also try what @caseorogue said and change what the state does depending on the actor's position in the party, but you may find that more challenging to achieve than just having the 4 (or whatever) passives.
Ah! I thought there might be some way to use the "user" variable to target the party position, but I couldn't quite figure out the syntax based on examples I could find. Thanks, that works.

Making a single state that changes it's effects based on position is an interesting idea I hadn't considered, but in this case I think having multiple, simpler states be easier. I'll keep that option in mind though.

Original thread: https://forums.rpgmakerweb.com/threads/yep-auto-passive-states-custom-condition-targeting.156486/