XP Bar and XP Level

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

  1. SavionLegendZzz

    SavionLegendZzz Witch

    Messages:
    74
    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:
    271
    GitHub:
    kielking
    PHP:
    /** @var Player $player */
    $player->setXpProgress(1.0);
     
  3. SavionLegendZzz

    SavionLegendZzz Witch

    Messages:
    74
    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:
    271
    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 Wither Skeleton Poggit Reviewer

    Messages:
    1,389
    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.
     

Share This Page

  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.