Binding complex conditionals to Yanfly Auto-Passive State Lunatic Mode?

Hey, first off, sorry for another script question. I've been going through the internet but still haven't found a way that works for what I want. I get a "SyntaxError: Unexpected End of Output" when I try to play test. Could anyone look through my code, see where I went wrong?


<Custom Passive Condition>


if (user.isStateAfflicted (25) && user.hp / user.mhp <= 0.60 && user.hp / user.mhp > 0.40) {


condition = true;


} else {


if (user.hp / user.mhp <= 0.40 && user.hp / user.mhp > 0.25) {


condition = true;


} else {


condition = false;


}


</Custom Passive Condition>


This code is going in a passive state. The passive state is a type of "death spiral" in that, originally, the actor's stats decrease a bit when their max hp falls below 40% of their max. I'd also like to be able to "layer" the spiral, in that there are three states that pass into one another as the actor's health gets lower and lower (hence the part where it states "user.hp / user.mhp >= 0.25".


Now, the aforementioned is easily obtained by using the standard passive conditions of <Passive Condition: HP below 40%> and <Passive Condition: HP above 25%>. However, I want to give one of my classes a skill that boosts their Aggro Rate and evasion skills (evasion, crit evasion, magic evasion), as the class is an evasion tank. The drawback is that while the state is active, the spiral effects (called Weary, Fatigued, and Exhausted) activate at higher HP percentages (Weary from 60%-40%, Fatigued from 40%-25%, and Exhausted at below 25%).


I don't know where I went wrong with my code, but the way I see it is:


If the user has state 25 (my evasion tank's self-buff state), AND the user's current health is at or below 60% of maximum, AND the user's current health is above 40%, the condition is True. If not, and the user's current health is at or below 40% of maximum, AND the user's current health is above 25% of maximum, the condition is True. If not, the condition is False.


I really wish I was able to figure this out on my own because I want to learn JavaScript (so I'm not such a burden on you all 😛), but I can't figure this one out. Sorry! Any help is much appreciated!
It is "user.isStateAffected(25)" without blank spaces.  🙂
Hmm... It's still giving me "Unexpected End of Input"... 🙁
@feliaria


I don't know if you're properly formatting your code, but this is how it looks:


if (user.isStateAfflicted (25) && user.hp / user.mhp <= 0.60 && user.hp / user.mhp > 0.40) {
condition = true;
}
else {
if (user.hp / user.mhp <= 0.40 && user.hp / user.mhp > 0.25) {
condition = true;
} else {
condition = false;
}


See the problem?

It is "user.isStateAffected(25)" without blank spaces.  🙂

Spaces don't matter for function calls.
@Tsukihime So, should it look something like this, then?


if (user.isStateAfflicted (25) && user.hp / user.mhp <= 0.60 && user.hp / user.mhp > 0.40)


   { condition = true; }


else


   if (user.hp / user.mhp <= 0.40 && user.hp / user.mhp > 0.25)


      { condition = true; }


   else


      { condition = false; }


EDIT: That just gave me "TypeError: Undefined is not a function"


What if I did this, instead? I make two states for each of the spiral effects. On the one, I put:


if (user.isStateAfflicted(25))


   { condition = false; }


else


   if (user.hp / user.mhp > 0.40)


      { condition = false; }


   else


      if (user.hp / user.mhp <= 0.25)


         { condition = false; }


      else


         { condition = true; }


That should be saying, "If the user has state 25, then the condition is false. If not, if the user's current health is above 40% of maximum, then the condition is false. If not, if the user's current health is below or equal to 25% of maximum, then the condition is false. If not, the condition is true." The second state would then have this condition:


if (user.isStateAfflicted(25) && user.hp / user.mhp <= 0.60 && user.hp / user.mhp > 0.40)


   { condition = true; }


else


   {condition = false; }


SECOND EDIT: No... That's still not it... Mrgrgr...
I didn't know that spaces don't matter for function calls, thanks for pointing it out (I'm still learning too =))


There is a spelling error, I should have been more clear: user.isStateAffected not user.isStateAfflicted. 


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


This works fine to me =)
Your braces don't match.
Okay, thanks for the help Tsukihime!


Also, that code worked. Thanks, Leunam! 🙂

Original thread: https://forums.rpgmakerweb.com/threads/binding-complex-conditionals-to-yanfly-auto-passive-state-lunatic-mode.61526/