Return xp (selfmade system) properly

Discussion in 'Plugin Development' started by ThrustLP, Aug 6, 2016.

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

    ThrustLP

    Hey guys! So I created a xp system, that has 5 levels. For those levels you need

    Code:
    1=0xp
    2=500xp
    3=1000xp
    4=2000xp
    5=4000xp
    6=6000xp
    7=9000xp
    Now I wanted to create a method that returns the amount of xp I need for a level:

    Code:
    public int getNeededXp(int level) {
           
           
    
            return 0;
        }
    Would I have to do lots of if() statements here or is there a better way to do it?

    Thanks!
     
  2. @ThrustLP
    Switch statements is probably the best option.
     
  3. @ThrustLP @AlvinB Or create a formula to get the amount of xp, it won't be these exactly but you can very easily make a math formula rather than having like 100 cases or ifs.
     
  4. Offline

    bennie3211

    Use excel, put the values in de cells and let excel calculate a formula that will follow the given values. Then write te formula in java that will give the needed exp with a given level
     
  5. Offline

    Zombie_Striker

    @bennie3211 @bwfcwalshy @ThrustLP
    Since your XP does not have any linearity to it, you are going to need to use some other program to figure out the formula for that. What I would actually recommend is that you figure out the formula you want to use first before you create the XP for each level.
     
    bwfcwalshy likes this.
  6. Offline

    ThrustLP

  7. Offline

    Zombie_Striker

Thread Status:
Not open for further replies.

Share This Page