• 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.

[Trigger] Custom Ability: Explosive Wave

Status
Not open for further replies.
Level 2
Joined
Nov 22, 2010
Messages
5
I have tried looking up an ability like this. I figured it was a common idea, but the closest ability I can find is a Slide ability.

Edit: What the ability does: Deal damage to all enemies in a circle and slide them away

This is working. I am posting it here because I am awful at optimizing hashtables. I am hoping someone can look over the triggers real quick and give me some tips on how to do things more efficiently.

Also, I am not entirely convinced I made it MUI, but I think I did? Haha.

  • Explosive Wave
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Explosive Wave
    • Actions
      • Set VariableSet intCastedExplosiveWave = (intCastedExplosiveWave + 1)
      • Set VariableSet keyCastedExplosiveWave[intCastedExplosiveWave] = (Key (Triggering unit).)
      • Hashtable - Save Handle Of(Position of (Triggering unit)) as 0 of keyCastedExplosiveWave[intCastedExplosiveWave] in hashExplosiveWave.
      • Unit - Cause (Triggering unit) to damage circular area after 0.00 seconds of radius 300.00 at (Load 0 of keyCastedExplosiveWave[intCastedExplosiveWave] in hashExplosiveWave.), dealing (25.00 + ((Real((Level of Explosive Wave for (Triggering unit)))) x 50.00)) damage of attack type Spells and damage type Normal
      • Hashtable - Save Handle Of(Units within 300.00 of (Load 0 of keyCastedExplosiveWave[intCastedExplosiveWave] in hashExplosiveWave.) matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Triggering unit)).) Equal to True)).) as 1 of keyCastedExplosiveWave[intCastedExplosiveWave] in hashExplosiveWave.
      • Unit Group - Pick every unit in (Load 0 of keyCastedExplosiveWave[intCastedExplosiveWave] in hashExplosiveWave.) and do (Actions)
        • Loop - Actions
          • Unit - Pause (Picked unit)
      • Trigger - Turn on Explosive Wave Effect <gen>
  • Explosive Wave Effect
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • intCastedExplosiveWave Less than or equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • For each (Integer A) from 1 to intCastedExplosiveWave, do (Actions)
            • Loop - Actions
              • Set VariableSet intExplosiveWaveClock[(Integer A)] = (intExplosiveWaveClock[(Integer A)] + 1)
              • Unit Group - Pick every unit in (Load 1 of keyCastedExplosiveWave[(Integer A)] in hashExplosiveWave.) and do (Actions)
                • Loop - Actions
                  • Set VariableSet tempLocation[0] = (Position of (Picked unit))
                  • Set VariableSet tempLocation[0] = (tempLocation[0] offset by 16.00 towards (Angle from (Load 0 of keyCastedExplosiveWave[(Integer A)] in hashExplosiveWave.) to (Position of (Picked unit))) degrees.)
                  • Unit - Move (Picked unit) instantly to tempLocation[0]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • intExplosiveWaveClock[(Integer A)] Equal to 18
                • Then - Actions
                  • Unit Group - Pick every unit in (Load 1 of keyCastedExplosiveWave[(Integer A)] in hashExplosiveWave.) and do (Actions)
                    • Loop - Actions
                      • Unit - Unpause (Picked unit)
                  • Set VariableSet tempLocation[0] = (Load 0 of keyCastedExplosiveWave[(Integer A)] in hashExplosiveWave.)
                  • Set VariableSet tempGroup = (Load 1 of keyCastedExplosiveWave[(Integer A)] in hashExplosiveWave.)
                  • Hashtable - Clear all child hashtables of child keyCastedExplosiveWave[(Integer A)] in hashExplosiveWave.
                  • For each (Integer B) from 2 to intCastedExplosiveWave, do (Actions)
                    • Loop - Actions
                      • Set VariableSet keyCastedExplosiveWave[(Integer A)] = keyCastedExplosiveWave[(Integer B)]
                      • Set VariableSet intExplosiveWaveClock[(Integer A)] = intExplosiveWaveClock[(Integer B)]
                  • Set VariableSet intExplosiveWaveClock[(Integer A)] = 0
                  • Set VariableSet intCastedExplosiveWave = (intCastedExplosiveWave - 1)
                • Else - Actions
      • Custom script: call RemoveLocation(udg_tempLocation[0])
      • Custom script: call DestroyGroup(udg_tempGroup)
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,871
1) Don't use Circular Damage, that function is super limited. Instead, pick every unit within X range of the caster and cause the caster to damage them individually. This way you can add conditions to it like "If picked unit belongs to an enemy", etc...

2) You can use Bribe's Knockback system for a powerful and smooth knockback effect that is fully customizable.

Pause is not recommended as it has undesirable side effects like pausing buff timers and screwing with animations. You can use this custom script instead, it will Stun/Unstun a Picked unit:
  • Custom script: call BlzPauseUnitEx(GetEnumUnit(), true)
  • Custom script: call BlzPauseUnitEx(GetEnumUnit(), false)
Avoid using Integer A/Integer B and create your own unique Loop variable. I personally never had any problems with using them but others have stated to avoid doing so.

The way you're reducing your loop doesn't work:
  • Set VariableSet intCastedExplosiveWave = (intCastedExplosiveWave - 1)
That would remove the most recently created Explosive Wave, which might not be the one that has just expired.

Check out this tutorial to see how you can safely remove an Index from your Loop: Visualize: Dynamic Indexing
 
Last edited:
Status
Not open for further replies.
Top