Creating a conditional passive with Yanfly's Auto passive states plugin

I'm currently trying to create a passive where when the party is outnumbered by the enemies in a fight, a certain actor gets a power boost ( Something along the lines of boosting the attack and defense stats for example). Problem is, I'm a total noob at this and I don't understand anything about what Yanfly is talking about when he explains his how to do this in his ''Lunatic Mode'' thingy. Can someone explain to me what this means and how I can make it work like I want it to? Thanks in advance.
<Custom Passive Condition>
if (user.hp / user.mhp <= 0.25) {
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>

( That's Yanfly's formula for a conditional passive, which I don't get )
<Custom Passive Condition> is code that will evaluate the conditions for the state to trigger. This code goes in the Notes field of the state.

Now, as to how it works, basically if the code within those notes triggers the condition variable to be true (condition = true; ) then the state will activate.

In summary, for starters, what you want to do is to modify the logic in the if statement.

So, in your particular case this is what you want:
<Custom Passive Condition>
if ($gameParty.aliveMembers().length < $gameTroop.aliveMembers().length) {
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>


What the code above means is that if there are less party members alive than enemies alive, then activate the passive state.

Also, don't forget to set the Passive state on the actor or class or skill or weapon or armor you want this passive state to trigger on!
<Passive State: x>
Wow, thank you my friend! This all seems very complicated for someone with no experience like me, so thank you for actually doing the code I needed! Now I have to understand what those commas, $ and () mean so I can maybe do some codes myself.

One more thing : Should i put the <Passive State: X> before or after the other code? Or does i not matter?
Wow, thank you my friend! This all seems very complicated for someone with no experience like me, so thank you for actually doing the code I needed! Now I have to understand what those commas, $ and () mean so I can maybe do some codes myself.

One more thing : Should i put the <Passive State: X> before or after the other code? Or does i not matter?

<Passive State: X> goes anywhere in the Actor, Class, Skill, Weapon, Armor notes.

<Custom Passive Condition> goes anywhere in the State notes.

Since State is in a different set of data in the database, it does not matter if you do it first or after the actors, the engine figures it out during runtime 🙂

As for the commas, $, and ()...

It may look daunting at first, but once you learn programming (JavaScript in particular in this case), you will start to understand they are not as scary as they seem.
Alright, thanks for the tips buddy! So if i wanted to change the actor's face when the passive would activate, it would also be in the ''states'' tab right?
Alright, thanks for the tips buddy! So if i wanted to change the actor's face when the passive would activate, it would also be in the ''states'' tab right?

Changing an actor's face graphic based on the state is a more complicated request.

I'm not sure if Yanfly's current notes would support something like that. Maybe they do, but it would be some advanced coding.

Maybe someone else can chime in here.
I guess i could use a switch in certain fights that when activated changes the actor for another one for the duration of the fight, though i'd have to have both actors scale the same way somehow.
This is great though I do have a question that is very similar to this one. What I want to do is set up a skill that when learned (not activated) it gives a passive trait that allows the character to use a weapon group (like guns for an example)?
I think you could set up a passive state for that, but paired with a Custom React Effect (from Yanfly's Buffs and States Core) to change the image index of the actor's face to one that looks hurt.
This is great though I do have a question that is very similar to this one. What I want to do is set up a skill that when learned (not activated) it gives a passive trait that allows the character to use a weapon group (like guns for an example)?
This is literally one of Yanfly's examples on his site for that plugin:
Just instead of looping through the weapons, you'd have the state grant Equip whatever in its Effects.

Also, this is a 4-year old thread.
Necro-post notice: @Tigrean

Also, your question is not the same as the OP's. Please just start a new thread to ask your own question next time.

Original thread: https://forums.rpgmakerweb.com/threads/creating-a-conditional-passive-with-yanflys-auto-passive-states-plugin.74381/