1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

XP Bar and XP Level

Discussion in 'Development' started by SavionLegendZzz, Feb 8, 2019.

  1. SavionLegendZzz

    SavionLegendZzz Slime

    Messages:
    75
    GitHub:
    savionlegends
    Okay so i can set the xp level no problem, but my thing is i want to calculate the xp level(xp level comes from a config file) and make it be able to be set in the range of 0.0 to 1.0 for the xp bar. How would i do this?
     
  2. KielKing

    KielKing Zombie

    Messages:
    245
    GitHub:
    kielking
    PHP:
    /** @var Player $player */
    $player->setXpProgress(1.0);
     
  3. SavionLegendZzz

    SavionLegendZzz Slime

    Messages:
    75
    GitHub:
    savionlegends
    No im looking for how to calulate the xp(from the config) to work with the bar progress(which is a float between 0.0 and 1.0)
     
  4. KielKing

    KielKing Zombie

    Messages:
    245
    GitHub:
    kielking
    xp level and xp progress are two different values, my suggestion is just to store the progress on the config too
     
  5. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    Minecraft’s amount of exp levels decreases as the levels the players actually has increases. To replicate this, you will want to incorporate the 3 functions to calculate the level from the amount.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.