Calculate distance, then when a set distance is achieved start from zero again UE4 version 4.26

Hi. I need some help. I am trying to create a swimming game and I am trying to calculate the distance of the swimmer. I have got that part working (on the picture called ‘progress distance’ everything up to the Branch is fine), but what I am struggling with is, I want to create a levelling up system based on how far they have swam. I was thinking for example that for every 5000m the player would move up a level. The problem I am having is when the player reaches the distance (which I have called Max Distance) I can’t get the distance to reset to zero and start calculating again. I have tried a couple of ways, one of them being I thought I would just try and increase the Max Distance every time the player levelled up, but then my progress bar would only ever go back to 50% (for example the player reaches 5000m, I doubled the Max Distance to 10000m but the progress bar started at 50%) The one I have attached here hits the Max Distance, starts to recalculate, but then doesn’t recognise the Max Distance again.

I’m sure there is a much easier way to do this and would really appreciate if someone could help.

thanks


I’m sure there is a much easier way to do this and would really appreciate if someone could help.

thanks

For what you have, drag wire from branch false to delay node, then the loop will continue to run, I tested your theory and it works with that wire.

@OmegaMinus1 thank you for replying. I’m not sure if I am doing something wrong, but the logic works once, but then doesn’t keep looping. For example, I want the player to hit 500m start calculating again and when it hits 500m it starts again and so on. When I used a print text, it starts False, then goes to True, but remains True and doesn’t restart the progress calculation. I hope that makes sense.
Thanks

Problem is the next distance is greater then maxdistance since it keeps using the splines first point and not the position of the last LevelUp location

Also with false node active to keep the loop alive, call this one time on beginplay since it calls itself after that, right know every time you move it creates another endless cycling loop of the above wires