Exp Points Problem! I want to kill this program

So, I have been working on my leveling up system for a couple of days, and it’s just not working, everything seems fine until I kill an enemy that’s a substantially higher level than me and there’s all that extra exp that has to spill over into the next level. Well, my formula for how much experience an enemy gives me seems fine. But for some reason, when my character is set to Lvl.1, and I kill and enemy who is Lvl.5, everything goes insane.
I have it print the amount of XP gained from the enemy to the top right corner and it says somewhere around 5,000, which is fine, but the numbers on the XP bar go crazy. (refer to pictures below)
I’ve tried a while loop and that wasn’t working, so I just recalled the function at the end of the function and it all ends up the same way. Can someone anyone see an error in my blueprints!?

90512-outcome.png

In ApplyExp, there are

When you level up, you call the ApplyExp function with the CurrentXP as argument - so that exp gets applied twice.
Instead, on level up do the following:

  • make a local variable RemainingXP = CurrentXP - ExpNeeded
  • set CurrentXP to 0
  • call ApplyExp(RemainingXP)

Another problem is that GenerateExpNeeded is called before subtracting the exp of the completed level from the current exp value. So you subtract the exp needed for the NEXT level. Instead you should subtract ExpNeeded from CurrentXP first, and only after that call GenerateExpNeeded.

Thank you! I actually did wonder about that exp getting applied twice. I’m very new to this. I’ll try that as soon as I get off work!

So, it’s still not working… But instead of juminp to level 22, I jumped to level 5! Which is good. However my current exp. was still at about -2,000 afterward. I’m not sure if I did it right. Is this the setup you were talking about?

Do not subtract ExpNeeded from CurrentXP if you are not levelling up (lower branch).

It worked! Thanks! :smiley: haha I should’ve seen that… Thank you!

FF12? Think they made FF13 with Unreal Engine & Art? Only for Cory Barlog to ask me about the level up system. “do not subtract ExpNeeded from CurrentXp”