1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Dismiss Notice
  5. Choose your ride to damnation in the 5th Special Effect Contest Poll.
    Dismiss Notice
  6. The winners of the 13th Techtree Contest have been announced!
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[vJASS] Display Remaining Cooldown

Discussion in 'Submissions' started by Pinzu, Jan 17, 2019.

  1. Pinzu

    Pinzu

    Joined:
    Nov 30, 2007
    Messages:
    1,178
    Resources:
    3
    Spells:
    2
    Tutorials:
    1
    Resources:
    3
    I'm using it now. The issue is that Blizzard cooldown doesn't start until it finishes casting (or something like that). Though now i have a 1s timer that updates using GetUnitAbilityCooldown and it's working fine.
     
  2. busterkomo

    busterkomo

    Joined:
    Jun 17, 2007
    Messages:
    1,423
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    I think it's better if you run everything off a single timer then.
     
  3. Pinzu

    Pinzu

    Joined:
    Nov 30, 2007
    Messages:
    1,178
    Resources:
    3
    Spells:
    2
    Tutorials:
    1
    Resources:
    3
    Is there anyway to check if an ability cast belongs to a certain item or vice versa?
     
  4. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,442
    Resources:
    18
    Tools:
    2
    Maps:
    3
    Spells:
    8
    Tutorials:
    4
    JASS:
    1
    Resources:
    18
    you check if current order of unit is useitem1 or 2 or 3 or 4 or 5 or 6.
    Code (vJASS):

     local integer spellOrder = GetUnitCurrentOrder(caster)
     local boolean itemSpell = ( spellOrder >= 852008 and spellOrder <= 852013)
     local item usedItem = UnitItemInSlot(caster, spellOrder - 852008)
     
     
  5. Pinzu

    Pinzu

    Joined:
    Nov 30, 2007
    Messages:
    1,178
    Resources:
    3
    Spells:
    2
    Tutorials:
    1
    Resources:
    3
    I'm still not convinced because you'd still have to run the timer on a relatively short interval 0.1 - 0.2 or so to be somewhat accurate, and you'd have to cycle all instances 10 to 5 times per second, instead of each one having their own timer and updated exactly once per second at the exact time.

    You are reducing timer allocation at the expense of execution efficiency, 50 timers is nothing. But I'm considering it and would listen to arguments.

    Also there is already a 0.8 minimum delay between when the event fires and before it's added to the update group to account for different spell behavior, and I'm quite happy with the current accuracy. I'm simply reusing the delay timer for the rest of the cooldown duration.
     
    Last edited: Jan 21, 2019