How do I add a cooldown timer to skills/inputs?

Hello!

I am trying to figure out how to add a cooldown to my skill, like the skill can’t be used for another 10 sec. I am using the enable/disable input nodes now, but that disables every input I have in my controller and I want it to only disable a specific Input, but I can’t figure out how?

Try putting a Gate in front of your skill execution that opens when the Delay completes.

This is how I would do a cooldown.

When you want to perform the skill you check a timer. In this example it’s called DodgeCooldown. If the timer is less then the current game time you go ahead and perform the skill. After (or before) you’ve performed the skill you update the timer to Current game time + Cooldown time. In my example I add 5 seconds which will mean 5 second cooldown on the skill.

5 Likes

You also can use timers, type “Timer” in libery to see nodes for that, it requires use of your own funtion thru

thx alot:)

I always figured the easier way to do this was with a simple boolean.

Using the First Person Template as an example, just create a bool called “CooldownActive?” and then a branch checking to see if the condition is true. If it is, do nothing, if its not, continue down the line. Set the Cooldown Active to yes at this point, then do whatever you need like spawning an actor and then call a delay at the end of that which acts as your cooldown time (you can set this to a variable) and after the delay, set Cooldown Active to no.

Some people might say that you shouldn’t answer a boolean with false, but I think its all just in the way you name the boolean. CooldownActive? answered with False makes sense. “No, the cooldown is not active so please continue.”

This is not a good implementation because during the cooldown period if you trigger the fire input, it will reset the cooldown.

A bit late, but it looks like the branch here would prevent that. (If it’s in cooldown, it would go to the True branch, and thus do nothing in the false branch, which includes turning on the cooldown.)

Thanks a lot!

thanks :slight_smile:

This doesn’t quite work. I tried using this for a weapon fire rate cool down. Like a rifle that can only fire once every 4 seconds. But when I put 4 it, the actual fire rate is noticeably slower. There is some part of this that causes a long delay that gets worse as the cooldown gets smaller

Thx it helped me add a cooldown for my fireball wich is consuming mana so i kinda just put what you posted in front of that mana consumption. It would consume mana eventhough the fireball wasnt shooting since it has a rather slow animation.