Coolie 148 Posted November 6, 2020 (edited) 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 November 6, 2020 by Coolie typos Share this post Link to post Share on other sites
Kayzee 4,033 Posted November 6, 2020 (edited) 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 November 6, 2020 by Kayzee Share this post Link to post Share on other sites
Coolie 148 Posted November 6, 2020 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
PhoenixSoul 1,404 Posted November 6, 2020 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
Coolie 148 Posted November 6, 2020 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. 1 Share this post Link to post Share on other sites
Rikifive 3,411 Posted November 7, 2020 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. 1 Share this post Link to post Share on other sites
Kayzee 4,033 Posted November 7, 2020 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. 1 Share this post Link to post Share on other sites
PhoenixSoul 1,404 Posted November 7, 2020 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
Coolie 148 Posted November 8, 2020 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. 1 Share this post Link to post Share on other sites
Kayzee 4,033 Posted November 8, 2020 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. 1 Share this post Link to post Share on other sites