Need help making a certain skill

Hello. I've been tinkering with this skill idea for a while and am not sure if it's possible just using the damage formula or a script. It would be nice if I could use a damage formula but if there's a script that can help with this, I'm all ears.


Alright, so it's basically this -


Skill: Banish


Effect: If the targeted enemy has 5 hp or less, inflict the death state. Otherwise, it does nothing.


How do I go about making a skill like this? I'm not looking for percents. I use numbers that are pretty low to begin with. Just need to figure out how to get this to work. Help is greatly appreciated.


(I apologize if I posted this in the wrong section)
Try something like this:


If b.hp < 6; b.add_state(1); else; 0; end;


I made the check as: does the enemy have less than 6HP, so that gives you your 5 or less HP
Doesn't seem to be working. Keeps giving me errors. I'm gonna try to see if I can mess around with it by removing some stuff.


Edit: Tried messing with that formula for a bit, still error after error. I may need something else.
Edit: Tried messing with that formula for a bit, still error after error. I may need something else.

That isn't a formula, is a notetag
@Vito The Boss It is not a note tag, it is a formula for using in the damage formula box.  I fail to see how it could possibly function as a note tag.


@MHRob what errors are you getting?
I've attached some images to this post. I've tried messing with the formula that was given, shortening it everytime it gave an error. Eventually it got to the point where it was doing 0 dmg in battle and not doing anything that was in the damage formula. I'm starting to believe I may need a script for this.  ._.

2.png

1.png
No need for a script, it's a question of just getting the syntax correct for the damage formula.  My problem is that I'm not on a machine where I can test this.  However, try:


If b.hp < 6; b.add_state(1); end; 0


I think it was just the presence of the 'else' that was the issue.  That zero at  end is the damage formula.  So it should run as either death state inflicted or no damage.
Similar error to the one in my last post. I think it just doesn't seem to recognize "If b.hp < 6". I've tried messing around with just that bit in the damage formula with different enemies in battle with different hp and just nothing.

3.png
b.hp is certainly recognized in a damage formula because I have used it in several ways.


Try omitting the spaces in the first part so that it reads:


If b.hp<6; b.add_state(1); end; 0
Similiar errors again. I feel like were missing something important in the formula. Thanks for the suggestions thus far.


EDIT: No Idea why, but this formula worked for me.


If b.hp <= 5? b.add_state(1): 0


Works just how I want it, though it's a bit different than the one you posted, Kes. Can't wrap my head around it but I'm grateful to have found something that works. Thanks for giving me insight on it.
Yep, I forgot the ? and did ; instead.  


It's worth persevering with these formulas because they are a very powerful tool.


Glad it's working for you now.

Original thread: https://forums.rpgmakerweb.com/threads/need-help-making-a-certain-skill.73653/