Flare
Stops copies me!
- Reaction score
- 662
A fully triggered chain lightning spell (absolutely everything that I can think of is customizable )
Huge thanks to Vypur85 for helping me to fix the spell (he saved this spell from the scrap-heap )
Technical Details:
LIST OF CONFIGURABLE PROPERTIES: (this is all I can think of at the moment)
If you can link me to a Chain Lightning spell that's equally/more customizable than this, I'll give you a cookie!
GUI/JASS? GUI
MUI/MPI: MUI, 1000 cast instances and 1000 lightning instances (lightning lasts for 0.6 seconds, so try and get 1000 instances in that time...)
Leaks: I don't think so
Laggy: Unless lightning effects can screw you over, no.
How to import:
SCREENSHOT (it's difficult to get a picture of this)
CODE: (have fun reading through all this )
If you find any bugs with the spell, let me know
If you use this spell, give me credits (and to vypur85, if he wants credit, for helping me to get the spell to work)
Thanks to Draphoelix for (accidently?) inspiring me to make this
Some info about customizing the second one (that uses alternate lightning, special effect on target and bounce on closest target)
UPDATES:
Huge thanks to Vypur85 for helping me to fix the spell (he saved this spell from the scrap-heap )
Technical Details:
LIST OF CONFIGURABLE PROPERTIES: (this is all I can think of at the moment)
Amount of bounces
Time between bounces
AoE for potential bounce targets
Repeat/Don't repeat same unit
Damage
Damage reduction per bounce
Lightning duration
Lightning fade speed
Lightning's colour
Alternating lightning/special effects
Different (damage) effect on each bounce (e.g. mana burn, then life drain, then shackles ETC)
Time between bounces
AoE for potential bounce targets
Repeat/Don't repeat same unit
Damage
Damage reduction per bounce
Lightning duration
Lightning fade speed
Lightning's colour
Alternating lightning/special effects
Different (damage) effect on each bounce (e.g. mana burn, then life drain, then shackles ETC)
GUI/JASS? GUI
MUI/MPI: MUI, 1000 cast instances and 1000 lightning instances (lightning lasts for 0.6 seconds, so try and get 1000 instances in that time...)
Leaks: I don't think so
Laggy: Unless lightning effects can screw you over, no.
How to import:
-Copy the custom Chain Lightning base skill into your map
-In File -> Preferences, make sure that 'Automatically create unknown variables when pasting trigger data' is checked.
-Copy the 'Lightning cast' and 'Lightning bounce and decay' into your map
*If using the alternating lightning version, copy the Set lightningtype and Set sfxstring actions into your Map Initialization trigger, so you have a default value for your varying lightning effects and corresponding zap effects.
-Add the ability to your hero
-Test it out and hope it works
-Give me credit and cookies!
-In File -> Preferences, make sure that 'Automatically create unknown variables when pasting trigger data' is checked.
-Copy the 'Lightning cast' and 'Lightning bounce and decay' into your map
*If using the alternating lightning version, copy the Set lightningtype and Set sfxstring actions into your Map Initialization trigger, so you have a default value for your varying lightning effects and corresponding zap effects.
-Add the ability to your hero
-Test it out and hope it works
-Give me credit and cookies!
SCREENSHOT (it's difficult to get a picture of this)
CODE: (have fun reading through all this )
Code:
Lightning cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Chain Lightning
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
customvalue1 Less than 1000
Then - Actions
Set customvalue1 = (customvalue1 + 1)
Else - Actions
Set customvalue1 = 1
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
customvalue2 Less than 1000
Then - Actions
Set customvalue2 = (customvalue2 + 1)
Else - Actions
Set customvalue2 = 1
Set caster[customvalue1] = (Triggering unit)
Set oldtarget[customvalue1] = (Triggering unit)
Set target[customvalue1] = (Target unit of ability being cast)
Set currentbounce[customvalue1] = 0
Set maxbounce[customvalue1] = 10
Set damage[customvalue1] = 100.00
Set lightningunita[customvalue2] = (Triggering unit)
Set lightningunitb[customvalue2] = (Target unit of ability being cast)
Set temppoint = (Center of (Playable map area))
Set lightningmaxdur[customvalue2] = 0.60
Set lightningfade[customvalue2] = 1.00
Set lightningcurrentdur[customvalue2] = 0.00
Set pointa = (Position of caster[customvalue1])
Set pointb = (Position of target[customvalue1])
Set timebetweenbounce[customvalue1] = (0.75 - (0.15 x (Real((Level of Chain Lightning for caster[customvalue1])))))
Set bouncearea[tempinteger1] = (200.00 x (Real((Level of Chain Lightning for caster[customvalue1]))))
Unit Group - Add target[customvalue1] to previoustargets[customvalue1]
Lightning - Create a Chain Lightning - Primary lightning effect from source pointa to target pointb
Set lightning[customvalue2] = (Last created lightning effect)
Custom script: call RemoveLocation (udg_pointa)
Custom script: call RemoveLocation (udg_pointb)
Unit - Create 1 Dummy Unit for (Owner of caster[customvalue1]) at temppoint facing Default building facing degrees
Unit - Set the custom value of (Last created unit) to customvalue1
Unit Group - Add (Last created unit) to dummygroup
Unit - Create 1 Dummy Unit for (Owner of caster[customvalue1]) at temppoint facing Default building facing degrees
Unit - Set the custom value of (Last created unit) to customvalue2
Unit Group - Add (Last created unit) to lightninggroup2
Custom script: call RemoveLocation (udg_temppoint)
Unit - Cause caster[customvalue1] to damage target[customvalue1], dealing damage[customvalue1] damage of attack type Spells and damage type Normal
--------------------------------------------------------------
Lightning bounce and decay
Events
Time - Every 0.05 seconds of game time
Conditions
Or - Any (Conditions) are true
Conditions
(Number of units in dummygroup) Greater than 0
(Number of units in lightninggroup2) Greater than 0
Actions
Unit Group - Pick every unit in dummygroup and do (Actions)
Loop - Actions
Set tempinteger1 = (Custom value of (Picked unit))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
currentbounce[tempinteger1] Less than maxbounce[tempinteger1]
Then - Actions
Set bouncetime[tempinteger1] = (bouncetime[tempinteger1] + 0.05)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
bouncetime[tempinteger1] Greater than or equal to timebetweenbounce[tempinteger1]
Then - Actions
Set bouncetime[tempinteger1] = 0.00
Set oldtarget[tempinteger1] = target[tempinteger1]
Set temppoint = (Position of oldtarget[tempinteger1])
Set nearbytargets = (Units within 600.00 of temppoint matching (((((Matching unit) is A structure) Equal to False) and (((Matching unit) is alive) Equal to True)) and (((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True)))
Custom script: call RemoveLocation (udg_temppoint)
Unit Group - Remove all units of previoustargets[tempinteger1] from nearbytargets
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in nearbytargets) Greater than 0
Then - Actions
Set currentbounce[tempinteger1] = (currentbounce[tempinteger1] + 1)
Set damagedecay[tempinteger1] = (damage[tempinteger1] x 0.10)
Set damage[tempinteger1] = (damage[tempinteger1] - damagedecay[tempinteger1])
Set target[tempinteger1] = (Random unit from nearbytargets)
Set temppoint = (Center of (Playable map area))
Unit Group - Add target[tempinteger1] to previoustargets[tempinteger1]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
customvalue2 Less than 1000
Then - Actions
Set customvalue2 = (customvalue2 + 1)
Else - Actions
Set customvalue2 = 1
Unit - Cause caster[customvalue1] to damage target[customvalue1], dealing damage[customvalue1] damage of attack type Spells and damage type Normal
-------- NONE OF THIS IS WORKING --------
Unit - Create 1 Dummy Unit for (Owner of caster[tempinteger1]) at temppoint facing Default building facing degrees
Set TEMPUNIT = (Last created unit)
Unit - Set the custom value of TEMPUNIT to customvalue2
Unit Group - Add TEMPUNIT to lightninggroup2
-------- ANYTHING BETWEEN THESE COMMENTS = BROKEN --------
Set lightningunita[customvalue2] = oldtarget[tempinteger1]
Set lightningunitb[customvalue2] = target[tempinteger1]
Set pointa = (Position of lightningunita[customvalue2])
Set pointb = (Position of lightningunitb[customvalue2])
Lightning - Create a Chain Lightning - Primary lightning effect from source pointa to target pointb
Set lightning[customvalue2] = (Last created lightning effect)
-------- THIS ALLOWS YOU TO ALTER THE MAX DURATION OF THE LIGHTNING. --------
Set lightningmaxdur[customvalue2] = 0.60
-------- THIS ALLOWS YOU TO ALTER THE FADING RATE OF LIGHTNING --------
Set lightningfade[customvalue2] = 1.00
Set lightningcurrentdur[customvalue2] = 0.00
Custom script: call RemoveLocation (udg_pointa)
Custom script: call RemoveLocation (udg_pointb)
Custom script: call RemoveLocation (udg_temppoint)
Else - Actions
Set currentbounce[tempinteger1] = 0
Unit Group - Remove all units of previoustargets[tempinteger1] from previoustargets[tempinteger1]
Unit Group - Remove all units of previoustargets[tempinteger1] from previoustargets[tempinteger1]
Unit - Remove (Picked unit) from the game
Else - Actions
Else - Actions
Set currentbounce[tempinteger1] = 0
Unit Group - Remove all units of previoustargets[tempinteger1] from previoustargets[tempinteger1]
Unit Group - Remove all units of previoustargets[tempinteger1] from previoustargets[tempinteger1]
Unit - Remove (Picked unit) from the game
Unit Group - Pick every unit in lightninggroup2 and do (Actions)
Loop - Actions
Set tempinteger2 = (Custom value of (Picked unit))
Set pointa = (Position of lightningunita[tempinteger2])
Set pointb = (Position of lightningunitb[tempinteger2])
Lightning - Move lightning[tempinteger2] to source pointa and target pointb
Set lightningcurrentdur[tempinteger2] = (lightningcurrentdur[tempinteger2] + 0.05)
Set lightningfade[tempinteger2] = (lightningfade[tempinteger2] - 0.08)
Lightning - Change color of (Last created lightning effect) to (1.00 1.00 1.00) with lightningfade[tempinteger2] alpha
Custom script: call RemoveLocation (udg_pointa)
Custom script: call RemoveLocation (udg_pointb)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
lightningcurrentdur[tempinteger2] Equal to lightningmaxdur[tempinteger2]
Then - Actions
Lightning - Destroy lightning[tempinteger2]
Set lightningcurrentdur[tempinteger2] = 0.00
Set lightningfade[tempinteger2] = 1.00
Unit - Remove (Picked unit) from the game
Else - Actions
If you find any bugs with the spell, let me know
If you use this spell, give me credits (and to vypur85, if he wants credit, for helping me to get the spell to work)
Thanks to Draphoelix for (accidently?) inspiring me to make this
Some info about customizing the second one (that uses alternate lightning, special effect on target and bounce on closest target)
Code:
If you are using the second version (for closest target bounce, and zappy effects), but want to keep the lightning effect consistent, do the following:
-Go to the Map Init trigger, and find the Set lightningtype and Set sfxstring actions. Set the value for both arrays to the same lightning type, and the same SFX string i.e.
Set lightningtype[0] = Chain Lightning - Primary
Set lightningtype[1] = Chain Lightning - Primary
Set sfxstring[0] = (your special effect's model path)
Set sfxstring[1] = (same model path as sfxstring[0])
It'll save the trouble of trying to dig through the main spell code and alter the lightning stuff from there, since editting 4 lines that are side-by-side is much easier than searching through triggers for 4 lines of code that are scattered.
UPDATES:
Code:
Update 1: Added the lightning effect when a unit is hit
Update 2: Added a second demo map. This demo map uses alternating lightning/special effects, and it bounces to the nearest target when bouncing.