Skill Requirement MHP <= .25

I'm no sure if I'm posting this is the proper section but maybe I can get some help regardless.


So I'm trying to make a skill that can only be used when the Actors MHP is at 25% or below.


I have the mechanics for the skill set up the way I want it but I have no JS experience so I was


wondering if there is a script of a plugin that could help me with this?


I have Yanfly's Skill Core Plugin and I've tried


<Custom Show Eval>


if (user.hp <= 0.25) {


condition = true;


} else {


condition = false;


}


</Custom Show Eval>


But this didn't work. Any helpful ideas?
You can try this one instead:




place this on the skill notetag:
<action condition: hp lower 25%>
Hello. Put this:


<Custom Show Eval>
condition = user.hpRate() <= 0.25;
</Custom Show Eval>
@FIyingDream's method should work

Alternatively I think this is what you were trying to achieve:


<Custom Requirement>


if (user.hp <= user.mhp * 0.25) {


value = true;


} else {


value = false;


}



HP is an integer and your condition is "user's hp is less than equal than 0.25" which is only true if the user is dead
I used custom requirement because it does not hide the skill if the skill is unusable. Use show eval if you want to hide the skill if not usable
You can try this one instead:





place this on the skill notetag:
<action condition: hp lower 25%>



I tried this and all it did was seal the skill completely.
Hello. Put this:


<Custom Show Eval>
condition = user.hpRate() <= 0.25;
</Custom Show Eval>



I tried this method and it didn't do anything at all.
Code:
<Custom Show Eval>
if (user.hp <= (user.mhp * 0.25)) {
condition = true;
} else {
condition = false;
}
</Custom Show Eval>
@FIyingDream's method should work

Alternatively I think this is what you were trying to achieve:


<Custom Requirement>


if (user.hp <= user.mhp * 0.25) {


value = true;


} else {


value = false;


}



HP is an integer and your condition is "user's hp is less than equal than 0.25" which is only true if the user is dead
I used custom requirement because it does not hide the skill if the skill is unusable. Use show eval if you want to hide the skill if not usable



Now this right here worked like a charm and I see where I messed up. Thank you very much!
I tried this and all it did was seal the skill completely.

Actually i messed the tag, it was supposed to be  <action condition: hp higher 25%> (the other tag makes the action usable only at low hp)


Well, you found your solution so this no longer matter.
Actually i messed the tag, it was supposed to be  <action condition: hp higher 25%> (the other tag makes the action usable only at low hp)


Well, you found your solution so this no longer matter.

Actually I wanted the skill to only be usable at low hp. The condition script you first gave sealed the skill entirely. Even when the actor was at 100/3000 remaining hp the skill was not usable. I appreciate the helpful offer but I have indeed received the solution thanks to boomy.

Original thread: https://forums.rpgmakerweb.com/threads/skill-requirement-mhp-25.60005/