Jump to content
Coolie

Help with mathematical formula

Recommended Posts

Don't see a thread for RMMV questions that don't deserve their own thread (if there is one, I apologize)...

 

Anyway, I am hoping to convert a formula I am looking at on a wiki page to its equivalent in JS.

 

From the wiki page:

Growth Factor * 500000 * { [ Current Level / 99 ] ^ ( 5 / 2 ) - [ ( Current Level - 1 ) / 99 ] ^ ( 5 / 2 ) }

Growth Factor and Current Level would obviously be written using actual integers (or referencing a variable) in the JS version of this, but so far I have only been able to have it always return a value of 1.

Edited by Coolie
typos

Share this post


Link to post
Share on other sites

Whats with the {} and [] brackets in that formula? Are they just for readabillity or what? I am gonna assume so. Also pretty sure '^' in javascript is Bitwise XOR but it looks like it's meant to mean exponent.  So my guess is:

 

Growth Factor * 500000 * ( (Current Level / 99) ** 2.5 - ((Current Level - 1) / 99) ** 2.5 )

or

Growth Factor * 500000 * ( Math.pow(Current Level / 99, 2.5) - Math.pow((Current Level - 1 ) / 99,  2.5) )

... Maybe? Haven't done a lot of javascript myself.

Edited by Kayzee

Share this post


Link to post
Share on other sites

Yeah I think those symbols are for readability.

 

Genius! It definitely no longer returns a 1, but it's still not giving the number it should be giving.

 

The formula is referencing the amount in EXP a character would need to gain their next level. Hmm... let me get some exact numbers.

 

OK, so in-game at level 1 it takes 36 EXP to gain level 2. That's about normal (number should be 37 but I assume it is rounding down rather than up, that's fine for now).

To get to level 3 from level 2, it should take another 169 EXP. However, it is returning a level up at 131 EXP and TOTAL EXP of 167 (again, rounding), rather than 169 EXP and a TOTAL EXP of 205 (169 plus the previous 36).

 

So yeah, this is definitely working, it's just slightly off the numbers it should be giving, I think.

Share this post


Link to post
Share on other sites
8 hours ago, Coolie said:

Don't see a thread for RMMV questions that don't deserve their own thread (if there is one, I apologize)...


There isn't. Yet. @Rikifive

Not experienced with JS formulas, but I saw ' 'math' formula' and thought I might have a look.

I wouldn't even divide by 99. Some games might not have a L99/L100 limit (less or more), so I would exclude that altogether, but that's just me.

Other than that, I'm not sure how I could help. Sorreh. :/

Share this post


Link to post
Share on other sites
26 minutes ago, PhoenixSoul said:

I wouldn't even divide by 99. Some games might not have a L99/L100 limit (less or more), so I would exclude that altogether, but that's just me.

It is a formula that exists in a game already that I was trying to convert to RMMV, so it'd have to stay.

 

Anyway, I got it to require about 11 million EXP to get to level 99 by changing it up a little, which is good enough for now, haha.

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, PhoenixSoul said:

There isn't. Yet. @Rikifive

Ask and you shall receive. 👀


 

Although personally I don't mind creating threads even for simpler questions, so use whichever way you feel would work better for you.

  • Like 1

Share this post


Link to post
Share on other sites
20 hours ago, Coolie said:

Yeah I think those symbols are for readability.

 

Genius! It definitely no longer returns a 1, but it's still not giving the number it should be giving.

 

The formula is referencing the amount in EXP a character would need to gain their next level. Hmm... let me get some exact numbers.

 

OK, so in-game at level 1 it takes 36 EXP to gain level 2. That's about normal (number should be 37 but I assume it is rounding down rather than up, that's fine for now).

To get to level 3 from level 2, it should take another 169 EXP. However, it is returning a level up at 131 EXP and TOTAL EXP of 167 (again, rounding), rather than 169 EXP and a TOTAL EXP of 205 (169 plus the previous 36).

 

So yeah, this is definitely working, it's just slightly off the numbers it should be giving, I think.

 

Maybe the formula is just wrong then? If you have a list of EXP values, you might be better off using a table/array rather then a formula.

  • Like 1

Share this post


Link to post
Share on other sites
9 hours ago, Kayzee said:

If you have a list of EXP values, you might be better off using a table/array rather then a formula


Personally think this is a better option, if simpler in scope and less dynamic.

Share this post


Link to post
Share on other sites

Yeah it might be a better option. I was hoping to save myself from that level of data entry on something, but it would definitely work better setting the value for each level on each curve.

  • Like 1

Share this post


Link to post
Share on other sites

I think it would be better to use a formula if you are doing your own thing and/or don't care about exact values so much just cause it would be much easier to adjust, but if you have a bunch of exp tables already you want to copy exactly trying to figure out the exact formula for it can be a pain and kinda pointless.

  • Like 1

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted