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

Lightning Vortex v1.2

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
Well, this is the first spell/resource I upload, so I hope I get good feedback and suggestions.
Here we go:

The Lightning Vortex summons two lightning energy beams that rotate around the caster.
- Level 1: The beams rotate around the caster, and deal damage to any ground enemy unit they com in contact with.
- Level 2: The beams rotate around the caster, but also oscilate up and down with a sinusoidal movement. If the beams are near the ground, they deal damage to enemy ground units, but if they are high avobe ground, they deal damage to air enemy units.
- Level 3: The beams rotate around the caster and oscilate as well, but this time the oscilation is faster. The beams now deal damage to both ground and air units.


In order to use this spell, first of all you must go to "File - Preferences" and enable the creation of unknown variables when pasting trigger data. Next, open the test map, open the trigger editor, copy the "Lightning Vortex" folder, and then paste it in your map.
After that, all you have to do is create your ability in the object editor. Go to the "Lightning Vortex START" trigger, and set the condition to fit your ability.
After doing all this, the only thing you have to do is to create the dummy units the spell uses. They are just for decoration, so you can choose any model you want for them. Go to the object editor and create a unit. Give it the "Invulnerable" and "Locust" abilities, remove his shadows, and MAKE THEM FLY. Choose the model you want. One dummy will be placed in the caster, and one in the end of each lightning beam. It looks nice with "Abilities\Weapons\Bolt\BoltImpact.mdl".

All the rest of the configuration is the "Lightning Vortex SETUP" trigger.

