How to make 1HP skill bypass defence action

Unbenannt.PNG


In the picture you can see an enemy skill which is supposed to reduce all actors HP to 1.
My only problem is that if a group member uses "Defend" in his turn he will also reduce the "damage" that my skill does.

So instead of his HP getting reduced to 1 he has a few hundred left.
Is there a way for this skill to bypass the "Defend" action of group members?
Have you tried setting the HP directly while dealing zero damage?

b.hp=1; 0
Hmm, "b.hp=1; 0" results in 0 damage dealt.
Hmm, "b.hp=1; 0" results in 0 damage dealt.
yes, I said that - but it should set the target HP to 1 in addition to dealing zero damage.
Hmm, my group is still at full HP.
actor.hp is actually a method used to retrieve the private number, you can't set it equal to something.

Try b._hp
Or just try b.gainHp(-b.hp +1).
Say your Guard state is State 9. Put as formula:

a.isStateAffected(9) ? ((b.hp - 1) * 2) : (b.hp - 1)

EDIT: I put the original formula in wrong. Should be

b.isStateAffected(9) ? ((b.hp - 1) * 2) : (b.hp - 1)

If the target is guarding, then the attack will deal double damage, hence canceling out the guard effect. If target is not guarding it will just do b.hp - 1. A bit roundabout but it should do the trick!
Thanks to everyone for the suggestions!
I liked all your comments.

Or just try b.gainHp(-b.hp +1).

This is the only method that seems to work for me.
Maybe I was doing something wrong with the others.
Damage formulas are too complicated for me, sorry.
But: Problem solved, thanks everyone!


If someone finds this via Google, try the other methods as well!
This is the only method that seems to work for me.
Maybe I was doing something wrong with the others.
Damage formulas are too complicated for me, sorry.
I realized I put the formula in wrong, sorry about that. Corrected my original post. (I had it check if the user was guarding, not the target.)
Wow, I certainly wanna thank you for updating your post.
Now it works and it's even better than before, because it actually shows the damage dealt on my sideview battlers as well rather than just reducing everyones HP to 1 and showing 0 damage.
@unknownnumber Right, glad to hear that!

FYI if you want to learn more about damage formulas you can see Mr. Trivel's guide: https://www.rpgmakercentral.com/topic/36290-damage-formulas-101-mv-edition/ You can create some pretty complex skills this way. In that formula I used the ternary operator
If any of the battlers have an increased Guard rate, the doubling workaround won't work.
If any of the battlers have an increased Guard rate, the doubling workaround won't work.
Okay, @unknownnumber you can try:
Code:
b.isStateAffected(9) ? b.removeState(9) : 0; b.hp - 1)
This will check to see if the target is guarding; if so, it removes the state, and then deals damage.
Sure, I will try that right now.
I guess there's a "(" missing just before the b.hp?

And what do you mean by "increased guard rate"?
The only thing my partymembers can do is to "defend".
What rate is there to increase?
Sure, I will try that right now.
I guess there's a "(" missing just before the b.hp?

And what do you mean by "increased guard rate"?
The only thing my partymembers can do is to "defend".
What rate is there to increase?
Yes, I forgot that paratheses, sorry. I'm not sure what is meant by increased guard rate but the formula I just gave you should be safer.
Edit: It works, thank you (again)!
Really happy with the outcome, just what I needed.
You saved my day, really.
I guess there's a "(" missing just before the b.hp?
Actually, the close parenthesis at the end is superfluous. It doesn't hurt anything, but there's no need to put parentheses around that statement.

I'm glad everything works as you'd like!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-1hp-skill-bypass-defence-action.145116/