• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Get your art tools and paintbrushes ready and enter Hive's 34th Texturing Contest: Void! Click here to enter!

Check if X ability is disabled or hidden on Y unit?

Status
Not open for further replies.
Level 5
Joined
Feb 1, 2024
Messages
44
I don't think it is poor management, I also came up with the same jam.

I have two abilities that are intended to be synchronized with each other, if an ability is used the other is disabled. Until the used ability's cooldown elapsed, the other ability is enabled again. As I see it's not possible for an ability to go on cooldown other than casting. Hiding is also a good option but the ability has a permanently dedicated slot and it's quite buggy if another ability is happened to be added in the same slot.

The issue is it might be enabled when the unit is silenced or doomed. Manually checking through all buffs are not viable as there are upcoming custom buffs. So if there is a function to check if the other ability is disabled then the disabled ability will not auto enable itself until the unit no longer has Silence or Doom buff.
 

Uncle

Warcraft Moderator
Level 74
Joined
Aug 10, 2018
Messages
7,940
I don't think it is poor management, I also came up with the same jam.

I have two abilities that are intended to be synchronized with each other, if an ability is used the other is disabled. Until the used ability's cooldown elapsed, the other ability is enabled again. As I see it's not possible for an ability to go on cooldown other than casting. Hiding is also a good option but the ability has a permanently dedicated slot and it's quite buggy if another ability is happened to be added in the same slot.

The issue is it might be enabled when the unit is silenced or doomed. Manually checking through all buffs are not viable as there are upcoming custom buffs. So if there is a function to check if the other ability is disabled then the disabled ability will not auto enable itself until the unit no longer has Silence or Doom buff.
On 1.31+ you can manipulate cooldowns freely, start one, reset one, reduce a cooldown based on some kind of special stat, etc.

Anyway, what Pyro was saying is that you're running a specific function to disable/enable the ability. So why not track the state of that ability at the same time? Think like a Warcraft 3 developer who wants full controls of everything. If the devs failed to provide you with a function for what you need, implement one yourself:
  • Set Variable DisabledAbility = Summon Water Elemental
  • Set Variable DisabledUnit = (Triggering unit)
  • Custom script: call DisableAbility()
  • Custom script: if IsAbilityDisabled() then
  • -------- It's disabled! --------
  • Custom script: endif
vJASS:
function DisableAbility takes nothing returns nothing
    // Run the standard disable ability function
    // Store this information in an Array/Hashtable
endfunction

function IsAbilityDisabled takes nothing returns boolean
    local boolean isDisabled = ... // Reference our stored data from before
    return isDisabled
endfunction
Obviously it takes some extra work to do all of this but it's not that much and it opens up the door to a lot of awesome possibilities that you couldn't do before. Get into this habit and you will find all of the limitations that you thought you had will start to disappear. Then your map will desync for no good reason because "Reforged" but hey it's something.
 
Status
Not open for further replies.
Top