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

Thunderstorm V1.0

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
A spell made for a contest on a other website.
I felt like uploading something so here it's MUI and in GUI using hashtables.

[trigger=Cast]
TS cast
Events
Unit - A unit Starts the effect of an ability
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(TS_group is empty) Equal to True
Then - Actions
Trigger - Turn on TS loop <gen>
Else - Actions
Set TS_unit = (Triggering unit)
Set TS_point = (Position of TS_unit)
For each (Integer TS_integer) from 1 to 36, do (Actions)
Loop - Actions
Set TS_Angle_Thingy = (Random real number between -10.00 and 10.00)
-------- Speed, if it's equal to a - it moves the other way if it's positive it moves the normal way --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
TS_Angle_Thingy Less than 0.99
TS_Angle_Thingy Greater than -0.99
Then - Actions
Set TS_Angle_Thingy = 1.00
Else - Actions
Set TS_angle = (Random angle)
Set TS_Length = (Random real number between 30.00 and 300.00)
-------- length between caster and missle --------
Set TS_point2 = (TS_point offset by TS_Length towards TS_angle degrees)
Set TS_unit = (Triggering unit)
Unit - Create 1 Thunder orb Dummy for (Triggering player) at TS_point2 facing TS_point
Set TS_uni2 = (Last created unit)
Set TS_time = 330
-------- Time it loops remember, that it loops 330/33 times. and 33= 1 game time second. --------
Set TS_damage = (25.00 x (Real((Level of (Ability being cast) for TS_unit))))
-------- damage upon end --------
Animation - Change TS_uni2 flying height to (Random real number between 30.00 and 300.00) at 0.00
Custom script: set udg_TS_handle2 = GetHandleId(udg_TS_uni2)
Hashtable - Save TS_damage as (Key damage) of TS_handle2 in TS_hash
Hashtable - Save TS_Length as (Key speed) of TS_handle2 in TS_hash
Hashtable - Save TS_Angle_Thingy as (Key angle1) of TS_handle2 in TS_hash
Hashtable - Save TS_angle as (Key angle) of TS_handle2 in TS_hash
Hashtable - Save Handle OfTS_unit as (Key caster) of TS_handle2 in TS_hash
Hashtable - Save TS_time as (Key timer) of TS_handle2 in TS_hash
Unit Group - Add TS_uni2 to TS_group
Custom script: call RemoveLocation(udg_TS_point2)
Set TS_damage = (0.50 x (Real((Level of (Ability being cast) for TS_unit))))
-------- Damage per second * 33 --------
Custom script: set udg_TS_handle2 = GetHandleId(udg_TS_unit)
Hashtable - Save TS_damage as (Key damage) of TS_handle2 in TS_hash
Set TS_time = 330
-------- Time it loops remember, that it loops 330/33 times. and 33= 1 game time second. --------
Hashtable - Save TS_time as (Key timer) of TS_handle2 in TS_hash
Unit Group - Add TS_unit to TS_group
Custom script: call RemoveLocation(udg_TS_point)
[/trigger]
  • TS loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in TS_group and do (Actions)
        • Loop - Actions
          • Set TS_uni2 = (Picked unit)
          • Custom script: set udg_TS_handle2 = GetHandleId(udg_TS_uni2)
          • Set TS_time = (Load (Key timer) of TS_handle2 from TS_hash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TS_time Greater than 0
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of TS_uni2) Not equal to Thunder orb Dummy
                • Then - Actions
                  • Set TS_point = (Position of TS_uni2)
                  • Set TS_time = (TS_time - 1)
                  • Hashtable - Save TS_time as (Key timer) of TS_handle2 in TS_hash
                  • Set TS_damage = (Load (Key damage) of TS_handle2 from TS_hash)
                  • Custom script: set bj_wantDestroyGroup = true
                  • Unit Group - Pick every unit in (Units within 300.00 of TS_point matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is dead) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of TS_uni2 and do (Actions)
                    • Loop - Actions
                      • Unit - Cause TS_uni2 to damage (Picked unit), dealing TS_damage damage of attack type Spells and damage type Normal
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Current flying height of TS_uni2) Less than 50.00
                    • Then - Actions
                      • Animation - Change TS_uni2 flying height to (15.00 + (Current flying height of TS_uni2)) at 0.00
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Current flying height of TS_uni2) Greater than 300.00
                        • Then - Actions
                          • Animation - Change TS_uni2 flying height to ((Current flying height of TS_uni2) - 15.00) at 0.00
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Random integer number between 0 and 1) Equal to 0
                            • Then - Actions
                              • Animation - Change TS_uni2 flying height to ((Random real number between 2.00 and 20.00) + (Current flying height of TS_uni2)) at 0.00
                            • Else - Actions
                              • Animation - Change TS_uni2 flying height to ((Current flying height of TS_uni2) - (Random real number between 3.00 and 20.00)) at 0.00
                  • Set TS_time = (TS_time - 1)
                  • Set TS_Length = (Load (Key speed) of TS_handle2 from TS_hash)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • TS_Length Greater than 300.00
                    • Then - Actions
                      • Set TS_Length = (TS_Length - (Random real number between 10.00 and 20.00))
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • TS_Length Less than 50.00
                        • Then - Actions
                          • Set TS_Length = (TS_Length + (Random real number between 10.00 and 20.00))
                        • Else - Actions
                          • Set TS_Length = (TS_Length + (Random real number between -20.00 and 20.00))
                  • Set TS_Angle_Thingy = (Load (Key angle1) of TS_handle2 from TS_hash)
                  • Set TS_unit = (Load (Key caster) of TS_handle2 in TS_hash)
                  • Set TS_angle = (Load (Key angle) of TS_handle2 from TS_hash)
                  • Set TS_angle = (TS_angle + TS_Angle_Thingy)
                  • Set TS_point = (Position of TS_unit)
                  • Set TS_point2 = (TS_point offset by TS_Length towards TS_angle degrees)
                  • Unit - Move TS_uni2 instantly to TS_point2, facing TS_point
                  • Hashtable - Save TS_Length as (Key speed) of TS_handle2 in TS_hash
                  • Hashtable - Save TS_angle as (Key angle) of TS_handle2 in TS_hash
                  • Hashtable - Save TS_time as (Key timer) of TS_handle2 in TS_hash
                  • Custom script: call RemoveLocation(udg_TS_point2)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of TS_uni2) Equal to Thunder orb Dummy
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Current flying height of TS_uni2) Greater than or equal to 10.00
                    • Then - Actions
                      • Animation - Change TS_uni2 flying height to ((Current flying height of TS_uni2) - 10.00) at 0.00
                    • Else - Actions
                      • Set TS_point = (Position of TS_uni2)
                      • Set TS_damage = (Load (Key damage) of TS_handle2 from TS_hash)
                      • Custom script: set bj_wantDestroyGroup = true
                      • Unit Group - Pick every unit in (Units within 75.00 of TS_point matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is dead) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of TS_uni2 and do (Actions)
                        • Loop - Actions
                          • Unit - Cause TS_uni2 to damage (Picked unit), dealing TS_damage damage of attack type Spells and damage type Normal
                      • Special Effect - Create a special effect at TS_point using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Hashtable - Clear all child hashtables of child TS_handle2 in TS_hash
                      • Unit Group - Remove TS_uni2 from TS_group
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (TS_group is empty) Equal to True
                        • Then - Actions
                          • Trigger - Turn off (This trigger)
                        • Else - Actions
                      • Unit - Kill TS_uni2
                • Else - Actions
                  • Hashtable - Clear all child hashtables of child TS_handle2 in TS_hash
                  • Unit Group - Remove TS_uni2 from TS_group
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (TS_group is empty) Equal to True
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
          • Custom script: call RemoveLocation(udg_TS_point)
