Widget Countdown not working

When i use my attack the countdown apears at 5 and then goes to -1 for a split second and then back to 5 and stays there. Im really new at this so sorry if this is a stupid way of doing this.

I don’t have the answer to your question, but I have an idea on how to do it better… Maybe.

If you add Delta to the float variable on the “Event Tick” function, e.g. (CountTime = CountTime + Delta) you will notice that CountTime is actually counting seconds!
So, you can do something like this (I’m writing from my phone so I can’t send a picture of how to do it but I hope you understand how to transfer this to BP)

On Event Tick:
(Branch) If (ShouldCooldown) is true:
CountTime = CountTime + Delta (from event tick)
Cooldown = CooldownLength (5sec) - CountTime (and before setting Cooldown you can clamp the result of subtraction to min = 0 and max = 5, so u wont get results like -1 etc.)

Then you check if Cooldown == 0.0, if yes, set visibility to Collapsed, set ShouldCooldown to false and set CountTime to 0.

Edit:
Here is the working BP: Cooldown Timer posted by anonymous | blueprintUE | PasteBin For Unreal Engine

Sequence01-ezgif.com-optimize

When the timer is invalid its remaining time is set to -1 and you are invalidating your timer right after creating:

Also, this is too much code for a simple countdown. Use the handle provided by your Set Timer node:

Wow thats really helpful, thank you. But the cooldown is not static and changes constantly based on the character you are playing and that characters current CDR. So i cant just set the timer to be a static 5 at the event construct. Im sure i can figure it out from here though, thank you.

I followed what you did and its working much better, small hiccup is when i close the sim i get the same error a bunch of times about Blueprint Runetime Error: “Accessed None”, Node: “Set Visibility”

I can get the errors to stop if i put a branch node to check if the return value is true before setting the visibility but then it doesnt set the visibility to false when the countdown is over.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.