• 🏆 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!

Thunder Storm v1.2a

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
This is my spell Thunder Storm. It creates a Thunder Storm at the target location for 10 seconds. Every 0.5 seconds, a lightning bolt strikes a random location inside that area and damages nearby enemies. When 10 seconds has passed, the Thunder Storm explodes dealing alot of damage to the enemies still inside the Thunder Storm.

  • Hashtable
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hashtable = (Last created hashtable)
  • Thunder Storm init
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Thunder Storm
    • Actions
      • Set Unit[1] = (Triggering unit)
      • Set Point[1] = (Target point of ability being cast)
      • Set Damage = ((Real((Level of Thunder Storm for Unit[1]))) x 40.00)
      • Set Time = 10.20
      • Unit - Create 1 DUMMY for (Owner of Unit[1]) at Point[1] facing Default building facing degrees
      • Unit Group - Add (Last created unit) to DUMMYGRP
      • Hashtable - Save Damage as 1 of (Key (Last created unit)) in Hashtable
      • Hashtable - Save Time as 2 of (Key (Last created unit)) in Hashtable
      • Hashtable - Save Handle OfUnit[1] as 3 of (Key (Last created unit)) in Hashtable
      • For each (Integer A) from 1 to 36, do (Actions)
        • Loop - Actions
          • Set Point[2] = (Point[1] offset by 350.00 towards ((Real((Integer A))) x 10.00) degrees)
          • Unit - Create 1 CircleEffect for (Owner of Unit[1]) at Point[2] facing Default building facing degrees
          • Unit Group - Add (Last created unit) to CircleGroup
          • Hashtable - Save Time as 2 of (Key (Last created unit)) in Hashtable
          • Custom script: call RemoveLocation(udg_Point[2])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Thunder storm loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Thunder storm loop <gen>
        • Else - Actions
      • Custom script: call RemoveLocation(udg_Point[1])
  • Thunder storm loop
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in DUMMYGRP and do (Actions)
        • Loop - Actions
          • Set Unit[1] = (Load 3 of (Key (Picked unit)) in Hashtable)
          • Set Damage = (Load 1 of (Key (Picked unit)) from Hashtable)
          • Set Time = (Load 2 of (Key (Picked unit)) from Hashtable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Time Greater than or equal to 0.60
            • Then - Actions
              • Hashtable - Save (Time - 0.50) as 2 of (Key (Picked unit)) in Hashtable
              • Set Point[1] = (Position of (Picked unit))
              • Set Point[2] = (Point[1] offset by (Random real number between 0.00 and 350.00) towards (Random real number between 0.00 and 360.00) degrees)
              • Special Effect - Create a special effect at Point[2] using Abilities\Spells\Other\Monsoon\MonsoonBoltTarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • Set Damagegroup = (Units within 75.00 of Point[2] matching ((((Matching unit) belongs to an enemy of (Owner of Unit[1])) Equal to True) and (((Matching unit) is dead) Equal to False)))
              • Set DamagegroupSmall = (Units within 150.00 of Point[2] matching ((((Matching unit) belongs to an enemy of (Owner of Unit[1])) Equal to True) and ((((Matching unit) is dead) Equal to False) and (((Matching unit) is in Damagegroup) Equal to False))))
              • Unit Group - Pick every unit in Damagegroup and do (Actions)
                • Loop - Actions
                  • Unit - Cause Unit[1] to damage (Picked unit), dealing Damage damage of attack type Spells and damage type Normal
              • Unit Group - Pick every unit in DamagegroupSmall and do (Actions)
                • Loop - Actions
                  • Unit - Cause Unit[1] to damage (Picked unit), dealing (Damage / 2.00) damage of attack type Spells and damage type Normal
              • Custom script: call RemoveLocation(udg_Point[1])
              • Custom script: call RemoveLocation(udg_Point[2])
              • Custom script: call DestroyGroup(udg_Damagegroup)
              • Custom script: call DestroyGroup(udg_DamagegroupSmall)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Time Greater than or equal to 0.10
                • Then - Actions
                  • Hashtable - Save (Time - 0.50) as 2 of (Key (Picked unit)) in Hashtable
                • Else - Actions
                  • Set Point[3] = (Position of (Picked unit))
                  • Special Effect - Create a special effect at Point[3] using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Set LastDamageGroup = (Units within 350.00 of Point[3] matching ((((Matching unit) belongs to an enemy of (Owner of Unit[1])) Equal to True) and ((((Matching unit) is dead) Equal to False) and (((Matching unit) is in Damagegroup) Equal to False))))
                  • Unit Group - Pick every unit in LastDamageGroup and do (Actions)
                    • Loop - Actions
                      • Unit - Cause Unit[1] to damage (Picked unit), dealing (Damage x 4.00) damage of attack type Spells and damage type Normal
                  • Custom script: call RemoveLocation(udg_Point[3])
                  • Custom script: call DestroyGroup(udg_LastDamageGroup)
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
                  • Unit - Remove (Picked unit) from the game
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in DUMMYGRP) Less than or equal to 0
                    • Then - Actions
                      • Custom script: call DestroyGroup(udg_DUMMYGRP)
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
      • Unit Group - Pick every unit in CircleGroup and do (Actions)
        • Loop - Actions
          • Set Time = (Load 2 of (Key (Picked unit)) from Hashtable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Time Greater than or equal to 0.10
            • Then - Actions
              • Hashtable - Save (Time - 0.50) as 2 of (Key (Picked unit)) in Hashtable
            • Else - Actions
              • Unit - Remove (Picked unit) from the game
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
*Updates* 1.2a Renamed the spell to Thunder Storm, changed effects to lightning effects, reduced damage from 50*level to 40*level, reduced damage radius from 300/150 to 150/75, added an explosion at the end of the Thunder Storm dealing alot of damage.

v1.1d Changed the check to see if the spell is already running, made targets between 300 and 150 range take half damage.
v1.1c Made it a custom spell, fixed hotkey, fixed the name of the spell being in gold, added a check to see if the spell is already running, removed the destroying of CircleGroup and changed the icon for it.
v1.1b Changed names of the variables. Fixed some unit group leaks.
v1.1a Added a circle that shows the area of effect. Changed the model of the special effect. Also changed screenshot.

Keywords:
Lightning, Thunder, Storm
Contents

Bombardement (Map)

Reviews
12.12 IcemanBo: For long time as NeedsFix. Rejected. Bribe Only make arrays when they are unavoidable. Point[1] -> Point1, Unit[1] -> Unit1. Easily avoidable here. Makes things a lot faster. (Owner of Unit[1]) -> (Triggering player). A lot...

Moderator

M

Moderator

12.12
IcemanBo: For long time as NeedsFix. Rejected.

Bribe

Only make arrays when they are unavoidable. Point[1] -> Point1, Unit[1] -> Unit1. Easily avoidable here. Makes things a lot faster.

(Owner of Unit[1]) -> (Triggering player). A lot faster.

Save (Triggering player) to a variable before entering the loop, you have a buttload of excess function calls that just don't need to be, making it a lot faster.

(Integer A) -> Integer Loop ---> custom integer loops are a lot faster.

The bj_wantDestroyGroup custom script is superior to group set/pick/destroy: less lines of code equates to less file size consumed by the map, faster execution in-game, faster to write... win/win situation.

If it was only one of these things, fine, but there is lots of room for improvement here.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
The triggering is ok.

The spell is really simple, maybe even too simple to be approved. Maybe you could spice it up somehow.

I'd like to see an area of effect circle when casting the spell. Maybe you should check if the caster is alive or not, and make the spell channelled.
 
Top