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?
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.
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;
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.