Infinite while loop despite A>B condition?

We made these platforms in class today that break after the time displayed above them. I wanted to take it a bit further and see if I can make that text act like a countdown once you step on a platform, decreasing in 0.1 values every 0.1 second.
This is the blueprint that I have so far but I keep getting an infinite loop error and I don’t understand why. It’s supposed to decrease the value of DelayDestruction (an exposed parameter of these platforms) by 0.1 after waiting 0.1 second, write the data to a TextRender component and repeat this process as long as DelayDestruction is > than 0. Please help me out if you can see where I made a mistake, Thanks!!!

Hi ant1fact. Try that

Hi Anatoliy! Thank you for your suggestion. I tried it that way but I am still getting the same error.

You can download a stripped version of the project on [this link][1] if you would like to have a look:)
The problematic blueprint can be found in the Fracture_test folder. Thanks again!

78378-error.jpg

Hi ant1fact. Thank you for stripped version. I look it and found some strange. If you switch position of delay from start loop all works fine. But why cant say, its looks like bug.

Sorry, that way will more correct :slight_smile:

You’re awesome, I never would have figured that out. It’s strange because logically no matter where I place the delay in the loop body it’s supposed to give the same results.

I don’t want to bother you too much because you already helped a ton but what is happening right now is that the number drops immediately from 10, 20, 30 etc to -0. Is there a way to make the countdown happen? Like 10 / 9.9 / 9.8 / 9.7? I thought the Delay node was doing that.

Anyway thanks so much again!! At least I can continue tinkering with it without having to worry about infinite loops:)

Hi ant1fact.

I think that’s a result you need :slight_smile: Just replace folders from zip[link text][2]

Sorry I was cooking lunch and just got back to this:D now it does just what I wanted. I will study this blueprint carefully to understand how you achieved this this result. Thank you soo so much, bless you my friend

I see that you resolved it, but I wanted to add : to my knowledge, delay nodes don’t “pause” the execution. The while continues to loop every frame but stops at the delay since it is still cooling down. When the cool-down of the delay is finished, the remainder of the execution path is executed.

My guess would be that whatever method is used to detect infinite loops picked up that the while was executed many times without the condition changing and wrongfully interpreted that as an infinite loop.

Sorry if you already knew this :stuck_out_tongue:

While Anatoliy’s method seems to work well, you could also simply use a Timer by Event and make a custom event “Update Time”. You set it to looping every 0.1 sec. In the event you decrease the time, display it and test if it’s more than 0. If not, you stop the timer using the timer handle and make the platform fall.

Hi Violaine! Thank you for your input, I will have a look at it that way as well. I’m happy to try out anything because there is so much to learn about UE and blueprints