How do I make an enemy use an attack based on its own health, and not the players health? Yanfly goes into decent detail about how to base things off the player but nothing about how to base things off the enemy... I just need one solid example and I'll be good to go.
Yanfly Battle A.I help [I figured out how to do what I need, can close thread, thanks]
Javascript/Plugin SupportTry this:
Eval user.hp <= Math.floor(user.mhp * 0.5): Skill 10
In this instance, Skill 10 is usable when the user's HP is less than half Max HP.
Eval user.hp <= Math.floor(user.mhp * 0.5): Skill 10
In this instance, Skill 10 is usable when the user's HP is less than half Max HP.
How could I get that to work with >= or <=
I'm not quite sure what you mean since <= is already in the code I showed.
I'm tired, skipped right over that. I'll check it out and see if I can get it to work.
Edit:
Works like a charm, thanks!
Edit 2:
Is there a way to make this work while also making the enemy do the attack at random?
For example, Eval user.hp <= Math.floor(user.mhp * 0.2) Random 50%: Shadow Refuge. That syntax doesn't work but I want the enemy to first check to see if it's at 20% or less health then based on a random chance see if it will use the skill.
Original thread: https://forums.rpgmakerweb.com/threads/yanfly-battle-a-i-help-i-figured-out-how-to-do-what-i-need-can-close-thread-thanks.83659/