How do I reset my experience points bar to empty without the player losing exp (UMG)

Hey everyone, I have a level up system and I’m using a UMG progress bar to displayer the experience if the player.

It works fine but the bar jumps to the current exp value along the bar when the new exp threshold is set. How do I reset the bar to a zero state without having an effect on the players exp?

Character BP

Level up function in the Character BP

UMG Widget Binding

Your inputs are backwards in the UMG Widget binding. What you have set is Current Exp/Max XP. Flip them around so that they are Max XP/Current XP.

Good call on that one Omni. I missed the fact that he was trying not to zero out the XP on Level up.

Broaden the scope with 2 more floats?

A second setup on a smaller scale specifically for the widget.
Current XP this level - start at zero - recieve XP input at the same time current XP does.
Max XP this level - compare float. If Current xp >= Max XP this level, ding.

You can set and use both of these variables in the exact setup you have now. You can wipe these at Ding and set a new Max XP this level per level called from .csv.on Ding. You can do this without affecting the cumulative total.

Current XP will still hold a cumulative value. Max XP will still set an upper ceiling.

If you don’t want to use .csv - a quick and dirty method is to get the current Max XP for level and apply a multiplier before set.

Apologies for getting back to you guys so late! It’s been mega busy over here!

Would this equation need to be in my character blueprint or the UMG binding?

i would put it in the player controller, but it can go anywhere that can access the cost of each level upgrade. you could load that from a .csv spreadsheet or use a math formula to generate your exp curve.

//something like this could work for generating an exp curve:
// edit A and B variables to adjust the difficutly curve

XP2lvl:
lvl = FMath::Pow( XP * A, 1/B );

lvl2XP:
XP = FMath::Pow(lvl,B) / A;

bro,

Nice problem.

You need two pieces of data. Think about the trip counter on your car, you have the miles this tank and the total mileage.
Use an integer (or float) for a trip counter (current experience counter) and when it reaches its limit, add its value to the total experience, and reset the current experience counter to zero.

Hope this helps