The script supports formulas, so you could say
a.hp * 0.35 < a.mhpIf you want less than 35% of total HP
First of all, just in case anyone is reading this topic and tries to use the above formula: note that the 0.35 is on the wrong side of the equation. It should be
a.hp < 0.35 * a.mhp rather than the above.
I think Hime and Yanfly's scripts for this sort of thing are very useful. However, if you don't want to try them again, what you can do is modify the
skill_conditions_met? method directly (or alias it). The easiest, but ugliest, way to modify it would be to add a few extra conditions that specify that if a certain skill is being used, you need to have below a certain % of HP to use it. For an example where Skill 15 requires 20% or less HP and Skill 28 requires 35% or less HP, see the additions in
bold blue below. I haven't tried it myself, but I'm pretty confident it will work (if it doesn't, it's a variable scope problem that's not too hard to fix).
#--------------------------------------------------------------------------
# * Check Usability Conditions for Skill
#--------------------------------------------------------------------------
def skill_conditions_met?(skill)
usable_item_conditions_met?(skill) &&
(skill.id != 15 or (self.hp < self.mhp * 0.20)) &&
(skill.id != 28 or (self.hp < self.mhp * 0.35)) &&
skill_wtype_ok?(skill) && skill_cost_payable?(skill) &&
!skill_sealed?(skill.id) && !skill_type_sealed?(skill.stype_id)
end
I'm aware that the above is really bad "form" from a coder's point of view, but if you only have one or two skills that need this restriction, it will get the job done. If you have a big set of skills that work like this, there are much cleaner ways to do it that I or someone else could show you.
(There's one last way to do it - check the actor's HP in the formula box itself and have it do nothing if the actor's HP is too high. This won't gray the skill out, though - it will simply make the skill fail to do anything if it's used when the condition isn't met. As an example of a formula for a damage skill that requires 35% or less HP:
if a.hp < a.mhp * 0.35; a.mat * 6 - b.mdf * 2; else; 0; end should do it.)