Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

EXP System and Leveling up. MMF2/Constrcut.


Asuma

Recommended Posts

So, I pretty got a basic formula for leveling.

Int(1+(Lv+10) pow 2)

My question is, how can I make it so that it level up to match the exp need for that one level.

Example.

I'm at Lv1 and I need 10k EXP to reach level 10. If I add 10000 EXP, I want to able to instantly jump to Lv10 instead of going like lv 1, 2, 3, 4, etc. Also, I want the excess EXP to carry over to the next level. So if I 11,000 EXP, I'd level to Lv10 and the excess 1000 EXP will carry over.

Link to comment
Share on other sites

Essentially what you want to do is add in a check to see if the amount of EXP you're adding is higher then what's required at that level. Then name a new int that takes the amount of EXP you're adding minus how much you need to level up, name that EXPCarryOver. Reclassify EXPCarryOver as EXP you're adding, then loop the entire thing. If the checker says that the EXP gain is not high enough to level up, that's where you put up a prompt to say that you leveled up to X level.

That's probably not the best way, or best well thought out and fully described way. I don't even know what language you're using lol

Link to comment
Share on other sites


on loop: 'level_up_func'
    level = level + 1
    exp = exp - exp_needed_to_level
    exp_needed_to_level = (exp per level function where level is the argument to the function)
    //Do whatever you say you need to do

on loop: 'level_up_loop'
    if exp < exp_needed_to_level:
        break loop

    run loop: 'level_up_func'


//meanwhile... somewhere in the normal code
if (exp >= exp_needed_to_level):
    // Yeah, this is never really going to run 99 times in a single frame in all likelyhood, but the loop is self canceling.
    run_loop: 'level_up_loop' 99 times 

If your character can level up more than 99 times in total, you may consider upping the times the loop runs. It shouldn't make any difference in the performance, but eh... we are talking about black box closed source programs.

Link to comment
Share on other sites

Hmm. Might be doing this wrong.

wrong2.png

Actually, I think I got. Yeah. Just had to move a few events around, but I got it. Thanks a lot guys! Shame the rep button is gone. Now, I'm assuming stats and such would more or less follow the same function?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...