for i = 0, parent:GetAbilityCount() - 1 do local ability = parent:GetAbilityByIndex(i) if ability and ability:GetCooldownTimeRemaining() > 0 then local currentCooldown = ability:GetCooldownTimeRemaining() local cooldownReduction = 1 local newCooldown = math.max(0, currentCooldown - cooldownReduction) ability:EndCooldown() if newCooldown > 0 then ability:StartCooldown(newCooldown) end end end
I'm using this method to reduce the cooldown of some abilities, but it seems not working for charge-based abilities. GetCooldownTimeRemaining also cannot get the correct value for them.
#How to reduce the current cooldown of charge abilities?
1 messages · Page 1 of 1 (latest)
There are no api (at least that im aware of). EndCooldown started affect charges only recently according to #1325834282387771422 message
the answer is very classically valve in that the answer is "go fuck urself"
however, you can probably do the following:
get current ability charges GetCurrentAbilityCharges
refresh all charges with RefreshCharges (this also inherently ends the cooldown and if it doesn't u can just call endcooldown)
set charges to curr-1 with SetCurrentAbilityCharges
Oh thanks. That's a bad news🥲
You can also implement custom charges yourself with any api you want. There is working charges implementation in moddota site that lack only modern ui support (you can reuse that ui for your charges).
This will also force you to use this custom charges only and rewrite all valve charge based abilities used to support all your features
I did that myself when i wanted working flat cdr for charges based abilities 🥲
With that approach you can also override valve charges related api to use your api so not very much code should be affected
This might be too complicated for my needs.
I noticed that Keeper of the Light's Chakra Magic can reduce the cooldown of charge-based abilities. Could we possibly work with/use that
I'm planning to create a dummy unit that will cast a modified version of Chakra Magic (with custom KV values) on the hero
This will work in short term and in long term valve will break chakra magic or rework it and all your stuff will be broken
You will be also forced to hide sound & particle and most likely sound can't be hidden (soundevents file override doesn't work outside tools mode)
Thanks for the heads-up.
Is there any API that can remove all lingering sounds in the game? When I delete heroes, sometimes it causes certain ability sounds to keep playing on the map, such as Invoker's Chaos Meteor sound effect
No, every sound binded to entity and if you lost entity before stopping sound you will enjoy random meatball rolling sound forever