Jump to content
Sign in to follow this  
BlueVapor1234

Arbitrary Damage Cap Using Damage Formulas

Recommended Posts

Im using MV and all, and I was going through to redo the formulas on the spells in one of my games, of course I found a formula that worked wonders (Base Power * a.mat - b.mdf), but it came with the problem of the most powerful spells doing 90000 to 200000 damage. I was wondering if it would be possible to edit the formula to restrict the damage to less than or equal to some damage cap, like 9999 or something. It would be very appreciated if someone could help me out on this. 👍

Share this post


Link to post
Share on other sites

I don't own MV, so can't test anything, but I know it uses JS, so perhaps just using the Math.min() method would work there?

Basically this method returns the lowest number from provided arguments (separated by commas), for example;

Math.min(235, 111, 563) => will return 111
Math.min(100+100+300, 200) => will return 200

 

So what you need is to put your damage formula as one of the arguments, and 9999 as the other.

Using your formula (Base Power * a.mat - b.mdf), the damage formula with the cap would be:

Math.min(Base Power * a.mat - b.mdf, 9999)

This will either return Base Power * a.mat - b.mdf OR 9999, whichever is lower, thus capping the damage output at 9999.

 

That's just my guess, because I'm not sure how damage formulas are processed there.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted