Is there a way to make an attack that does damage non-lethal?

I have a bridge that the party must cross in the game that is guarded by a dragon. The dragon collects a toll for crossing the bridge—but not in coin or valuables, but in a battle. Defeating this dragon will make her allow the party to pass.

This is a dragon with a kind heart and knows the importance of a fair fight. She refuses to use any trick to get an unfair advantage as there could be people that crossing the bridge is highly necessary. The dragon even fully restores the party's health and removes any negative status effects prior to the fight.

As a result, I want to create a move for her that does high amount of damage to the party but will never kill a party member. My ideal preference for this is that any damage amount above an actor's remaining HP will just leave that actor with 1 HP.

The dragon's other moves can kill a party member, but this one I do not want it to kill anyone.

Right now I have the formula for this attack set at: b.hp * 0.57 with variance set to 0 and critical off meaning the attack takes slightly more than half the actors remaining HP. However, if an actor's HP is dangerously low, like 1 or 2 HP remaining, this attack could potentially kill that actor. I need a way to prevent that.

If there is a way to do this with formula alone, what would I need to do if so? Otherwise I may need a script but I would prefer without a script.
Formula:

[b.hp - 1, b.hp * 0.57].min

or

Math.min(b.hp - 1, b.hp * 0.57)

Will leave enemy with 1 HP.

Edited x2
Formula:

[b.hp - 1, b.hp * 0.57].min

Will leave enemy with 1 HP.

Edited for Ruby?
I do not think VX Ace knows commas in formulas and .min is nothing I have seen or heard in a formula.

I assume that is either for MV or MZ?
If I remember correctly, this should work in VX Ace. It accepts things like ; and commas for sure, among other things. Did you try it? 😴
If I remember correctly, this should work in VX Ace. It accepts things like ; and commas for sure, among other things. Did you try it? 😴
No I did not. The formula looked peculiar to me so I questioned it.

It doesn't help that documentation doesn't include everything. Like no mention of Rand but I know that is a thing.
No I did not. The formula looked peculiar to me so I questioned it.

It doesn't help that documentation doesn't include everything. Like no mention of Rand but I know that is a thing.
The damage formula box contains Ruby code. It would be frankly ludicrous for the documentation to include everything you could possibly write there. .min and .max are standard methods available in the language.
Is there a list of some of things on the internet somewhere you could put there and what they do?

I do not need like everything. Just a fairly decent sized list would suffice.
No I did not. The formula looked peculiar to me so I questioned it.
Wouldn't it have been simpler to just test it out rather than questioning it? If it worked, problem solved. If it didn't, you could immediately report on what it did or didn't do correctly.
Is there a list of some of things on the internet somewhere you could put there and what they do?

I do not need like everything. Just a fairly decent sized list would suffice.
I'm trying not to be rude in saying this, but searching "ruby documentation" on google literally gives you this as the first hit:


(for future reference, RGSS3 is based on Ruby 1.92. Anything in the API after that might not work)
That seems to not have anything of that nature even when clicking 1.92. It just gives a table of contents of what certain things mean but no indications on use and definitely nothing that could be used in a formula. Not only that, there is no "API" after anything. It is a literally just a list with very little information.

and btw, "Rand" isn't even listed. The website you linked me isn't the right one.
and btw, "Rand" isn't even listed. The website you linked me isn't the right one.
I spotted rand in the list of methods.
If you weren't certain, you could Google "rpg maker vx damage formula maximum" and the first hit is a thread on here that cites the .min function.

That would have taken less time and come off more polite than accusing someone who's helping you of being wrong (which you do in, like, almost every thread I see from you).

That seems to not have anything of that nature even when clicking 1.92. It just gives a table of contents of what certain things mean but no indications on use and definitely nothing that could be used in a formula. Not only that, there is no "API" after anything. It is a literally just a list with very little information.

and btw, "Rand" isn't even listed. The website you linked me isn't the right one.
1690741344196.png

1690741364407.png
Obviously despite the same link, I am being shown a different version of the website.

Definitely NOT there for me

1690741520040.png
Obviously despite the same link, I am being shown a different version of the website.

Definitely NOT there for me

View attachment 271577
Ah, you hit the wrong link. I was able to get to this page too. Click the part where it says 1.9.2 Core.
It is the only 1.92 link on the main page. It took me to 1.91 documentation but there are no other links for 1.92
Trihan said 1.9.2, not 1.9.1. I was only able to find one thing to click on that said 1.9.2.

1690741808763.png

1690741822275.png
And I clicked on 1.9.2 and it took me to 1.9.1
And I clicked on 1.9.2 and it took me to 1.9.1
That's weird. It works for me.

EDIT: After looking at it on my laptop rather than my phone, I think you're clicking the 1.9.1 standard library link, not realizing that there's another link that goes to the right page.
That seems to not have anything of that nature even when clicking 1.92. It just gives a table of contents of what certain things mean but no indications on use and definitely nothing that could be used in a formula. Not only that, there is no "API" after anything. It is a literally just a list with very little information.

and btw, "Rand" isn't even listed. The website you linked me isn't the right one.
Because min is under Enumerable.

1690742180011.png

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-to-make-an-attack-that-does-damage-non-lethal.159868/