I did a brief search and could not find anything similar to what I want to have in my game. I may also be overthinking this completely.
I want to be able to give skills and abilities a little more "realistic" feeling, as some of mine have a description of "Desperation attack". I believe these skills would work better if they could only be used is the character is on his/her last legs, or under 20% health, for example.
The Idea
A script that gives me 2 different notetags to put into any Skill notetag box to limit when it can be used based off of the skill user's HP.
The first notetag would be for a % of HP, in decimal format i.e. [HP%(.25)]
The second notetag would be for a specific number of HP i.e. [HP(500)]
I believe both notetags would need to set up as <= said amount to avoid any calculation issues, but I could be wrong.
I was also hoping the notetag would change the Skill or Ability name to red when the requirments are met as a way to easily identify them.
I've forgotten a lot of shortcuts/tricks in the past 6 months thanks to a demanding job, so I appreciate any advice or ideas you can offer me.
I just looked over the description and think it might work with some modification. Thank you very much for the link Iavra!
The only problem I can see is I don't want it to cost HP, i just want to make it check the skill user's current HP against a pre-set threshold and make the skill useable or unusuable at any given time.
Until i have time to experiment with Yanfly's script to see if i can get it to work, I welcome any other suggestions.
I only took a brief look at the script, but it should be possible to only use the requirement tag without using custom costs.
That's what I thought but according to the description there aren't requirement tags, there are cost tags
As an example, by my understanding, if I used that script and had a tag for <hp cost: 500>, a character with 750 HP would end up with 250 HP after successfully using the skill.
Where I want it more like a <HP: 500> which would make a character with 750 HP unable to use the skill and a character with 499 HP able to use it.
I intially thought it would work but after fully reading the description, I do not believe it will.
That is because the computer needs a phrase to identify the kind of tags, and Yanfly choose to use a phrase containing the word "cost" for this script.
But the phrase for the notetags has absolutely nothing to do with what the functions do, it's just for human convenience.
And the parts that define the requirements are true/false-conditions, they don't even have a number to be a cost as a result.
But that IS the part: you have to use the <custom cost requirement> phrase and write the requirement as a ruby condition in it, the requirement tag won't work with simple numbers.
I haven't used the Skill Cost Manager, and I'd go about doing it a different way, but it looks like you can very easily do this using the Custom Cost Requirement tags:
<custom cost requirement>
self.hp <= 500
</custom cost requirement>
or
<custom cost requirement>
self.hp <= (self.mhp * 0.250)
</custom cost requirement>
This will not force the battler to spend HP, it will only require that they have less than a certain amount, which sounds like exactly what you want to do.
Couldn't this just be done in the damage formula?
Not at my brightest and sharpest today, so this may not be quite accurate, but something like
if a.hp? <=(0.25); big_damage_formula_here; else; normal_damage_formula_here; end
Does the 25% of HP have to be in a bracket? Brain is packing up.
EDIT
Brain back in gear, and that original formula is rubbish. This works.
if (a.hp / a.mhp) <0.25; big_damage_formula_here; else; normal_attack_formula_here; end
There, sorted without a script.
If you want the skill to be totally useless until the HP is 25%, then where I've put normal_attack_formula you could just put 0
EDIT AGAIN
Just remembered that the OP wants the option of having a specific amount of HP. In that case the formula is
if a.hp <500; big_damage_formula_here; else; normal_attack_formula_here; end
One advantage of using the damage formula for this is that you can have lots of small variations. It might be 25% for one skill, but 30% for another. Or 500HP for your tank, but 300HP for a weaker character.
@Andar: Thats what I initially thought when looking at the script but I'm so out of practice I second guessed myself. It's going to take me a while to remember the nuances of this coding language.
@Wavelegth: That is exactly what I wanted and of course, it worked like a charm.
@ksjp17: That won't work me in this particular instance, since I wanted to disable the skill if the reqs aren't meant not have it do 0 damage. I do have to thank you for reminding me you can manipulate the damage formula in that way though.
My thanks to you guys for helping me out!
A moderator can go ahead and close this thread out.