• XP Calculation Issue
    3 replies, posted
Hey, guys, sorry to bother you again, but this has been bugging me for a while and I have been putting it off coming on here in the hopes of fixing it myself, but it has me stumped. So here is the deal, when someone levels up, they gain a level and the EXP required for the next level increases. But their EXP does not reset. The issue is that they will have 0 exp when they start off, but upon leveling to level 2, they will have at least 50/300exp. The formula I use too calculate the EXP bar is barwidth*(XPCurrent/XPNext). The only issue with this is that when they level, the bar will say they already have progress towards the next level. I was wondering if anyone had a formula to resolve this issue, I was toying around with this: [CODE]local XPNeeded = XPNext - XPCurrent barwidth* -- Maths, :v [/CODE] But every formula I could think of ended in failure.
[code]local PrevXPNeeded = 100 -- XP was needed for level we just achieved local NextXPNeeded = 200 -- XP needed for next level local CurrentXP = 150 local OurLocalXP = ( CurrentXP - PrevXPNeeded ) / ( NextXPNeeded - PrevXPNeeded ) local BarW = MaxBarW * OurLocalXP[/code] Untested, but should be working. Replace all the variables with your variables.
-snip-
Thanks Robot, it worked just fine :D
Sorry, you need to Log In to post a reply to this thread.