You're done, it should work.


  • Lightning Vortex SETUP
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Defines the area of effect of the spell. --------
      • Set LV_L = 500.00
      • -------- Defines the maximum height the sinusoidal movement of the spell will reach. --------
      • Set LV_H = 500.00
      • -------- -------------------------------------------------------------------------------- --------
      • -------- [0]: Level 1, [1]: Level 2, [2]: Level 3 --------
      • -------- Defines the damage dealt to enemies per level. --------
      • Set LV_Dmg[0] = 20.00
      • Set LV_Dmg[1] = 25.00
      • Set LV_Dmg[2] = 30.00
      • -------- Defines what kind of enemies will damage each level of the spell. SEE BELOW FOR DETAILS. --------
      • -------- ---------- 0: Damage to ground units. --------
      • -------- ---------- 1: Damage to air units. --------
      • -------- ---------- 2: Damage to ground units when lightnings are near the ground, and to air units when lightnings are up in the sky. --------
      • -------- ---------- ANY OTHER VALUE: Damage to both ground and air units, always. --------
      • Set LV_Tar[0] = 0
      • Set LV_Tar[1] = 2
      • Set LV_Tar[2] = 3
      • -------- Defines is the lightnings will oscilate with each level. If set to 0, the lightnings won't oscilate. If set to 1, the lightnings will oscilate. THIS MUST NOT BE SET TO ANY VALUE OTHER THAN 0 OR 1. --------
      • Set LV_Osc[0] = 0
      • Set LV_Osc[1] = 1
      • Set LV_Osc[2] = 1
      • -------- Defines the speed of the oscialtion per level. The lesser this value is, the faster will be the oscilation. --------
      • Set LV_Sp[0] = 20.00
      • Set LV_Sp[1] = 10.00
      • Set LV_Sp[2] = 5.00
      • -------- -------------------------------------------------------------------------------- --------
      • -------- Defines the duration of the spell, in seconds. --------
      • Set LV_T = 20.00
      • -------- Defines the speed of the rotation. --------
      • Set LV_R = 166.67
      • -------- Defines the Unit Type ID of the dummies. You MUST write 'Your_code'. See trigger comment if you don't know how to find the codes. --------
      • Custom script: set udg_LV_D = 'h000'
      • -------- Defines the Lightning Type used --------
      • Set LV_LT = FORK
      • -------- Creates the hashtable for the spell. THIS SHOULD NOT BE TOUCHED. --------
      • Tabla hash - Create a hashtable
      • Set Lightning_Vortex = (Last created hashtable)
  • Lightning Vortex START
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Vortex
    • Actions
      • Set Key = (Key (Triggering unit))
      • Set TempUnit2 = (Triggering unit)
      • -------- Adding the caster to the group of casters --------
      • Unit Group - Add TempUnit2 to Lightning_Vortex_Casters
      • -------- Initializating spell duration --------
      • Hashtable - Save 0.00 as 7 of Key in Lightning_Vortex
      • -------- Initializating angles --------
      • Hashtable - Save 0.00 as 2 of Key in Lightning_Vortex
      • Hashtable - Save 0.00 as 6 of Key in Lightning_Vortex
      • -------- Creation of the central DUMMY --------
      • Custom script: set udg_TempUnit = CreateUnit(Player(0), udg_LV_D, GetUnitX(udg_TempUnit2), GetUnitY(udg_TempUnit2), 270.00)
      • Animation - Change TempUnit flying height to 100.00 at 0.00
      • Hashtable - Save Handle OfTempUnit as 3 of Key in Lightning_Vortex
      • -------- Creation of the first secondary DUMMY --------
      • Custom script: set udg_TempUnit = CreateUnit(Player(0), udg_LV_D, GetUnitX(udg_TempUnit2) + udg_LV_L, GetUnitY(udg_TempUnit2), 270.00)
      • Animation - Change TempUnit flying height to 100.00 at 0.00
      • Hashtable - Save Handle OfTempUnit as 4 of Key in Lightning_Vortex
      • -------- Creation of the first LIGHTNING --------
      • Custom script: set udg_TempLight = AddLightningEx(udg_LV_LT, true, GetUnitX(udg_TempUnit2), GetUnitY(udg_TempUnit2), 100, GetUnitX(udg_TempUnit2) + udg_LV_L, GetUnitY(udg_TempUnit2), 100)
      • Hashtable - Save Handle OfTempLight as 0 of Key in Lightning_Vortex
      • -------- Creation of the second secondary DUMMY --------
      • Custom script: set udg_TempUnit = CreateUnit(Player(0), udg_LV_D, GetUnitX(udg_TempUnit2) - udg_LV_L, GetUnitY(udg_TempUnit2), 270.00)
      • Animation - Change TempUnit flying height to 100.00 at 0.00
      • Hashtable - Save Handle OfTempUnit as 5 of Key in Lightning_Vortex
      • -------- Creation of the second LIGHTNING --------
      • Custom script: set udg_TempLight = AddLightningEx(udg_LV_LT, true, GetUnitX(udg_TempUnit2), GetUnitY(udg_TempUnit2), 100, GetUnitX(udg_TempUnit2) - udg_LV_L, GetUnitY(udg_TempUnit2), 100)
      • Hashtable - Save Handle OfTempLight as 1 of Key in Lightning_Vortex
  • Lightning Vortex LOOP
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Lightning_Vortex_Casters and do (Actions)
        • Loop - Actions
          • Set Key = (Key (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 7 of Key from Lightning_Vortex) Lesser than LV_T
            • Then - Actions
              • -------- Moving the central dummy with the caster --------
              • Set TempUnit = (Load 3 of Key in Lightning_Vortex)
              • Custom script: call SetUnitX(udg_TempUnit, GetUnitX(GetEnumUnit()))
              • Custom script: call SetUnitY(udg_TempUnit, GetUnitY(GetEnumUnit()))
              • -------- Moving the first secondary DUMMY --------
              • Set TempReal = (Load 2 of Key from Lightning_Vortex)
              • Set TempUnit = (Load 4 of Key in Lightning_Vortex)
              • Custom script: call SetUnitX(udg_TempUnit, GetUnitX(GetEnumUnit()) + udg_LV_L * Cos(udg_TempReal * bj_DEGTORAD))
              • Custom script: call SetUnitY(udg_TempUnit, GetUnitY(GetEnumUnit()) + udg_LV_L * Sin(udg_TempReal * bj_DEGTORAD))
              • Set TempReal = (((LV_H x (Power((Sin(((Load 6 of Key from Lightning_Vortex) / LV_Sp[((Level of Lightning Vortex for (Picked unit)) - 1)]))), 2.00))) x (Real(LV_Osc[((Level of Lightning Vortex for (Picked unit)) - 1)]))) + (100.00 x (1.00 - (Real(LV_Osc[((Level of Lightnin
              • Animation - Change TempUnit flying height to TempReal at 0.00
              • -------- Moving the first LIGHTNING --------
              • Set TempReal02 = (Load 2 of Key from Lightning_Vortex)
              • Set TempLight = (Load 0 of Key in Lightning_Vortex)
              • Custom script: call MoveLightningEx(udg_TempLight, true, GetUnitX(GetEnumUnit()), GetUnitY(GetEnumUnit()), 100, GetUnitX(GetEnumUnit()) + udg_LV_L * Cos(udg_TempReal02 * bj_DEGTORAD), GetUnitY(GetEnumUnit()) + udg_LV_L * Sin(udg_TempReal02 * bj_DEGTORAD), udg_TempReal)
              • -------- Moving the second secondary DUMMY --------
              • Set TempReal = (Load 2 of Key from Lightning_Vortex)
              • Set TempUnit = (Load 5 of Key in Lightning_Vortex)
              • Custom script: call SetUnitX(udg_TempUnit, GetUnitX(GetEnumUnit()) + udg_LV_L * Cos((180 + udg_TempReal) * bj_DEGTORAD))
              • Custom script: call SetUnitY(udg_TempUnit, GetUnitY(GetEnumUnit()) + udg_LV_L * Sin((180 + udg_TempReal) * bj_DEGTORAD))
              • Set TempReal = (((LV_H x (Power((Sin(((Load 6 of Key from Lightning_Vortex) / LV_Sp[((Level of Lightning Vortex for (Picked unit)) - 1)]))), 2.00))) x (Real(LV_Osc[((Level of Lightning Vortex for (Picked unit)) - 1)]))) + (100.00 x (1.00 - (Real(LV_Osc[((Level of Lightnin
              • Animation - Change TempUnit flying height to TempReal at 0.00
              • -------- Moving the second LIGHTNING --------
              • Custom script: set udg_TempReal02 = (180 + LoadRealBJ(2, udg_Key, udg_Lightning_Vortex)) * bj_DEGTORAD
              • Set TempLight = (Load 1 of Key in Lightning_Vortex)
              • Custom script: call MoveLightningEx(udg_TempLight, true, GetUnitX(GetEnumUnit()), GetUnitY(GetEnumUnit()), 100, GetUnitX(GetEnumUnit()) + udg_LV_L * Cos(udg_TempReal02), GetUnitY(GetEnumUnit()) + udg_LV_L * Sin(udg_TempReal02), udg_TempReal)
              • -------- Updating new angle for rotation --------
              • Hashtable - Save ((Load 2 of Key from Lightning_Vortex) + (LV_R x 0.03)) as 2 of Key in Lightning_Vortex
              • -------- Updating new angle for sinusoidal trayectory --------
              • Hashtable - Save ((Load 6 of Key from Lightning_Vortex) + 25.00) as 6 of (Key (Picked unit)) in Lightning_Vortex
            • Other - Actions
              • -------- Removing dummies and lightnings --------
              • Unit - Remove (Load 3 of Key in Lightning_Vortex) from the game
              • Unit - Remove (Load 4 of Key in Lightning_Vortex) from the game
              • Unit - Remove (Load 5 of Key in Lightning_Vortex) from the game
              • Lightning - Destroy (Load 0 of Key in Lightning_Vortex)
              • Lightning - Destroy (Load 1 of Key in Lightning_Vortex)
              • Unit Group - Remove (Picked unit) from Lightning_Vortex_Casters
  • Lightning Vortex DURATION
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Lightning_Vortex_Casters and do (Actions)
        • Loop - Actions
          • Hashtable - Save ((Load 7 of (Key (Picked unit)) from Lightning_Vortex) + 1.00) as 7 of (Key (Picked unit)) in Lightning_Vortex
  • Lightning Vortex DAMAGE
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Lightning_Vortex_Casters and do (Actions)
        • Loop - Actions
          • Set Key = (Key (Picked unit))
          • -------- TARGETS OF THE FIRST LIGHTNING --------
          • For each (Integer COUNTER) from 1 to 10, do (Actions)
            • Loop - Actions
              • Custom script: set udg_TempReal = (((udg_LV_L / 10.00) * I2R(udg_COUNTER)) * Cos(LoadRealBJ(2, udg_Key, udg_Lightning_Vortex) * bj_DEGTORAD))
              • Custom script: set udg_TempReal02 = (((udg_LV_L / 10.00) * I2R(udg_COUNTER)) * Sin(LoadRealBJ(2, udg_Key, udg_Lightning_Vortex) * bj_DEGTORAD))
              • Custom script: set udg_TempLoc01 = Location(GetUnitX(GetEnumUnit()) + udg_TempReal, GetUnitY(GetEnumUnit()) + udg_TempReal02)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LV_Tar[((Level of Lightning Vortex for (Picked unit)) - 1)] Equal to 0
                • Then - Actions
                  • Set TempGroup01 = (Units within 40.00 of TempLoc01 matching ((((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is A ground unit) Equal to True)))
                • Other - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • LV_Tar[((Level of Lightning Vortex for (Picked unit)) - 1)] Equal to 1
                    • Then - Actions
                      • Set TempGroup01 = (Units within 40.00 of TempLoc01 matching ((((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is A flying unit) Equal to True)))
                    • Other - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • LV_Tar[((Level of Lightning Vortex for (Picked unit)) - 1)] Equal to 2
                        • Then - Actions
                          • Set TempReal = (LV_H x (Power((Sin(((Load 6 of Key from Lightning_Vortex) / 10.00))), 2.00)))
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • TempReal Higher than or equal to 125.00
                            • Then - Actions
                              • Set TempGroup01 = (Units within 40.00 of TempLoc01 matching ((((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Eqaul to True) and (((Matching unit) is A flying unit) Equal to True)))
                            • Other - Actions
                              • Set TempGroup01 = (Units within 40.00 of TempLoc01 matching ((((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is A ground unit) Equal to True)))
                        • Other - Actions
                          • Set TempGroup01 = (Units within 40.00 of TempLoc01 matching (((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True))
              • Unit Group - Add all units of TempGroup01 to TempGroup02
              • Custom script: call DestroyGroup(udg_TempGroup01)
              • Custom script: call RemoveLocation(udg_TempLoc01)
          • -------- TARGETS OF THE SECOND LIGHTNING --------
          • For each (Integer COUNTER) from 1 to 10, do (Actions)
            • Loop - Actions
              • Custom script: set udg_TempReal = (((udg_LV_L / 10.00) * I2R(udg_COUNTER)) * Cos(180 + LoadRealBJ(2, udg_Key, udg_Lightning_Vortex) * bj_DEGTORAD))
              • Custom script: set udg_TempReal02 = (((udg_LV_L / 10.00) * I2R(udg_COUNTER)) * Sin(180 + LoadRealBJ(2, udg_Key, udg_Lightning_Vortex) * bj_DEGTORAD))
              • Custom script: set udg_TempLoc01 = Location(GetUnitX(GetEnumUnit()) + udg_TempReal, GetUnitY(GetEnumUnit()) + udg_TempReal02)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LV_Tar[((Level of Lightning Vortex for (Picked unit)) - 1)] Equal to 0
                • Then - Actions
                  • Set TempGroup01 = (Units within 40.00 of TempLoc01 matching ((((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is A ground unit) Equal to True)))
                • Other - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • LV_Tar[((Level of Lightning Vortex for (Picked unit)) - 1)] Equal to 1
                    • Then - Actions
                      • Set TempGroup01 = (Units within 40.00 of TempLoc01 matching ((((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is A flying unit) Equal to True)))
                    • Other - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • LV_Tar[((Level of Lightning Vortex for (Picked unit)) - 1)] Equal to 2
                        • Then - Actions
                          • Set TempReal = (LV_H x (Power((Sin(((Load 6 of Key from Lightning_Vortex) / 10.00))), 2.00)))
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • TempReal Higher than or equal to 125.00
                            • Then - Actions
                              • Set TempGroup01 = (Units within 40.00 of TempLoc01 matching ((((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is A flying unit) Equal to True)))
                            • Other - Actions
                              • Set TempGroup01 = (Units within 40.00 of TempLoc01 matching ((((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is A ground unit) Equal to True)))
                        • sOther - Action
                          • Set TempGroup01 = (Units within 40.00 of TempLoc01 matching (((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit))) Equal to True))
              • Unit Group - Add all units of TempGroup01 to TempGroup02
              • Custom script: call DestroyGroup(udg_TempGroup01)
              • Custom script: call RemoveLocation(udg_TempLoc01)
          • -------- DAMAGE --------
          • Set TempUnit = (Picked unit)
          • Group Unit - Pick every unit in TempGroup02 and do (Actions)
            • Loop - Actions
              • Unit - Cause TempUnit to damage (Picked unit), dealing LV_Dmg[((Level of Lightning Vortex for TempUnit) - 1)] damage of attack type Spells and damage type Normal
              • Special effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Weapons\Bolt\BoltImpact.mdl
              • Special effect - Destroy (Last created special effect)
          • Unit Group - Remove all units from TempGroup02

- Version 1.0 released.
- Version 1.1 released, with some optimizations and new configurations.
- Version 1.2, removed (Triggering Unit) and (Key(Triggering Unit)) stuff, in order to increase efficiency.


Keywords:
lightning, spark, circle, nargalloth, round, curve, sine, aoe, gui
Contents

Lightning Vortex (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 15:04, 21st Sep 2012 Magtheridon96: - Sorry I didn't tell you this in the last review, but I thought you'd get it done after this update. In the LOOP trigger, you can also store the...

Moderator

M

Moderator

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

15:04, 21st Sep 2012
Magtheridon96:

- Sorry I didn't tell you this in the last review, but I thought you'd get it done after this update.
In the LOOP trigger, you can also store the (Picked unit), the level of the ability, and pretty much anything that is being repeated more than once.

You can apply this in other places as well because repeating function calls (things inside parentheses is not very efficient and clean)

I appologize for the vagueness of the last review.
 
Level 9
Joined
Apr 19, 2011
Messages
447
In the test map you have two invincible liches with the spell. You can type "-spawn" to reveal some enemies and see the effect of the spell. I also put two liches so you can check by yourself that spell does not bug when casted many times (I think this is what's called "MUI", I'm not sure).

Well, please comment. I need to know how to improve the spell. Also I need to know if you find any bugs or leaks.

Regards
 
1.Leaks(see Loc3)
2.Dont Recycle Locations
3.Dont Remove all units in the group,which may cause the spell not mui.
4.Use SetUnitX(udg_Unit,GetUnitX(udg_Unit) + udg_Speed * Cos(udg_Angle * bj_DEGTORAD)) and SetUnitY(udg_Unit,GetUnitY(udg_Unit) + udg_Speed * Sin(udg_Angle * bj_DEGTORAD)) instead of Locations,you waste variables.
5.Cache Keys by using GetHandleId(udg_Unit)
6.Dont use Ifs in the looping triggers with the use of levels of the ability.Use Arrays instead.
 
Level 9
Joined
Apr 19, 2011
Messages
447
1.Leaks(see Loc3)
2.Dont Recycle Locations
3.Dont Remove all units in the group,which may cause the spell not mui.
4.Use SetUnitX(udg_Unit,GetUnitX(udg_Unit) + udg_Speed * Cos(udg_Angle * bj_DEGTORAD)) and SetUnitY(udg_Unit,GetUnitY(udg_Unit) + udg_Speed * Sin(udg_Angle * bj_DEGTORAD)) instead of Locations,you waste variables.
5.Cache Keys by using GetHandleId(udg_Unit)
6.Dont use Ifs in the looping triggers with the use of levels of the ability.Use Arrays instead.

Thank you very much for your comment, I really appreciate it.

1 - Damn, you're right... I'll fix it.
2 - Sorry, I'm still a bit noob... What do you mean with "recycle" locations?
3 - Exactly, which units are you talking about?
4 - OK, I'll try it.
5 - Could you explain this a bit more? (As I said, I'm still a bit noob)
6 - How could I use arrays if the lightnings' movement and the detection of damaged units is different for each level?

Really, thank you for your comment. But as you see, some of the things you pointed are a bit new to me. Some help would be very appreciated, I just want to learn. ;)

Please, I need more comments on this.

Regards
 
Top