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

Sweeping Beam - v0.1

The caster channels two beams of energy which both sizzle his enemies by 50 + 25 damage per level.

Requested by supertoinkz

90746d1286702486-taking-spell-requests-sweepingbeam.gif


Similar to the attack of the Starcraft II Colossi
90749d1286703383-taking-spell-requests-starcraft2colossus.jpg


  • Ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Sweep_DataCount = 14
      • Set zLoc = (Point(0.00, 0.00))
  • Sweep Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to S|cffffcc00w|reeping Beam
    • Actions
      • -------- Caster --------
      • Set u = (Triggering unit)
      • -------- Caster coords --------
      • Custom script: set udg_x2 = GetUnitX(udg_u)
      • Custom script: set udg_y2 = GetUnitY(udg_u)
      • -------- Two beams just look best but other numbers will work, too --------
      • Set i2 = 2
      • For each (Integer i) from 1 to i2, do (Actions)
        • Loop - Actions
          • -------- Radius of beam --------
          • Set r = 200.00
          • -------- Coords of target point --------
          • Custom script: set udg_x = GetSpellTargetX()
          • Custom script: set udg_y = GetSpellTargetY()
          • -------- Offset angle of beam --------
          • Set a = ((Atan2((y - y2), (x - x2))) + ((Real(((360 / i2) x i))) + 90.00))
          • -------- Calculating beam target point coords based on that --------
          • Set x = (x + (r x (Cos(a))))
          • Set y = (y + (r x (Sin(a))))
          • -------- Direction of beam --------
          • Set a = (a + 180.00)
          • -------- Create sweep lightning --------
          • Set Sweep_Max = (Sweep_Max + 1)
          • Lightning - Create a Finger of Death lightning effect from source zLoc to target zLoc
          • Set Sweep_Lightning[Sweep_Max] = (Last created lightning effect)
          • Custom script: if udg_Sweep_Group[udg_i] == null then
          • Custom script: set udg_Sweep_Group[udg_i] = CreateGroup()
          • Custom script: endif
          • -------- Caster again --------
          • Set Sweep_Caster[Sweep_Max] = u
          • -------- Start distance value (should be 0) --------
          • Set Sweep_Data[(Sweep_Max x Sweep_DataCount)] = 0.00
          • -------- Distance the beam will travel --------
          • Set Sweep_Data[((Sweep_Max x Sweep_DataCount) + 1)] = (r x 2.00)
          • -------- Speed of beam (will move 8 every 1/0.03 sec) --------
          • Set Sweep_Data[((Sweep_Max x Sweep_DataCount) + 2)] = 8.00
          • -------- X of target point --------
          • Set Sweep_Data[((Sweep_Max x Sweep_DataCount) + 3)] = x
          • -------- Y of target point --------
          • Set Sweep_Data[((Sweep_Max x Sweep_DataCount) + 4)] = y
          • -------- X component of speed --------
          • Set Sweep_Data[((Sweep_Max x Sweep_DataCount) + 5)] = (Sweep_Data[((Sweep_Max x Sweep_DataCount) + 2)] x (Cos(a)))
          • -------- Y component of speed --------
          • Set Sweep_Data[((Sweep_Max x Sweep_DataCount) + 6)] = (Sweep_Data[((Sweep_Max x Sweep_DataCount) + 2)] x (Sin(a)))
          • -------- Caster beam offset distance --------
          • Set Sweep_Data[((Sweep_Max x Sweep_DataCount) + 7)] = 70.00
          • -------- Caster beam offset angle --------
          • Set Sweep_Data[((Sweep_Max x Sweep_DataCount) + 8)] = (a - ((Atan2((y - y2), (x - x2))) + 90.00))
          • -------- Caster beam height offset --------
          • Set Sweep_Data[((Sweep_Max x Sweep_DataCount) + 9)] = 130.00
          • -------- Aoe of beam --------
          • Set Sweep_Data[((Sweep_Max x Sweep_DataCount) + 10)] = 150.00
          • -------- Damage of beam --------
          • Set Sweep_Data[((Sweep_Max x Sweep_DataCount) + 11)] = 50.00
          • -------- Sfx start count --------
          • Set Sweep_Data[((Sweep_Max x Sweep_DataCount) + 12)] = 0.00
          • -------- Sfx max count --------
          • Set Sweep_Data[((Sweep_Max x Sweep_DataCount) + 13)] = 3.00
      • Trigger - Turn on Sweep Loop <gen>
  • Sweep Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- Standard d4rk_g4nd4lf indexing --------
      • For each (Integer i) from 1 to Sweep_Max, do (Actions)
        • Loop - Actions
          • Set u = Sweep_Caster[i]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • u Not equal to No unit
              • (Life of u) Greater than 0.00
              • Sweep_Data[(i x Sweep_DataCount)] Less than Sweep_Data[((i x Sweep_DataCount) + 1)]
            • Then - Actions
              • -------- Count on distance --------
              • Set Sweep_Data[(i x Sweep_DataCount)] = (Sweep_Data[(i x Sweep_DataCount)] + Sweep_Data[((i x Sweep_DataCount) + 2)])
              • -------- Lightning coords caster --------
              • Custom script: set udg_x2 = GetUnitX(udg_u)
              • Custom script: set udg_y2 = GetUnitY(udg_u)
              • -------- Apply offset based on facing --------
              • Set a = ((Facing of u) + (Sweep_Data[((i x Sweep_DataCount) + 8)] - 90.00))
              • Set x2 = (x2 + (Sweep_Data[((i x Sweep_DataCount) + 7)] x (Cos(a))))
              • Set y2 = (y2 + (Sweep_Data[((i x Sweep_DataCount) + 7)] x (Sin(a))))
              • -------- Get terrain z-height --------
              • Custom script: call MoveLocation(udg_zLoc, udg_x2, udg_y2)
              • Custom script: set udg_r2 = GetLocationZ(udg_zLoc)
              • -------- Apply z offset --------
              • Set r2 = (r2 + Sweep_Data[((i x Sweep_DataCount) + 9)])
              • -------- Lightning coords target point --------
              • -------- Move lightning target coords --------
              • Set x = (Sweep_Data[((i x Sweep_DataCount) + 3)] + Sweep_Data[((i x Sweep_DataCount) + 5)])
              • Set y = (Sweep_Data[((i x Sweep_DataCount) + 4)] + Sweep_Data[((i x Sweep_DataCount) + 6)])
              • -------- Save new position --------
              • Set Sweep_Data[((i x Sweep_DataCount) + 3)] = x
              • Set Sweep_Data[((i x Sweep_DataCount) + 4)] = y
              • Custom script: call MoveLocation(udg_zLoc, udg_x, udg_y)
              • -------- Create special effect every x iterations --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Sweep_Data[((i x Sweep_DataCount) + 12)] Greater than or equal to Sweep_Data[((i x Sweep_DataCount) + 13)]
                • Then - Actions
                  • Set Sweep_Data[((i x Sweep_DataCount) + 12)] = 0.00
                  • Special Effect - Create a special effect at zLoc using Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
                  • Set Sweep_Data[((i x Sweep_DataCount) + 12)] = (Sweep_Data[((i x Sweep_DataCount) + 12)] + 1.00)
              • Set r = Sweep_Data[((i x Sweep_DataCount) + 10)]
              • -------- Pick units in range --------
              • Custom script: call GroupEnumUnitsInRange(udg_g, udg_x, udg_y, udg_r, null)
              • Unit Group - Pick every unit in g and do (Actions)
                • Loop - Actions
                  • Set u2 = (Picked unit)
                  • -------- Check if picked unit is valid target --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Life of u2) Greater than 0.00
                      • (u2 is A structure) Equal to False
                      • (u2 is A flying unit) Equal to False
                      • (u2 is Mechanical) Equal to False
                      • (u2 is Magic Immune) Equal to False
                      • (u2 is in Sweep_Group[i]) Equal to False
                      • (u2 belongs to an enemy of (Owner of u)) Equal to True
                    • Then - Actions
                      • -------- Add to group so it won't get damaged twice --------
                      • Unit Group - Add u2 to Sweep_Group[i]
                      • -------- Damage --------
                      • Unit - Cause u to damage u2, dealing Sweep_Data[((i x Sweep_DataCount) + 11)] damage of attack type Spells and damage type Unknown
                    • Else - Actions
              • -------- Move lightning --------
              • Custom script: call MoveLightningEx(udg_Sweep_Lightning[udg_i], true, udg_x, udg_y, GetLocationZ(udg_zLoc), udg_x2, udg_y2, udg_r2)
            • Else - Actions
              • -------- Clean up and resort data --------
              • Set Sweep_Caster[i] = Sweep_Caster[Sweep_Max]
              • Lightning - Destroy Sweep_Lightning[i]
              • Set Sweep_Lightning[i] = Sweep_Lightning[Sweep_Max]
              • Unit Group - Remove all units from Sweep_Group[i]
              • Unit Group - Add all units of Sweep_Group[Sweep_Max] to Sweep_Group[i]
              • Unit Group - Remove all units from Sweep_Group[Sweep_Max]
              • For each (Integer i2) from 0 to (Sweep_DataCount - 1), do (Actions)
                • Loop - Actions
                  • Set Sweep_Data[((i x Sweep_DataCount) + i2)] = Sweep_Data[((Sweep_Max x Sweep_DataCount) + i2)]
              • Set Sweep_Max = (Sweep_Max - 1)
              • Set i = (i - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Sweep_Max Less than 1
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
Keywords:
sweeping, beam, colossi, colossus, attack, starcraft, laser, lightning
Contents

Sweeping Beam (Map)

Reviews
09:52, 23rd Oct 2010 The_Reborn_Devil: The triggering looks ok. Nice to see some SC2 stuff here ^^ Status: Approved Rating: Recommended

Moderator

M

Moderator

09:52, 23rd Oct 2010
The_Reborn_Devil:

The triggering looks ok. Nice to see some SC2 stuff here ^^


Status: Approved
Rating: Recommended
 
Level 2
Joined
Dec 3, 2008
Messages
8
I like it but

I like the spell but! To me it seems like lvl 1 and lvl 4 do same damage. And i can't also not see where the damage is upgradet for each lvl.?
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
Some points.

-(Life of u) Greater than 0.00 don't use, use boolean comparison IsUnitDead equals to false (IsUnitType(u, UNIT_TYPE_DEAD) as it's more accurate and also GetUnitState/GetWidgetLife is used with 0.405, not 0.

-udg_g never gets destroyed and if you want to use this as a ENUM group, please clear it afterwards as it now stores units and more and more and more.

-Special Effect - Create a special effect at zLoc using Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl

Should be stored in a string variable (as some ppl might not want a knockback effect)-

Anyways this is good, just went threw the code, keep up the good work! :)
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
-(Life of u) Greater than 0.00 don't use, use boolean comparison IsUnitDead equals to false (IsUnitType(u, UNIT_TYPE_DEAD) as it's more accurate and also GetUnitState/GetWidgetLife is used with 0.405, not 0.

