When using the auto-battle function on RPG Maker, the AI can leave a lot to be desired. In my case, when I was working on my game Crown Champion I found that my fighters often used a healing skill when their health was already full, which didn’t make much sense. I wanted to restrict that skill to when their health had dropped below a certain point, but I had no idea how to accomplish this without delving into the combat scripts somehow.
Thankfully, I discovered the “Custom Use Conditions” script by Himeworks.
This script allows you to restrict the use of both items and skills in your game depending on a wide number of factors. By default, you can only restrict the use of skills when you don’t have a certain weapon equipped, which is very limiting in a more complex combat system.
After installing the script, the formula I put in my note box for the healing skill was as follows:
formula: a.hp < 0.80 * a.mhp
This formula ensures that the actor can only use this skill if their HP (health points) are below eighty percent of their MHP (maximum health points), thus restricting the use of the healing skill if they have almost full health. If you wanted to set it to a different amount, say fifty percent, you would simply change 0.80 to 0.50.
You could download this full script here.