MV Plugin to activate Switches when swapping party members in Yanfly Party System

I'm looking for a plugin or other method to turn switches on/off when you swap party members in the Yanfly Party System menu.

I want to have it so when "Party Member A" is with you, it turns on a switch linked to them, and then when that character is k/o'ed or swapped with another character in your roster, it turns off the switch.

My reason for this is I want to have some cutscenes that only happen if you have specific party members with you, and to have it so specific parallel common events will only be on when switches corresponding to those party members are active.

The plugin doesn't need to be reliant on the Yanfly Party System, but I do need a solution that is compatible since I'm using it for my project.
Why do you need a switch for this? Just directly check if the actor is in your party. You can do that either in the event conditions panel or in a Conditional Branch command.
Why do you need a switch for this? Just directly check if the actor is in your party. You can do that either in the event conditions panel or in a Conditional Branch command.
I tried that, but the event still runs even if the party member isn't in the active party. I want the event not to run when they're in reserve.
I tried that, but the event still runs even if the party member isn't in the active party. I want the event not to run when they're in reserve.
what scriptcall did you use?

is it during battle or on map?

as base scriptcall: $gameparty.members()[1] (2nd actor) can be in party.
use $gameParty.members()[0] or $gameParty.leader() as first members.

we don't know how you check the members though.

if you use 1 or use || than it pick one that is true instead, use && to make sure
each one is true.

but the better way is to check actors ID here, not the party members.
so you did something wrong.
You can use the following code in a Conditional Branch to check if a specific party member is a part of the active party.

$gameParty.battleMembers().contains($gameActors.actor(X))

Change the X to the ID of the actor you're checking for.
what scriptcall did you use?

is it during battle or on map?

as base scriptcall: $gameparty.members()[1] (2nd actor) can be in party.
use $gameParty.members()[0] or $gameParty.leader() as first members.

we don't know how you check the members though.

if you use 1 or use || than it pick one that is true instead, use && to make sure
each one is true.

but the better way is to check actors ID here, not the party members.
so you did something wrong.
Ah that's probably why. I wasn't using a script call I was just doing a conditional to check if they were in the party like this.

1773001058392.png


Using the script call Sword_of_Dusk wrote and nesting that in a conditional to check if the party member is dead I get something that looks like this.

1773001245091.png

The scripts inside are copied from this post by AquaEcho on how to make characters fight in the overworld in Cross Engine. Important, because I'll be having a common event like this running for each recruitable party member.

This setup seems to make this (and I assume anything else I put in the second if statement) work how I want it to. The only thing I'm worried about then is having a bunch of parallel common events running because I would have to do this for each party member.
you can shorten it:

if: [0,1,2,3].includes(s => $gameParty.members())[s] === $gameActors.actor(X)

I need to check how I did a check like this in one of my plugins as I saved it.
so if actor ID = member 0,1,2,3 than do stuff.

if you run the parallel, it wont run on the map. so you probably
need to check position + actorID somewhere.

I don't know if you want only 1 check or check each actor to have something different.
as if you need to check 3 actors, you can do it nested, or use a conditionBranch+ plugin.

I made one that is optimized from the conditionBranch++ plugin and fixed some bugs.
as its cleaner, its also to make different kind of checks and can be extended if needed.

so while you use ChronoEngine from MOG based on the variables, you need to explain
what you exactly look for and doing, so we can give you the right approach.
you can shorten it:

if: [0,1,2,3].includes(s => $gameParty.members()) === $gameActors.actor(X)

I need to check how I did a check like this in one of my plugins as I saved it.
so if actor ID = member 0,1,2,3 than do stuff.

if you run the parallel, it wont run on the map. so you probably
need to check position + actorID somewhere.

I don't know if you want only 1 check or check each actor to have something different.
as if you need to check 3 actors, you can do it nested, or use a conditionBranch+ plugin.

I made one that is optimized from the conditionBranch++ plugin and fixed some bugs.
as its cleaner, its also to make different kind of checks and can be extended if needed.

so while you use ChronoEngine from MOG based on the variables, you need to explain
what you exactly look for and doing, so we can give you the right approach.
Apologies, it took me a minute to parse that, but I think I understand(?) I want to do a check for each actor, and I thought I would have to do each separately on a different common event page. I realize now, looking at what I'm doing, that I could do all the checks on one page nested or using a plugin as you suggest. For each actor I just need to check if they're in the active party and not dead, then do the Chrono Engine Code.
Apologies, it took me a minute to parse that, but I think I understand(?) I want to do a check for each actor, and I thought I would have to do each separately on a different common event page. I realize now, looking at what I'm doing, that I could do all the checks on one page nested or using a plugin as you suggest. For each actor I just need to check if they're in the active party and not dead, then do the Chrono Engine Code.
I can't help now to give you a one liner check, as if you have 3 different ways,
you can use jump to label, for the chrono, if false, it checks the next condition.
this way, you don't have to nest them really, so it will be small and effective.

if none helped by tomorrow, I help you out on how to do a short check.
I tried that, but the event still runs even if the party member isn't in the active party. I want the event not to run when they're in reserve.
Ah, I get it. You want to know if they're in the front line that goes into battle, not if they're in the party.

Ah that's probably why. I wasn't using a script call I was just doing a conditional to check if they were in the party like this.
Actually, this conditional does exactly what you want! …but only if you call it in battle.

If you need to know whether an actor's in the party during battle, just use this conditional. Otherwise, you can use a script call as others have been discussing.
Okay, sorry it's taken me a while to get back to this thread. I ended up hacking together something that works, but it is far from perfect. Here's my explanation for how I got there. Skip to the bottom for TL;DR

The primary reason I made this thread was that, while trying to implement AquaEcho's Fighting Followers in my game that uses Cross Engine, I ran into the issue of not being able to turn on/off the actor's AI as I was switching between them. It was causing bugs like the first recruited follower's ai shifting to the player-controlled character when they were swapped for another party member or dismissed.

(In my project, you only have two party members max at a time: the player-controlled character and their follower. You can switch your follower or dismiss them at any time in the menu. I'm using Yanfly Party System for this.)

Since each actor's AI is just a common event page that defines custom movement for them with TyrusWoo Follower Control, and I was just copying AquaEcho's example pages where the AI is turned on when they are first recruited and never turned off, I realized I would need a way to tell which character was following the player and only activate that one's AI.

Lacking the know-how to implement this because I am a dummy-dongo-brain, I made this thread asking for a plugin to just attach switches to the party members because that made sense to me at the time.

After learning what the script call was to check if a specific party member is a part of the active party, I just made a common event that checks if the actor is there and turns on their AI. It does this for each actor. Each actor has a separate common event that checks if they're dead, and if they are not, their AI works.

This is a messy solution, but so far it works. Here's a video of it.



TL;DR I just common evented the thread title instead of using a plugin.

Original thread: https://forums.rpgmakerweb.com/threads/plugin-to-activate-switches-when-swapping-party-members-in-yanfly-party-system.182785/