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
187
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
187
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
187
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

Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:

Forum statistics

Threads
105,854
Messages
1,017,004
Members
137,562
Latest member
tamedeathman
Top