Calculation not working when pulling from array.

So in Img 1 this in on my character so when you lose the game it does this to save your best (highest) time. If you don’t have a higher time it wont save that float to the savegame.

In Img 2 this is my Widget that gets spawned after removing the UI. It takes your Best time according to the current level and then i send that Float into the “Calculate Seconds” func.

This 3rd img is that Calculate seconds func. This calculate func works for my other gamemode where i am just setting 1 float and not using an array (img 4 to show) But that works fine. When pulling from this array it just wont update to new highest and doesn’t calculate right.

1 Like

You have

and

I’m guessing they’re not the same function?

Another favorite possibility for me, is that ‘get current level name’ is not returning what you think it it? Are you using ‘open level’ to change levels?

Good catch on the names but they are internally the same logic. Just in different BPs so I copy/pasted it from the working bunker mode widget to the new modes widget.

I am using open level to reset/change levels and stuff yes. Is there another more solid option for changing?

Edit: Did some testing and level names consistently come back correct. Also when i ForeachLoop my array of floats (best times for each level) they come back correct too. I’m going to try to Remake the function from scratch and see if that doesn’t help.

1 Like

Here is the solution. My calculation was somehow (really no clue how) working on other gamemode giving me the impression it was working overall. But the calculation was the problem. This is a easier better solution to the Seconds to mins/seconds calculation.

1 Like

You could put the function in a function library. That way you only need to do it once.

1 Like

Great idea i did not know of those. Thanks!

1 Like