• 🏆 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 Roll v3

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
The hero rolls into the targeted location ignoring terrain and drains an amount of mana per distance travel and deals damage depending on the distance to the final area on where he stops.

Level 1: 1 * (Distance between the caster and the final area) / 25
Manacost: 17 - 1 per distance travel
Cooldown: 0

Level 2: 2 * (Distance between the caster and the final area) / 25
Manacost: 17 - 2 per distance travel
Cooldown: 0

Level 3: 3 * (Distance between the caster and the final area) / 25
Manacost: 17 - 3 per distance travel
Cooldown: 0

-Leakless, Lagless (I think), a smoothie spell...

Triggers:


  • Lightning Roll
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Roll
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LR_Index3_SZ Equal to 0
        • Then - Actions
          • Trigger - Turn on Lightning Roll Loop <gen>
        • Else - Actions
      • -------- Seeting up index --------
      • Set LR_Index3_SZ = (LR_Index3_SZ + 1)
      • -------- Boolean checker here if the caster has no mana or finally reached the targeted point --------
      • -------- Added some Array Recycler --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LR_Index3_SZ Greater than LR_Index2_MX
        • Then - Actions
          • Set LR_Index1[LR_Index3_SZ] = LR_Index3_SZ
          • Set LR_Index2_MX = LR_Index3_SZ
        • Else - Actions
      • -------- This is the Index; Increase it to 1 as the player cast the spell thus, will not override making it MUI --------
      • Set LR_Integer = LR_Index1[LR_Index3_SZ]
      • -------- Some temporary location --------
      • Set LR_Point1 = (Position of (Triggering unit))
      • Set LR_Point2 = (Target point of ability being cast)
      • -------- Setting up the caster's variable --------
      • Set LR_HeroArray[LR_Integer] = (Triggering unit)
      • -------- Declaring variables for some handles... --------
      • Set LR_AngleArray[LR_Integer] = (Angle from LR_Point1 to LR_Point2)
      • Set LR_SpeedArray[LR_Integer] = 30.00
      • Set LR_DistanceArray[LR_Integer] = (Distance between (Position of LR_HeroArray[LR_Integer]) and LR_Point2)
      • -------- A dummy unit for the whole show, clickable so that you can see th mana reducing all along... --------
      • Unit - Create 1 Storm Spirit for (Owner of LR_HeroArray[LR_Integer]) at LR_Point1 facing LR_AngleArray[LR_Integer] degrees
      • Set LR_DummyArray[LR_Integer] = (Last created unit)
      • Unit - Turn collision for LR_DummyArray[LR_Integer] Off
      • Unit - Hide LR_HeroArray[LR_Integer]
      • Unit - Move LR_DummyArray[LR_Integer] instantly to LR_Point1
      • Hero - Set LR_DummyArray[LR_Integer] Hero-level to (Hero level of LR_HeroArray[LR_Integer]), Hide level-up graphics
      • Selection - Select LR_DummyArray[LR_Integer] for (Owner of LR_HeroArray[LR_Integer])
      • -------- Another dummy caster that will create some lightning effects by using a dummy skill... --------
      • -------- For the update, I removed the "create lightning effect" but instead, I use the dummy spell of the dummy unit... --------
      • Unit - Create 1 Lightning Roll Dummy (Invisible) for (Owner of LR_DummyArray[LR_Integer]) at LR_Point1 facing LR_AngleArray[LR_Integer] degrees
      • Set LR_LightningSource[LR_Integer] = (Last created unit)
      • Unit - Order LR_LightningSource[LR_Integer] to Special Archimonde - Finger Of Death LR_DummyArray[LR_Integer]
      • -------- Sealing those leaks, IMPORTANT --------
      • Custom script: call RemoveLocation(udg_LR_Point1)
      • Custom script: call RemoveLocation(udg_LR_Point2)



  • Lightning Roll Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- A dynamic looping for less leaks (For at least I learned form Hanky's dynamic loops) --------
      • For each (Integer LR_Loop) from 1 to LR_Index3_SZ, do (Actions)
        • Loop - Actions
          • -------- --------
          • Set LR_Integer = LR_Index1[LR_Loop]
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • LR_DistanceArray[LR_Integer] Greater than 0.00
              • (Integer((Mana of LR_HeroArray[LR_Integer]))) Not equal to 0
            • Then - Actions
              • -------- Setting up temporary points so that the hero will move along the dummy unit --------
              • Set LR_Point1 = (Position of LR_DummyArray[LR_Integer])
              • Set LR_Point2 = (LR_Point1 offset by LR_SpeedArray[LR_Integer] towards LR_AngleArray[LR_Integer] degrees)
              • Unit - Move LR_DummyArray[LR_Integer] instantly to LR_Point2, facing LR_AngleArray[LR_Integer] degrees
              • Unit - Set mana of LR_HeroArray[LR_Integer] to ((Mana of LR_HeroArray[LR_Integer]) - (17.00 - (Real((Level of Lightning Roll for LR_HeroArray[LR_Integer])))))
              • Unit - Set mana of LR_DummyArray[LR_Integer] to (Mana of LR_HeroArray[LR_Integer])
              • Set LR_DistanceArray[LR_Integer] = (LR_DistanceArray[LR_Integer] - LR_SpeedArray[LR_Integer])
              • -------- And, don't forget to seal some leaks 'cause it'll make it better --------
              • Custom script: call RemoveLocation(udg_LR_Point1)
              • Custom script: call RemoveLocation(udg_LR_Point2)
            • Else - Actions
              • Unit - Kill LR_DummyArray[LR_Integer]
              • Unit - Move LR_HeroArray[LR_Integer] instantly to (Position of LR_DummyArray[LR_Integer])
              • Set LR_Point3 = (Position of LR_HeroArray[LR_Integer])
              • -------- Damaging enemies right after the hero reaches the maximum point --------
              • Set LR_Enemies[0] = (Units within 250.00 of LR_Point3 matching (((((Matching unit) is A structure) Not equal to True) and ((Matching unit) Not equal to LR_HeroArray[LR_Integer])) and ((((Matching unit) is Mechanical) Not equal to True) and ((((Matching unit) is Magic Immune) Not
              • Unit Group - Pick every unit in LR_Enemies[0] and do (Actions)
                • Loop - Actions
                  • Unit - Cause LR_HeroArray[LR_Integer] to damage (Picked unit), dealing ((Real((Level of Lightning Roll for LR_HeroArray[LR_Integer]))) x ((Distance between (Position of LR_LightningSource[LR_Integer]) and LR_Point3) / 25.00)) damage of attack type Spells and damage type Lightning
              • -------- Destroying the group right after using it --------
              • Custom script: call DestroyGroup(udg_LR_Enemies[0])
              • -------- And again, don't forget to seal some leaks 'cause it'll make it better I swear --------
              • Custom script: call RemoveLocation(udg_LR_Point3)
              • -------- Returning it all back to normal right after the show... --------
              • Unit - Kill LR_LightningSource[LR_Integer]
              • Unit - Remove LR_LightningSource[LR_Integer] from the game
              • Unit - Unhide LR_HeroArray[LR_Integer]
              • Unit - Remove LR_DummyArray[LR_Integer] from the game
              • Selection - Select LR_HeroArray[LR_Integer] for (Owner of LR_HeroArray[LR_Integer])
              • -------- Reseting Indexes back to the way it was... --------
              • Set LR_Index1[LR_Loop] = LR_Index1[LR_Index3_SZ]
              • Set LR_Index1[LR_Index3_SZ] = LR_Integer
              • Set LR_Index3_SZ = (LR_Index3_SZ - 1)
              • Set LR_Loop = (LR_Loop - 1)
              • -------- Turning off the loop trigger when its done... --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LR_Index3_SZ Equal to 0
                • Then - Actions
                  • -------- Skipping actions if the condition is either true or false, therefore, it will totally stop the spell in realation to the condition --------
                  • Trigger - Turn off (This trigger)
                  • Skip remaining actions
                • Else - Actions


Fixes:

v2: The dummy variables index was fixed causing it to go anywhere when casted multiple times at the same instance so, I indexed the variable in to a flexible one making it MUI.

v3: I recoded everything, Its been a while since I reviewed Hanky's dynamic indexing. I also added the suggestion of Maker that instead of creating a lightning effect, I use the dummy unit and added the dummy spell that will create the lightning effect. (and I hope its MUI this time).

Keywords:
Lightning, Ball, Dota, Raijin, Roll, Dash, Mana, Zap
Contents

Lightning Roll (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. Leak: Set LR_DistanceArray[LR_Integer] = (Distance between (Position of LR_HeroArray[LR_Integer]) and LR_Point2) Store the level at the time of casting-> Unit - Set mana of...

Moderator

M

Moderator

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

Maker, Lightning Roll v3, 12:28, 10th Nov 2011

Leak:
  • Set LR_DistanceArray[LR_Integer] = (Distance between (Position of LR_HeroArray[LR_Integer]) and LR_Point2)
Store the level at the time of casting->
  • Unit - Set mana of LR_HeroArray[LR_Integer] to ((Mana of LR_HeroArray[LR_Integer]) - (17.00 - (Real((Level of Lightning Roll for LR_HeroArray[LR_Integer])))))
Get rid of LR_Point3 variable, it is not needed. Use point1 or point2 instead.
The damage unit action leaks a location.
Don't use an array for the unit group.
Use Add unit to selection instead of Select unit.
The skip removing actions can be removed.
You're missing learn hotkey.
Add importing instructions into the map.
The spell is not easy to configure at all. You could add a configuration trigger.
You could consider some pathing check, since one can get stuck easily. Try casting the ability in an area thick with trees.
You could apply max cast range or require visibility over the targeted area, since now if mana cost is low, one can travel anywhere on the map.

Maker, Lightning Roll v2, 16:50, 7th Nov 2011

The spell is not MUI.
There are location leaks and a unit group leak.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Leaks:
  • Unit - Create 1 Lightning Roll Dummy (Invisible) for (Owner of LR_Hero[LR_Index]) at (Position of LR_Hero[LR_Index]) facing LR_Angle[LR_Index] degrees
  • Lightning - Create a Forked Lightning lightning effect from source (Position of LR_Dummy_Invisible[LR_Index]) to target LR_Point[0]
You're not removing the unit group correctly, then idex in the custom script is wrong. Don't use a unit group array.
The spell is not MUI. Place two casters and cast the ability almost at the same time.

Use Hanky's dynamic indexing or Bribe's unit indexer.
 
Top