PlayerEx

PlayerEx

5M Downloads

Max level

Imcaam opened this issue ยท 1 comments

commented

Hi again, I was wondering if the level up formula included a limit to the levels, is there none at all or can I maybe include it in somehow?

thanks

commented

Hi there,
The level up formula does not include a limit to levels, at least not directly. I assume what you really want is "How can I set a max level or level cap?". There are three-ish ways to do this:

Method 1: levelling formula and natural progression.

When setting a levelling formula that requires more and more experience points to level up each time (as it is by default), there will come a point when it is no longer feasible to collect enough experience points to level up. This results in a natural level cap as it becomes impossible/difficult to collect enough experience in game - this is something that will occur regardless of mod configuration so long as the formula increases the amount of experience needed per level. The only challenge with this method however, is you don't really have any way of knowing what the maximum level is.

Method 2: levelling formula decrement

You can set a levelling formula that requires an infinite amount of experience to reach the next level at a certain point. An example is:

y = 3 - ln(9 - x)

Where x is your current level, and y is the amount of experience to get to level y + 1. In this equation, your maximum level is level 9, because once you become level 9 you need infinite experience to get to level 10. This method is similar to Method 1, but you get to specify what the maximum level is. The above equation is just an example of course, you'd be better off using some cubic imitation.

Method 3: the correct solution

Methods 1 and 2 were just interesting ways of achieving a level cap using only the levelling formula. The correct way of implementing a level cap would be to set the maximum value for the level attribute using a datapack. Have a look at this and this. Once you have set the maximum value for the level attribute, once reached the level up button will become disabled and you will no longer be able to level up no matter how much experience you collect. On the off chance that a bug occurs and you can still "level up", your level value will clamp and you will still not actually gain any levels.

I'm closing this issue, but if you have anymore questions or something isn't clear, please don't hesitate to ask.
Hope that helps,
Thanks.