Restrict skill until HP is low

● ARCHIVED · READ-ONLY
Started by Aurorain 9 posts View original ↗
  1. After looking around for awhile, I haven't found a way to seal a skill(restrict it, basically), until a specific actor's stat(HP in this case) reaches a certain point. I want a skill that my actor uses to be grayed out, until his HP reaches, say 35%, but conditional branches(unless I'm just not seeing it) can't produce percentage results. I've tried using various conditional scripts, like Yanfly's Skill Restrictions(which just did not have what I needed), and Tsukihimes(various ones...too many to list) which I honestly couldn't understand too well, or they didn't work at all.

    Is there a simpler way of going about this, or am I just overlooking something?  :(
  2. There are two scripts that give states when the actor has a certain amount of HP - one by Tsukihime and one by someone I don't remember.


    Configure them to apply that state when HP<35%, and then have that state add the skill as a feature (not learning it, just adding).
  3. If 'till tomorrow you still can't solve this problem, I'll try to look at what I can done. Unfortunately it's almost 3 AM in my place and I need to sleep, sorry :)
  4. I don't remember which script of mine involves adding states when you reach a certain HP.


    You can try this


    http://www.himeworks.com/2013/11/26/custom-use-conditions/


    customuseconditions1.jpg


    The script supports formulas, so you could say

    Code:
    a.hp * 0.35 < a.mhp
    If you want less than 35% of total HP
  5. Tsukihime said:
    I don't remember which script of mine involves adding states when you reach a certain HP.

    You can try this

    http://www.himeworks.com/2013/11/26/custom-use-conditions/
    That's one of your scripts I already tried tinkering with...it ended up giving me a headache(at least, for what I wanted out of it since I'm not so good on utilizing formulas xD).  After a little more browsing though(also to me being oblivious that Victor_Sant's scripts were moved...agh. :headshake:  ), I tried out his action conditions script, and it works swimmingly.  :p
  6. Tsukihime said:
    I don't remember which script of mine involves adding states when you reach a certain HP.

    You can try this

    http://www.himeworks.com/2013/11/26/custom-use-conditions/



    The script supports formulas, so you could say

    a.hp * 0.35 < a.mhpIf you want less than 35% of total HP
    I'm gonna slap you lol, now where has this script been hiding?

    I've been needing this for a long time now for enabling/disabling items by way of switches. Luckily someone made me a script for switches, but this could be great for many other types of conditions as well, like limiting skills based on equipment type or  other "skills learned"(that's another feature I was planning to add, combination skills, and I know many other people want to as well. Active states is a pretty commonly desired condition as well.
  7. Tsukihime said:
    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.)