YEP Auto Passive States conditional passives based on number of enemies

Michael Caiola

The Stone Bull
Veteran
Joined
Sep 14, 2016
Messages
392
Reaction score
76
First Language
English
Primarily Uses
http://yanfly.moe/2015/10/17/yep-13-auto-passive-states/


I'm trying to add a passive state to a hero that increases his attack when there are more enemies. I know I need to use a conditional state, but I don't know how to code it.


So, if I want to create a passive state that doubles his attack when there are two enemies, I would use this actor notetag:

<Passive State: x> 


where x is the state ID. Then, I would add conditional js to the state notetag. This is the example code from Yanfly's website:

<Custom Passive Condition>
if (user.hp / user.mhp <= 0.25) {
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>


What do I change "user.hp / user.mhp <= 0.25" to in order to have the code check the number of enemies, returning true if it equals 2?
 

Silverskin

Villager
Member
Joined
Jun 21, 2016
Messages
27
Reaction score
11
First Language
English
Primarily Uses
if ($gameTroop.aliveMembers().length == 2)


that should be it, hope I could help :)
 

Michael Caiola

The Stone Bull
Veteran
Joined
Sep 14, 2016
Messages
392
Reaction score
76
First Language
English
Primarily Uses
That worked perfectly! Thank you!
 

Zeustiak

Veteran
Veteran
Joined
Oct 11, 2016
Messages
37
Reaction score
7
First Language
English
Primarily Uses
In order to set the condition to check whether the character has a state already applied, will one of the below work?  


user.state==PoisonState


or


user.state==State.X
 

Michael Caiola

The Stone Bull
Veteran
Joined
Sep 14, 2016
Messages
392
Reaction score
76
First Language
English
Primarily Uses
With my limited JS knowledge I'd say that looks right, but you might get more help posting your own thread with a specific title. It'll get your question more attention.
 

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

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,048
Messages
1,018,545
Members
137,834
Latest member
EverNoir
Top