So after searching the documentation, tutorials, info on the web, I couldn’t find a clear way to add cooldowns to abilities. Often, stuff would be outdated, where some parts of the things to do were not there anymore in blueprints etc.
So I did a bit of trial and error, and finally achieved it and it’s finally quite simple. I’m writing this down for anyone else who can’t figure it out since I find the documentation on it is lacking.
First and foremost, you need an ability Blueprint. Whichever way it works is up to you. You also need a GameplayEffect Blueprint and you will add it to the ability’s cooldown gameplay effect section:
(GameplayAbility Blueprint details)
This will add this specific gameplay effect once you either call CommitAbility or CommitAbilityCooldown node in the ability blueprint. In my case, I want the cooldown to start when the ability ends, so right before calling endAbility, I commit the cooldown (could be commited at the start of the ability to start the cooldown at the start too!):
(GameplayAbility Graph)
This is all you need on the ability side. Now for the actual cooldown gameplay effect, you need to create the blueprint for it, and set its duration policy to “Has Duration” and in the duration magnitude section, you can use “Scalable Float”, and directly set the time you want the ability to be on cooldown for. It is also possible to use another magnitude Calculation Type, like “SetByCaller” to set the cooldown duration in the ability by using the
“Assign Set By Caller Magnitude” blueprint node, where you set matching “Data Name” on the node and in the gameplay effect and pass in the cooldown duration in the magnitude variable.
Now, here’s what I couldn’t find documentation about. You need to grant to the actor a “cooldown” tag, and in the tutorial or documentation around the web, this is where I would get stuck, as there would be a section in the gameplay effect blueprint about tags, but it is nowhere to be found in 5.3. So from my testing, you need to add a “Target Tags Gameplay Effect Component” in the components array, and add a cooldown tag from there:
(GameplayEffect Blueprint Details)
And that’s it. Once you commit the cooldown, this gameplay tag will be added to your actor, and it will automatically block the possiblity of activating the ability for the reminder of the duration.