• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Problem with setting unit attack interval / setting ability cooldown

Status
Not open for further replies.
Level 4
Joined
Apr 3, 2012
Messages
31
Hey there

I've got an ability aptly named Heroism which reduces base attack time. The trigger which lowers attack speed looks like this and works fine (It does not have to be MUI, I'm aware it's not perfect):

  • Events
    • Unit - A unit Begins casting an ability
  • Conditions
    • (Ability being cast) Equal to Heroism
  • Actions
    • Set aa_TempUnit = (Casting unit)
    • Set aa_TempPoint = (Position of aa_TempUnit)
    • Set aa_heroismReal = (0.10 x (Real((Level of Heroism for aa_TempUnit))))
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units within 1200.00 of aa_TempPoint) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • ((Picked unit) belongs to an ally of (Owner of aa_TempUnit)) Equal to True
        • Then - Actions
          • Set aa_TempUnit2 = (Picked unit)
          • Unit Group - Add aa_TempUnit2 to aa_heroGroup
          • Unit - Set Attack Interval of aa_TempUnit2 to ((Attack Interval of aa_TempUnit2 for weapon index 1) - aa_heroismReal) for weapon index: 1
        • Else - Actions
    • Custom script: call RemoveLocation(udg_aa_TempPoint)
    • Countdown Timer - Start aa_heroTimer as a One-shot timer that will expire in 20.00 seconds
However, the trigger which increases attack speed once the timer expires does not work. It looks like this:

  • Events
    • Time - aa_heroTimer expires
  • Conditions
  • Actions
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in aa_heroGroup and do (Actions)
      • Loop - Actions
        • Set aa_TempUnit = (Picked unit)
        • Unit - Set Attack Interval of aa_TempUnit to ((Attack Interval of aa_TempUnit for weapon index 1) + aa_heroismReal) for weapon index: 1
        • Unit Group - Remove aa_TempUnit from aa_heroGroup
I know for a fact that the second trigger finds the units, as I tried attaching a special effect to each of the picked units. It flat out just seems like the set attack interval action does not work when increasing attack interval. I also have an item which reduces the cooldown of an ability, which again works fine when reducing the cooldown, but does nothing when trying to increase cooldown. Both these instances have the issue of stacking when the ability is used multiple times, or the item is dropped and picked up again multiple times, lowering BAT or ability cooldowns further than intended.

Sorry for perhaps not looking around closely enough, but is there a known issue with these trigger actions, or am I missing something obvious?
 
Level 4
Joined
Apr 3, 2012
Messages
31
Ah gotcha. I'm relatively new at triggers, and thought you just put that custom script every time you made a unit group because it would magically clear leaks. I feel a bit silly now :p

The trigger works as intended now, so thanks for the quick response.
 
Status
Not open for further replies.
Top