Can an attack be made to deal a certain amount of damage?

This is all I could manage to throw together. I'd be embarrassed to show how inept I am, but there ain't really anything to hide.
agreergerg.PNG

When I tested it out the attack just instantly killed the guy... which I don't understand how that even happened. Considering what I put down it should have done zero damage at the least, right?

I just want an item to deal a certain percent of the enemy's health. And I already looked around, I read this whole thread https://forums.rpgmakerweb.com/index.php?threads/damage-formulas-101.81905/ which I'm pretty sure might have explained it, but honestly, I was lost once this was whipped out " (v[10] > 100) { a.atk*4 - b.def*2 } else { a.atk*2 - b.def*2 } "

I know I'm too dumb to do much, but I thought a percentage-based attack wouldn't be complicated. If it is then excuse the question, I'm not trying to do much here, just easy stuff for fun when I'm off work.
The damage formula needs to be written as a computer formula, not at a shortform that only humans can interpret.
"20% b.hp" is basically always zero, because % is the modulo-operator and not a percentage sign.

b.hp - 0 is the same as the current hp of the target, so the damage will always reduce the HP to zero and kill the target.

20% of target HP is
0.2 * b.hp

but you need to keep in mind that the result of the formula is what is removed from the target, so current HP minus 20% of current HP as damage is the same as 80% current HP as damage.
Keep in mind as well that if you want it to be exactly 20%, you'll have to remove the 20% variance from the skill as well, as that will make it deal a little more/less damage randomly.

Original thread: https://forums.rpgmakerweb.com/threads/can-an-attack-be-made-to-deal-a-certain-amount-of-damage.137019/