Quarter of a players level in experience

Discussion in 'Plugin Development' started by WolfMage1, Aug 26, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    WolfMage1

    How would I get a quarter of a players level in experience?
     
  2. @WolfMage1 I assume you want a quarter of the level rather than all their levels. If you want to set it though you can use setExp(0.25). I am not sure the best course of action to get a quarter of a level, I think maybe setting them to a level, checking the total xp, setting them back, checking again, compare the difference and divide by 4 will be the best. I don't think there is a method to get the actual xp points.
     
  3. Offline

    HeartandSoul

    Get the current exp, then get the max. Divide the max by .25
     
  4. @HeartandSoul
    Divide by 0.25? I'm pretty sure that'll just give you four times the max level.. Not a fourth of it..
     
  5. Offline

    HeartandSoul

    Your right... Its not an int. Divide by 4.
     
  6. Offline

    WolfMage1

    does Player#getExpToLevel return the exp they need to levelup or the experience they need starting from 0?
     
  7. Offline

    HeartandSoul

    getExpToLevel gets the required Experience needed for the next level.

    Get the remainder needed to level:
    Code:
    Level pl = p.getExpToLevel();
    Level plc = p.getCurrentExp();
    int pr = pl - plc;
    
    //Not intended to work, theres even a few errors. But you get the idea.
     
    WolfMage1 likes this.
Thread Status:
Not open for further replies.

Share This Page