tooltipw.png


V1.0 Uploaded on hive. 20/9/2011


Keywords:
thunder,Baaabuuu,hero,wc3gv
Contents

Thunderstorm (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. Add ability condition to TS cast Remove this from the loop in TS cast : Set TS_unit = (Triggering unit) Make the number of units configurable Move to TS Setup: Set TS_time = 330 When...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

Maker, Thunderstorm V1.0 , 17th Oct 2011

Add ability condition to TS cast
Remove this from the loop in TS cast : Set TS_unit = (Triggering unit)
Make the number of units configurable
Move to TS Setup: Set TS_time = 330
When could this return true: (Unit-type of TS_uni2) Not equal to (!=) Thunder orb Dummy?
When could this return false: (Unit-type of TS_uni2) Equal to (==) Thunder orb Dummy?
In TS Loop, there can be a case when you remove TS_Point even if it is not set.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,467
It looks good so far but I will still have to have a more detailed look at it.

One thing I recommend is using Hanky's Dynamic Indexing instead of hashtables/unit groups, because you have a lot of dummy units each cast of the spell and dynamic indexing will be a lot lighter on the processor for looping through the instances every 0.03 seconds.

http://www.hiveworkshop.com/forums/spells-569/gui-dynamic-indexing-template-144325/
 
Top