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

Sgt.Dude

Villager
Member
Joined
Dec 24, 2016
Messages
6
Reaction score
2
First Language
English
Primarily Uses
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 )
 

masterlobo

Veteran
Veteran
Joined
Mar 14, 2012
Messages
185
Reaction score
131
Primarily Uses
<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>
 
Last edited:

Sgt.Dude

Villager
Member
Joined
Dec 24, 2016
Messages
6
Reaction score
2
First Language
English
Primarily Uses
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?
 

masterlobo

Veteran
Veteran
Joined
Mar 14, 2012
Messages
185
Reaction score
131
Primarily Uses
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.
 

Sgt.Dude

Villager
Member
Joined
Dec 24, 2016
Messages
6
Reaction score
2
First Language
English
Primarily Uses
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?
 

masterlobo

Veteran
Veteran
Joined
Mar 14, 2012
Messages
185
Reaction score
131
Primarily Uses
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.
 

Sgt.Dude

Villager
Member
Joined
Dec 24, 2016
Messages
6
Reaction score
2
First Language
English
Primarily Uses
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.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Who knew a adding menu commands would be so hard for something that should be a basic feature.
When you discover great tileset resources that you completely forgot that you had. :kaomad3::kaopride:
Just got a better look at the MZ RTP. I'm very happy with it, especially the sci-fi tiles and sprites. Glad I pre-ordered.
I've just checked the VisuStella Plugins for MZ and there are already 11 plugins. The Yanfly team(perhaps a big one?) really works so effectively and efficiently that some MZ users can likely use tons of Yanfly plugins right after MZ's released (still 13 days from now). I wonder if any other plugin developer(or team) will try to compete with Yanfly this time, no matter how slim the chance to win is :)
Hello! :kaopride:I am new to RPG Maker, though I have been lurking the forums for a while. :kaoswt: Hope to make some friends and learn some stuff here! :kaothx:

Forum statistics

Threads
100,597
Messages
977,608
Members
132,202
Latest member
gerreh
Top