- Joined
- Jul 28, 2024
- Messages
- 340
Can i have an artifact that would display it's cooldown?
I don't see a cooldown timer...
I don't see a cooldown timer...
Last edited:
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
function UseRingOfLuck takes unit u returns nothing
local integer i = 0
local item it
loop
exitwhen i >= 6
set it = UnitItemInSlot(u, i)
if it != null and GetItemTypeId(it) == 'RLUC' then
call UnitUseItem(u, it)
return
endif
set i = i + 1
endloop
endfunction
This seems overly complicated. Why not just use Object Editor ability cooldown then use a simple trigger to start the cooldown? Then you can still invoke the artifact ability with this JASS code, I suppose.Code:function UseRingOfLuck takes unit u returns nothing local integer i = 0 local item it loop exitwhen i >= 6 set it = UnitItemInSlot(u, i) if it != null and GetItemTypeId(it) == 'RLUC' then call UnitUseItem(u, it) return endif set i = i + 1 endloop endfunction
OK this works.
But how can i make artifact non-clickable.
I want to invoke artifact cooldown with jass only
Unit - For Unit some_unit, start cooldown of ability Item Healing (Greater) " over "10.00 seconds.
You can make your artifact non‑clickable by unchecking Usable in the Object Editor (Stats-Actively Used=false ). This prevents players from clicking it, but UnitUseItem will still work.This seems overly complicated. Why not just use Object Editor ability cooldown then use a simple trigger to start the cooldown? Then you can still invoke the artifact ability with this JASS code, I suppose.
function UseArtifact takes unit u returns nothing
local integer i = 0
local item it
local integer abilId = 'A000' // rawcode of your dummy ability
// Check cooldown
if BlzGetUnitAbilityCooldownRemaining(u, abilId) > 0 then
return // still on cooldown
endif
loop
exitwhen i >= 6
set it = UnitItemInSlot(u, i)
if it != null and GetItemTypeId(it) == 'yourItemID' then
call UnitUseItem(u, it) // activates the artifact
call BlzStartUnitAbilityCooldown(u, abilId, 60.0) // start cooldown
return
endif
set i = i + 1
endloop
endfunction
native BlzStartUnitAbilityCooldown takes unit whichUnit, integer abilCode, real cooldown returns nothing
You can’t really make a passive show cooldown, but a "clean" workaround is to use two abilities with the same icon. Keep the real one as passive, and swap it with a dummy active ability when it procs. Start the cooldown on the dummy, then swap back when it finishes. That way the player sees the cooldown but can’t interact with it. And then in jass you'll need timers + some way to track each unit (hashtable/indexing) so it doesn’t break with multiple heroes xdWorks well! Thank you guys!
Now, how can I achieve a similar thing for the normal hero ability?
I want ability to be non-clickable kinda passive. But i want to trigger its cooldown via triggers so that the countown timer is visible...
Another idea is maybe i can make ability disabled. Then enable and start a timer and then disable back.You can’t really make a passive show cooldown, but a "clean" workaround is to use two abilities with the same icon. Keep the real one as passive, and swap it with a dummy active ability when it procs. Start the cooldown on the dummy, then swap back when it finishes. That way the player sees the cooldown but can’t interact with it. And then in jass you'll need timers + some way to track each unit (hashtable/indexing) so it doesn’t break with multiple heroes xd
If you really want fractions, you’ll need a custom UI, BlzCreateFrame, which is way more work.Can we display fraction of a second for the cooldown by the way?
You could also create a dummy ability with a very short cooldown that appears briefly (like a temporary button), or use a floating text "0.25" when the ability is used.if i have a 0.25 cd i can just show a special icon for this furation i think
