I am trying to make a state which increases the attack, but the state only triggers when the hero is affected by another specific state like poison, there is a skill in pokemon called guts which works exactly like this. Guts raises the ability-bearer's Attack by 50% when inflicted by a major status ailment (poison, burn, paralysis, freeze or sleep). I hope someone can help me with the javascript code to make it work
Yanfly Auto Passive States
Javascript/Plugin SupportYou need to set a custom passive condition that will be true if the user is afflicted with any "ailment" type state. To define what states count as ailments, and for an easy way to check if any of them are applied, look at Yanfly's State Categories- if you define a custom "ailment" category, apply that category to poison, blind, etc., and then make your passive state condition check for "user.isStateCategoryAffected("ailment")" then it should work out.
Well I put this in the custom state
<Custom Passive Condition>
if user.isStateCategoryAffected(ailment) {
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>
and I got this error
SyntaxError
Unexpected Identifier
then I tried this
<Custom Passive Condition>
if (user.isStateCategoryAffected(ailment)) {
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>
and I got this
ReferenceError
ailment is not defined
PD: I installed the BuffsState core aswell
It's "ailment" not just ailment. The quotation marks are important.
Personally, I would just do
exactly like that.
Personally, I would just do
Code:
condition = user.isStateCategoryAffected("ailment");
Now it works, that was it thanks for your help
Sorry for coming back to bother but I had a problem, when I try this for the first time I created 2 objects 1 that granted the buff status and the other granted the ailment status and everything works perfect with that, now the problem is that when the status ailment is given by a weapon or armor the buff status does not recognize it for some reason, if I remove the weapon that gives this state and apply the object that applies the ailment again it works. Another strange thing, if I apply the object first to add the ailment and then equips the weapon with the same status effect now appears twice in the same actor, its like the custom condition only triggers with status given by the program and not by the ones given by a plugin
What are you talking about when you say "object"? A state? A skill effect? Are you doing other custom javascript that you haven't mentioned?
Sorry I mean a consumable item that gives that state (bad english). Also i'm applying the passive state in the armor with yanfly passive state plugin
Original thread: https://forums.rpgmakerweb.com/threads/yanfly-auto-passive-states.106884/