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!
You are using an out of date browser. It may not display this or other websites correctly. You should upgrade or use an alternative browser.
Triggers
Ball Lightning v0.01.w3x
Variables
Initialization
Initialization
Restoration
Spell
Ball Lightning Cast
Ball Lightning Slide
Enter map-specific custom script code below. This text will be included in the map script after variables are declared and before any trigger code.
Name
Type
is_array
initial_value
Caster
unit
No
Enemies
group
No
Hashtable
hashtable
No
Integer
integer
Yes
Lightning
lightning
No
Lightnings
group
No
Points
location
Yes
Real
real
Yes
Target
unit
No
Initialization
Events
Map initialization
Conditions
Actions
Visibility - Disable fog of war
Visibility - Disable black mask
Hashtable - Create a hashtable
Set Variable Set Hashtable = (Last created hashtable)
Game - Display to (All players) for 0.00 seconds the text: Don't worry about health, it will restore itself.
Restoration
Events
Unit - The Hero 0001 <gen> 's life becomes Less than 800.00
Conditions
Actions
Unit - Set life of (Triggering unit) to 100 %
Special Effect - Create a special effect attached to the overhead (Unexpected type: 'attachpoint') of (Triggering unit) using Abilities\Spells\Undead\ReplenishHealth\ReplenishHealthCasterOverhead.mdl
Special Effect - Destroy (Last created special effect)
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 very a very simple code. Enjoy!
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 Variable Set Caster = (Triggering unit)
Set Variable Set Target = (Target unit of ability being cast)
-------- Finds the Locations of the Duo --------
Set Variable Set Points[1] = (Position of Caster)
Set Variable 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 Variable 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 Variable Set Real[1] = "15.00"
-------- Counts up the damage dealt to the first target --------
-------- NOTE 4: Count and set your damage here --------
Set Variable 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 Variable Set Real[3] = (X of Points[1])
Set Variable 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 Of Target as 0 of (Key (Last created unit).) in Hashtable .
Hashtable - Save Handle Of Caster 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])
Spell's main body
Touch only things below the 'NOTE' comments
I hope you will learn something if you don't know something.
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 Variable Set Target = (Load 0 of (Key (Picked unit).) in Hashtable.)
Set Variable 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 Variable Set Points[1] = (Position of (Picked unit))
Set Variable Set Points[2] = (Position of Target)
Set Variable 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 Variable Set Real[1] = (Load 2 of (Key (Picked unit).) from Hashtable.)
Set Variable Set Real[2] = (Load 3 of (Key (Picked unit).) from Hashtable.)
Set Variable Set Real[3] = (Load 4 of (Key (Picked unit).) from Hashtable.)
Set Variable Set Real[4] = (Load 5 of (Key (Picked unit).) from Hashtable.)
Set Variable 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 Variable 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
-------- 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 , using font size 10 , color ( 100 %, 100 %, 100 %), and 0 % 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 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 (Unexpected type: 'attachpoint') of Target using Abilities\Weapons\Bolt\BoltImpact.mdl
Special Effect - Destroy (Last created special effect)
-------- Loads and reduces by 1 bounces-to-do --------
Set Variable Set Integer[1] = (Load 8 of (Key (Picked unit).) from Hashtable.)
Set Variable 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 Variable 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) and ((((Matching unit) is dead) Not equal to True) and ((((Matching unit) belongs to an enemy of (Owner of Caster).) Equal to True) and (((Matching unit) is visible to (Owner of Caster).) Equal to True)))))).)
-------- 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 Variable 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 Variable 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 Variable Set Real[3] = (X of Points[1])
Set Variable 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 VariableSet Target = (Picked unit))
-------- Updates the next target, lightning's speed, damage, the 'tail' point and bounces-to-do --------
Hashtable - Save Handle Of Target 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)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.