acording to this source http://www.mappedia.de/wiki/Jass:IsUnitDeadBJ the GUI IsUnitDeadBJ is the same (and IsUnitAliveBJ calls not IsUnitDeadBJ wtf)
and I am not healing any dead units anyway

-udg_g never gets destroyed and if you want to use this as a ENUM group, please clear it afterwards as it now stores units and more and more and more.

GroupEnumUnitsInRange automatically clears the group

-Special Effect - Create a special effect at zLoc using Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl

Should be stored in a string variable (as some ppl might not want a knockback effect)-

I won't add 3 lines of code and another variable just to make 1 string to be set somewhere else

Anyways this is good, just went threw the code, keep up the good work! :)

thanks :)
 
Level 5
Joined
Nov 14, 2009
Messages
191
I have a problem with this spell, when i cast it sometimes the lightning effects don't show.
I can assure you that i didn't change ANYTHING!
Anyone has this problem too??

same here

When I cast it on original map it's ok, but after I imported it to my map it's not ok.
Maybe I have to check the triggers again.
 
Level 13
Joined
Jun 9, 2009
Messages
1,129
NomoreChallenge : "When I cast it on original map it's ok, but after I imported it to my map it's not ok.
Maybe I have to check the triggers again."

Your problem is, that you need to copy ALL variables.
Some of them are putted by the script, so when you copy the triggers, variable doesn't comes. You can put all variables in your map by this :
All variables that this spell uses, put them, and set them however you want, copy that trigger, in a map, and you will have that variables, after that, import the spell, but remove the trigger before that you have created. ;)
 
