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

Ball Lightning v0.01

  • Like
Reactions: Baldoro
I read a suggestion for a spell a very long time ago, and now I remembered it.
It was in thehelper.net.
Suggestion was simple. Create a chain lightning, with which the caster should move.
As I used to play dota alot, I decided to choose the Storm Spirit's (aka storm panda) model.

Simple spell, not a very simple code,
Enjoy and give me credits if you use it.


  • Ball Lightning Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ball Lightning
    • Actions
      • -------- Stores Caster and Target into variables --------
      • -------- NOTE 1: From now on, I will call 'Caster and Target' Duo. --------
      • Set Caster = (Triggering unit)
      • Set Target = (Target unit of ability being cast)
      • -------- Finds the Locations of the Duo --------
      • Set Points[1] = (Position of Caster)
      • Set Points[2] = (Position of (Target unit of ability being cast))
      • -------- Stores total bounces into variable --------
      • -------- NOTE 2: This is a number of total targets to hit. Set your max targets here --------
      • Set Integer[1] = 6
      • -------- Stores the base speed of the Caster --------
      • -------- NOTE 3: Change your base speed here --------
      • -------- My base speed is 15/0.03=500 units per second --------
      • Set Real[1] = 15.00
      • -------- Counts up the damage dealt to the first target --------
      • -------- NOTE 4: Count and set your damage here --------
      • Set Real[2] = (30.00 + (40.00 x (Real((Level of Ball Lightning for Caster)))))
      • -------- Finds X, Y and Z of the caster's position for lightning effect purposes --------
      • Set Real[3] = (X of Points[1])
      • Set Real[4] = (Y of Points[1])
      • Custom script: set udg_Real[5] = GetLocationZ(udg_Points[1])
      • -------- Hides caster, as we will replace it with ROFLing dummy unit --------
      • Unit - Hide Caster
      • -------- Plays SFX to mark that the spell is succesfuly cast --------
      • -------- It is also instantly destroyed to fix the leak --------
      • Special Effect - Create a special effect at Points[1] using Abilities\Weapons\Bolt\BoltImpact.mdl
      • Special Effect - Destroy (Last created special effect)
      • -------- Creates a ROFLing dummy unit to replace the caster --------
      • -------- NOTE 5: Change your replacement's model in the Object editor, unit ROFLing dummy --------
      • Unit - Create 1 Dummy Unit for (Owner of Caster) at Points[1] facing (Angle from Points[1] to Points[2]) degrees
      • -------- Stores all the information needed into hashtable --------
      • -------- NOTE 6: All the information is attached to the ROFLing dummy unit --------
      • Hashtable - Save Handle OfTarget as 0 of (Key (Last created unit)) in Hashtable
      • Hashtable - Save Handle OfCaster as 1 of (Key (Last created unit)) in Hashtable
      • Hashtable - Save Real[1] as 2 of (Key (Last created unit)) in Hashtable
      • Hashtable - Save Real[2] as 3 of (Key (Last created unit)) in Hashtable
      • Hashtable - Save Real[3] as 4 of (Key (Last created unit)) in Hashtable
      • Hashtable - Save Real[4] as 5 of (Key (Last created unit)) in Hashtable
      • Hashtable - Save Real[5] as 6 of (Key (Last created unit)) in Hashtable
      • -------- NOTE 7: I create lightning effect here, so change it here --------
      • -------- NOTE 8: It isn't really important where do I create the Lightning effect, until it is created between Points[1] finding and saving it into hashtable --------
      • Lightning - Create a Forked Lightning lightning effect from source Points[1] to target Points[1]
      • Hashtable - Save Handle Of(Last created lightning effect) as 7 of (Key (Last created unit)) in Hashtable
      • Hashtable - Save Integer[1] as 8 of (Key (Last created unit)) in Hashtable
      • -------- Checks if there is any instance of spell already in game --------
      • -------- If not, then turns the Sliding trigger on --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Lightnings is empty) Equal to True
        • Then - Actions
          • Trigger - Turn on Ball Lightning Slide <gen>
        • Else - Actions
      • -------- Adds ROFLing dummy unit to the Dummies' group --------
      • Unit Group - Add (Last created unit) to Lightnings
      • -------- Clears the Leaks --------
      • Custom script: call RemoveLocation(udg_Points[1])
      • Custom script: call RemoveLocation(udg_Points[2])
  • Ball Lightning Slide
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Lightnings and do (Actions)
        • Loop - Actions
          • -------- Stores the Duo into their variables --------
          • Set Target = (Load 0 of (Key (Picked unit)) in Hashtable)
          • Set Caster = (Load 1 of (Key (Picked unit)) in Hashtable)
          • -------- Finds locations of the Duo and the point to which the ROFLing dummy will be moved --------
          • Set Points[1] = (Position of (Picked unit))
          • Set Points[2] = (Position of Target)
          • Set Points[3] = (Points[1] offset by Real[1] towards (Angle from Points[1] to Points[2]) degrees)
          • -------- Loads movement speed, damage and the start location of the Lightning --------
          • Set Real[1] = (Load 2 of (Key (Picked unit)) from Hashtable)
          • Set Real[2] = (Load 3 of (Key (Picked unit)) from Hashtable)
          • Set Real[3] = (Load 4 of (Key (Picked unit)) from Hashtable)
          • Set Real[4] = (Load 5 of (Key (Picked unit)) from Hashtable)
          • Set Real[5] = (Load 6 of (Key (Picked unit)) from Hashtable)
          • -------- Counts the height at which the Lightning effect's 'head' will be risen --------
          • Custom script: set udg_Real[6] = GetLocationZ(udg_Points[1]) + 40.00
          • -------- Loads the Lightning effect --------
          • Set Lightning = (Load 7 of (Key (Picked unit)) in Hashtable)
          • -------- Checks if it isn't time to hit the current target --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between Points[1] and Points[2]) Greater than or equal to 100.00
            • Then - Actions
              • -------- If it isn't, then... --------
              • -------- Moves ROFLing dummy unit to the Third Point --------
              • Unit - Move (Picked unit) instantly to Points[3], facing (Angle from Points[1] to Points[2]) degrees
              • -------- Moves lightning --------
              • Custom script: call MoveLightningEx(udg_Lightning, true, udg_Real[3], udg_Real[4], udg_Real[5], GetLocationX(udg_Points[1]), GetLocationY(udg_Points[1]), udg_Real[6])
            • Else - Actions
              • -------- If it is, then... --------
              • -------- Creates a floating text to show the damage dealt by this bounce --------
              • Floating Text - Create floating text that reads (String((Integer(Real[2])))) at Points[1] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • -------- Causes Caster to damage Current Target --------
              • Unit - Cause Caster to damage Target, dealing Real[2] damage of attack type Spells and damage type Normal
              • -------- Creates the Impact SFX on target --------
              • -------- NOTE 1: Change your impact SFX here --------
              • Special Effect - Create a special effect attached to the origin of Target using Abilities\Weapons\Bolt\BoltImpact.mdl
              • Special Effect - Destroy (Last created special effect)
              • -------- Loads and reduces by 1 bounces-to-do --------
              • Set Integer[1] = (Load 8 of (Key (Picked unit)) from Hashtable)
              • Set Integer[1] = (Integer[1] - 1)
              • -------- Checks if it was bounce --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Integer[1] Greater than 0
                • Then - Actions
                  • -------- If not, then... --------
                  • -------- Enumerates all possible targets --------
                  • -------- NOTE 2: Enumerates organic, not magic immune live units, that belong to enemies of Caster and are visible to the owner of Caster --------
                  • Set Enemies = (Units within 500.00 of Points[1] matching (((((Matching unit) is A structure) Not equal to True) and ((Matching unit) Not equal to Target)) and ((((Matching unit) is Mechanical) Not equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) an
                  • -------- Checks if there is at least one possible target --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Enemies is empty) Not equal to True
                    • Then - Actions
                      • -------- If there is, then... --------
                      • -------- Increases the speed of the ROFLing dummy unit --------
                      • -------- NOTE 3: Change your speed increasement here --------
                      • -------- My speed boost is 6/0.03=200 units per second of speed --------
                      • Set Real[1] = (Real[1] + 6.00)
                      • -------- Boosts the damage that will be dealt to the next target --------
                      • -------- NOTE 4: Change your damage boost here --------
                      • Set Real[2] = (Real[2] + (Real[2] x 0.22))
                      • -------- Finds the X, Y and Z of the Points[1], for Lightning effect purposes --------
                      • Set Real[3] = (X of Points[1])
                      • Set Real[4] = (Y of Points[1])
                      • Custom script: set udg_Real[5] = GetLocationZ(udg_Points[1])
                      • -------- Destroys current lightning effect --------
                      • Lightning - Destroy Lightning
                      • -------- Creates a new lightning effect --------
                      • -------- NOTE 5: This effect must of equal type as was your lightning in the cast trigger --------
                      • Lightning - Create a Forked Lightning lightning effect from source Points[1] to target Points[1]
                      • -------- Chooses a random unit from enemies' group --------
                      • Unit Group - Pick every unit in (Random 1 units from Enemies) and do (Set Target = (Picked unit))
                      • -------- Updates the next target, lightning's speed, damage, the 'tail' point and bounces-to-do --------
                      • Hashtable - Save Handle OfTarget as 0 of (Key (Picked unit)) in Hashtable
                      • Hashtable - Save Real[1] as 2 of (Key (Picked unit)) in Hashtable
                      • Hashtable - Save Real[2] as 3 of (Key (Picked unit)) in Hashtable
                      • Hashtable - Save Real[3] as 4 of (Key (Picked unit)) in Hashtable
                      • Hashtable - Save Real[4] as 5 of (Key (Picked unit)) in Hashtable
                      • Hashtable - Save Real[5] as 6 of (Key (Picked unit)) in Hashtable
                      • Hashtable - Save Handle Of(Last created lightning effect) as 7 of (Key (Picked unit)) in Hashtable
                      • Hashtable - Save Integer[1] as 8 of (Key (Picked unit)) in Hashtable
                    • Else - Actions
                      • -------- If there isn't then... --------
                      • -------- Destroys lightning effect --------
                      • Lightning - Destroy Lightning
                      • -------- Moves caster to the Current position of the ROFLing dummy --------
                      • Unit - Move Caster instantly to Points[1], facing (Angle from Points[1] to Points[2]) degrees
                      • -------- Unhides the Caster, as we will replace the ROFLing dummy with the Caster --------
                      • Unit - Unhide Caster
                      • -------- Adds Caster to its owner's selection --------
                      • Selection - Add Caster to selection for (Owner of Caster)
                      • -------- Makes Caster invulnerable, solely for Spawn guarding purposes --------
                      • Hero - Create Invulnerability and give it to Caster
                      • -------- Clears the Hashtable --------
                      • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
                      • -------- Removes the ROFLing dummy unit form ROFLers' group --------
                      • Unit Group - Remove (Picked unit) from Lightnings
                      • -------- Removes ROFLing dummy unit from game, finishing the replacement --------
                      • Unit - Remove (Picked unit) from the game
                  • -------- Clears the group leak --------
                  • Custom script: call DestroyGroup(udg_Enemies)
                • Else - Actions
                  • -------- If it was, then... --------
                  • -------- Destroys lightning effect --------
                  • Lightning - Destroy Lightning
                  • -------- Moves caster to the Current position of the ROFLing dummy --------
                  • Unit - Move Caster instantly to Points[1], facing (Angle from Points[1] to Points[2]) degrees
                  • -------- Unhides the Caster, as we will replace the ROFLing dummy with the Caster --------
                  • Unit - Unhide Caster
                  • -------- Adds Caster to its owner's selection --------
                  • Selection - Add Caster to selection for (Owner of Caster)
                  • -------- Makes Caster invulnerable, solely for Spawn guarding purposes --------
                  • Hero - Create Invulnerability and give it to Caster
                  • -------- Clears the Hashtable --------
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
                  • -------- Removes the ROFLing dummy unit form ROFLers' group --------
                  • Unit Group - Remove (Picked unit) from Lightnings
                  • -------- Removes ROFLing dummy unit from game, finishing the replacement --------
                  • Unit - Remove (Picked unit) from the game
          • -------- Clears the Leaks --------
          • Custom script: call RemoveLocation(udg_Points[1])
          • Custom script: call RemoveLocation(udg_Points[2])
          • Custom script: call RemoveLocation(udg_Points[3])
      • -------- Checks if there is any instance of spell left after this loop --------
      • -------- If not, then turns this trigger off --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Lightnings is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions


v0.01 - First Upload


Keywords:
Chain, Lightning, ROFL, storm, hit, move
Contents

Ball Lightning v0.01 (Map)

Reviews
11:03, 4th Sep 2010 TriggerHappy: The spell has a very cool effect and the coding was fine.

Moderator

M

Moderator

11:03, 4th Sep 2010
TriggerHappy:

The spell has a very cool effect and the coding was fine.
 
Level 3
Joined
Nov 8, 2009
Messages
46
Hey i have problem

Hey can u help me? When i test the skill in my map it wont work. When i cast it, my hero just stuck there, on air rolling. IT DOESENT MOVE TO ITS TARGET.
 
Last edited:
Level 9
Joined
Oct 31, 2009
Messages
121
Hey can u help me? When i test the skill in my map it wont work. When i cast it, my hero just stuck there, on air rolling. IT DOESENT MOVE TO ITS TARGET.

I could, but I got a pair of questions:
1. Did you set preferences to automaticly copy unknown variables?
2. If you did, then did you try to copy it into another test map.
3. If you did, did it work?

If it worked fine in the new test map, then I guess you have variable Integer not arrayed in your first map.

Hope I helped. If not, send me your new test map with spell copied to [email protected], please
 
Top