Level 39
Joined
Feb 27, 2007
Messages
4,992
Are you sure the units you're trying to damage aren't causing any of the following checks (used in the spell right before damaging) to fail?
  • if.gif
    (Life of u2) Greater than 0.00
  • if.gif
    (u2 is A structure) Equal to False
  • if.gif
    (u2 is A flying unit) Equal to False
  • if.gif
    (u2 is Mechanical) Equal to False
  • if.gif
    (u2 is Magic Immune) Equal to False
  • if.gif
    (u2 is in Sweep_Group[i]) Equal to False
  • if.gif
    (u2 belongs to an enemy of (Owner of u)) Equal to True
 
Level 5
Joined
Jan 5, 2012
Messages
116
Yep I checked those conditions, doesn't seem to be the problem. I also checked variables, they're exactly the same as the test map.

Unit - Cause u to damage u2, dealing Sweep_Data[((i x Sweep_DataCount) + 11)] damage of attack type Spells and damage type Unknown

Anything might cause it in this line? Everything seems okay
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
4,992
Perhaps you have set armor values differently in your map. Use Damage type normal. Put debug messages "Game - Display..." before and after the damage line to print things like damage amount, name of target unit, etc. You'll figure out what's running and what's not.
 
Level 39
Joined
Feb 27, 2007
Messages
4,992
I just downloaded the map and it works fine for me (I changed something and saved it to recompile it too). Try deleting all of its variables and reimporting the spell. If I had to guess, some of the spell's default variable names are so generic that you've already used them for something else in your map.
 
Top