• 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!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

The Swarmer v.5

My first spell. Its not really that good but i hope you like it.

Swarmer


The Tinker fires a rocket at the nearest enemy hero. The rocket will seek out the most injured enemy unit. If the rocket get near the injured ones it will release 6 cannons that will deals damage.

Level 1 - Deals maximum 300 damage.
Level 2 - Deals maximum 450 damage.
Level 3 - Deals maximum 600 damage.





  • Configuration
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- --------
      • -------- --------
      • -------- D1 = First Projectile , D2 = Second Projectile --------
      • Set D1 = Swarmer (Projectile)
      • Set D2 = Swarmer (Tiny Projectile)
      • -------- --------
      • -------- --------
      • -------- Ability --------
      • Set S = Swarmer
      • -------- --------
      • -------- --------
      • -------- S_AoE area of effect , S_Target number of swarmer --------
      • Set S_AoE = 2500.00
      • Set S_Target = 2
      • -------- --------
      • -------- --------
      • -------- S_Damage + S_X_Damage x Swarmer Level --------
      • Set S_Damage = 25.00
      • Set S_X_Damage = 35.00
      • -------- --------
      • -------- --------
      • Set S_Target_HeroOnly = False
  • Swarmer Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Swarmer
    • Actions
      • Set ASwarmer_Point[0] = (Position of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • S_Target_HeroOnly Equal to True
        • Then - Actions
          • -------- --------
          • Set ASwarmer_PickGroup = (Units within S_AoE of ASwarmer_Point[0] matching (((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Mechanical) Equal to False) and (((Matching unit) is Magic Immune) Equal to False))) and ((((Matching unit) is alive) Equal to True
        • Else - Actions
          • -------- --------
          • Set ASwarmer_PickGroup = (Units within S_AoE of ASwarmer_Point[0] matching (((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Mechanical) Equal to False) and (((Matching unit) is Magic Immune) Equal to False))) and ((((Matching unit) is alive) Equal to True
      • Set ASwarmer_TargetGroup = (Random S_Target units from ASwarmer_PickGroup)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in ASwarmer_TargetGroup and do (Actions)
        • Loop - Actions
          • -------- --------
          • -------- Create a dummy unit to represent this spell --------
          • -------- --------
          • Unit - Create 1 D1 for (Triggering player) at ASwarmer_Point[0] facing Default building facing degrees
          • -------- --------
          • -------- The variable ID represents this individual cast of the spell --------
          • Set TempUnit = (Last created unit)
          • Set ID = (Custom value of TempUnit)
          • -------- --------
          • -------- Use the ID variable with arrays to store exclusive data --------
          • -------- --------
          • Set ASwarmer_Dummy[ID] = TempUnit
          • Set ASwarmer_Caster[ID] = (Triggering unit)
          • Set ASwarmer_Enemy[ID] = (Picked unit)
          • Set ASwarmer_Point[1] = (Position of ASwarmer_Enemy[ID])
          • Set ASwarmer_Angle[ID] = (Angle from ASwarmer_Point[0] to ASwarmer_Point[1])
          • Animation - Change ASwarmer_Dummy[ID]'s animation speed to 50.00% of its original speed
          • Set ASwarmer_Distance[ID] = (Distance between ASwarmer_Point[0] and ASwarmer_Point[1])
          • Set ASwarmer_Level[ID] = (Level of S for ASwarmer_Caster[ID])
          • Set ASwarmer_Life[ID] = 10000.00
          • Set ASwarmer_On[ID] = True
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Swarmer Loop Spell <gen> is on) Equal to False
            • Then - Actions
              • -------- --------
              • -------- Turn on the loop trigger as it's currently off --------
              • -------- --------
              • Trigger - Turn on Swarmer Loop Spell <gen>
            • Else - Actions
          • -------- Add the dummy to this spell's group so that it can be referenced over time --------
          • Unit Group - Add ASwarmer_Dummy[ID] to ASwarmer_Group
          • Custom script: call RemoveLocation(udg_ASwarmer_Point[1])
      • Custom script: call DestroyGroup (udg_ASwarmer_PickGroup)
      • Custom script: call RemoveLocation(udg_ASwarmer_Point[0])
  • Swarmer Loop Spell
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in ASwarmer_Group and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • Set ID = (Custom value of TempUnit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (ASwarmer_Dummy[ID] is alive) Equal to True
              • (Unit-type of ASwarmer_Dummy[ID]) Equal to D2
            • Then - Actions
              • Set ASwarmer_Point[3] = (Position of ASwarmer_Dummy[ID])
              • Set ASwarmer_Point[4] = (Position of ASwarmer_Enemy[ID])
              • Set ASwarmer_Distance[ID] = (Distance between ASwarmer_Point[3] and ASwarmer_Point[4])
              • Set ASwarmer_Angle[ID] = (Angle from ASwarmer_Point[3] to ASwarmer_Point[4])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ASwarmer_r1[ID] Less than 60.00
                • Then - Actions
                  • Set ASwarmer_Height[ID] = (ASwarmer_Height[ID] + 0.75)
                  • Set ASwarmer_Point[5] = (ASwarmer_Point[3] offset by (ASwarmer_Speed[ID] / 2.00) towards ASwarmer_mA[ID] degrees)
                  • Animation - Change ASwarmer_Dummy[ID] flying height to ASwarmer_Height[ID] at 0.00
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ASwarmer_Height[ID] Greater than 30.00
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ASwarmer_Distance[ID] Less than or equal to 100.00
                        • Then - Actions
                          • Set ASwarmer_Height[ID] = (ASwarmer_Height[ID] - 9.00)
                        • Else - Actions
                          • Set ASwarmer_Height[ID] = (ASwarmer_Height[ID] - 3.00)
                    • Else - Actions
                  • Set ASwarmer_Point[5] = (ASwarmer_Point[3] offset by (ASwarmer_Speed[ID] x -2.00) towards ASwarmer_Angle[ID] degrees)
                  • Animation - Change ASwarmer_Dummy[ID] flying height to ASwarmer_Height[ID] at 0.00
              • Unit - Move ASwarmer_Dummy[ID] instantly to ASwarmer_Point[5], facing ASwarmer_Point[4]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ASwarmer_Distance[ID] Less than or equal to 30.00
                  • ASwarmer_r1[ID] Greater than 60.00
                • Then - Actions
                  • Animation - Change ASwarmer_Dummy[ID] flying height to 0.00 at 0.00
                  • -------- --------
                  • -------- Dealing damage to the enemy unit and destroying the projectile. --------
                  • Unit - Cause ASwarmer_Caster[ID] to damage ASwarmer_Enemy[ID], dealing ASwarmer_Damage[ID] damage of attack type Spells and damage type Magic
                  • -------- --------
                  • Set ASwarmer_On[ID] = False
                • Else - Actions
              • Set ASwarmer_r1[ID] = (ASwarmer_r1[ID] + 1.00)
              • Custom script: call RemoveLocation(udg_ASwarmer_Point[3])
              • Custom script: call RemoveLocation(udg_ASwarmer_Point[4])
              • Custom script: call RemoveLocation(udg_ASwarmer_Point[5])
            • Else - Actions
              • -------- --------
              • Set ASwarmer_Point[0] = (Position of ASwarmer_Dummy[ID])
              • Set ASwarmer_Point[1] = (Position of ASwarmer_Enemy[ID])
              • Set ASwarmer_Angle[ID] = (Angle from ASwarmer_Point[0] to ASwarmer_Point[1])
              • Set ASwarmer_Point[2] = (ASwarmer_Point[0] offset by 27.00 towards ASwarmer_Angle[ID] degrees)
              • Unit - Move ASwarmer_Dummy[ID] instantly to ASwarmer_Point[2], facing ASwarmer_Point[1]
              • Set ASwarmer_Distance[ID] = (Distance between ASwarmer_Point[0] and ASwarmer_Point[1])
              • Animation - Queue ASwarmer_Dummy[ID]'s birth 1 animation
              • -------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ASwarmer_Distance[ID] Less than or equal to 275.00
                • Then - Actions
                  • -------- --------
                  • For each (Integer ASwarmer_Loop) from 1 to 6, do (Actions)
                    • Loop - Actions
                      • Unit - Create 1 D2 for (Owner of ASwarmer_Caster[ID]) at ASwarmer_Point[0] facing ASwarmer_Angle[ID] degrees
                      • Set TempUnit2 = (Last created unit)
                      • Set LOOP = (Custom value of TempUnit2)
                      • Set ASwarmer_Dummy[LOOP] = TempUnit2
                      • -------- --------
                      • Set ASwarmer_Caster[LOOP] = ASwarmer_Caster[ID]
                      • Set ASwarmer_Enemy[LOOP] = ASwarmer_Enemy[ID]
                      • Set ASwarmer_Angle[LOOP] = (Angle from ASwarmer_Point[0] to ASwarmer_Point[1])
                      • Unit - Add Crow Form to ASwarmer_Dummy[LOOP]
                      • Unit - Remove Crow Form from ASwarmer_Dummy[LOOP]
                      • Unit - Turn collision for ASwarmer_Dummy[LOOP] Off
                      • Set ASwarmer_Distance[LOOP] = (Distance between ASwarmer_Point[0] and ASwarmer_Point[1])
                      • Set ASwarmer_Height[LOOP] = 140.00
                      • -------- --------
                      • -------- Angle for each cannons. --------
                      • Set ASwarmer_mA[LOOP] = (ASwarmer_Angle[LOOP] + (((Real(ASwarmer_Loop)) x 30.00) + 15.00))
                      • -------- --------
                      • Set ASwarmer_Damage[LOOP] = (S_Damage + (S_X_Damage x (Real(ASwarmer_Level[ID]))))
                      • Set ASwarmer_Speed[LOOP] = -25.00
                      • Set ASwarmer_r1[LOOP] = 0.00
                      • Set ASwarmer_On[LOOP] = True
                      • -------- --------
                      • Unit Group - Add ASwarmer_Dummy[LOOP] to ASwarmer_Group
                  • -------- --------
                  • -------- Destroying the first projectile. --------
                  • Set ASwarmer_On[ID] = False
                • Else - Actions
              • -------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • S_Target_HeroOnly Equal to True
                • Then - Actions
                  • Set ASwarmer_Parameter[ID] = (Units within S_AoE of ASwarmer_Point[0] matching (((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) is Mechanical) Equal to False))) and ((((Matching unit) is alive) Equal to True
                • Else - Actions
                  • Set ASwarmer_Parameter[ID] = (Units within S_AoE of ASwarmer_Point[0] matching (((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) is Mechanical) Equal to False))) and ((((Matching unit) is alive) Equal to True
              • -------- Searching for the enemy unit with the lowest hp. --------
              • Unit Group - Pick every unit in ASwarmer_Parameter[ID] and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Life of (Picked unit)) Less than ASwarmer_Life[ID]
                    • Then - Actions
                      • Set ASwarmer_Enemy[ID] = (Picked unit)
                      • Set ASwarmer_Life[ID] = (Life of ASwarmer_Enemy[ID])
                    • Else - Actions
              • -------- --------
              • Custom script: call DestroyGroup (udg_ASwarmer_Parameter[udg_ID])
              • Custom script: call RemoveLocation(udg_ASwarmer_Point[0])
              • Custom script: call RemoveLocation(udg_ASwarmer_Point[1])
              • Custom script: call RemoveLocation(udg_ASwarmer_Point[2])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ASwarmer_On[ID] Equal to False
            • Then - Actions
              • -------- --------
              • -------- --------
              • -------- Remove the dummy from the group and from the game --------
              • -------- --------
              • Unit Group - Remove ASwarmer_Dummy[ID] from ASwarmer_Group
              • Unit - Kill ASwarmer_Dummy[ID]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (ASwarmer_Group is empty) Equal to True
                • Then - Actions
                  • -------- --------
                  • -------- Turn off this trigger as it's currently doing nothing --------
                  • -------- --------
                  • Trigger - Turn off Swarmer Loop Spell <gen>
                • Else - Actions
            • Else - Actions


Thanks to Bribe for pointing out the leaks.

Credits:
Bribe for GUI Unit Indexer



*v.1
- Fixed Custom script: call RemoveLocation(udg_Swarmer_Point[1])
- Fixed Set Swarmer_mA[Swarmer_Int[5]] = ((Swarmer_A2[Swarmer_Int[5]]) + (level of ability X 30) + 15.00)
- Fixed Food cost change to 0

*v.2
- Fixed Set Swarmer_Targeting = (Random S_Target units from (Units within S_AoE of Swarmer_Point[0] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an enemy of (Triggering player)) Equal to True)))))
- Fixed Set Swarmer_Targeting = (Random S_Target units from (Units within S_AoE of Swarmer_Point[0] matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Triggering player)) Equal to True))))
- Removed Swarmer_Real[6]
- Added Swarmer_Height[Swarmer_Int[5]]

*v.3
- Turn off my indexing system
- Added GUI Unit Indexer by Bribe
- Change all variable and retrigger

*v.4
- Removed the leaks
- Added hero on the test map to test the spell on hero
- Press "Up Arrow" key to change the HeroTargetOnly boolean

*v.5
- Removed Custom script: call DestroyGroup (udg_ASwarmer_TargetGroup)



Keywords:
Missile, Swarmer, Barrage, Cannons, World War, Project D, Tupac.
Contents

The Swarmer (Map)

Reviews
4 Feb 2012 Bribe: Approved 3/5. You don't need to check "(ASwarmer_Group is empty) Equal to true" before turning on the trigger, just check if the trigger is off (it is a less-heavy operation to do that). You can delete this line: "Custom...

Moderator

M

Moderator

4 Feb 2012
Bribe: Approved 3/5.

You don't need to check "(ASwarmer_Group is empty) Equal to true" before turning on the trigger, just check if the trigger is off (it is a less-heavy operation to do that).

You can delete this line: "Custom script: call DestroyGroup (udg_ASwarmer_TargetGroup)" because you already destroyed that group with "Custom script: set bj_wantDestroyGroup = true".
 
Level 7
Joined
Jan 28, 2012
Messages
266
in your cast trigger you have a leak,
  • Unit Group - Pick every unit in Swarmer_Targeting and do (Actions)
  • Loop - Actions
  • .some actions
  • -------- --------
  • Set Swarmer_Point[1] = (Position of Swarmer_E1[Swarmer_Int[1]])
you need to put the call RemoveLocation(udg_Swarmer_Point[1]) inside of the pick every units, as it is right now it leaks all but the last point set.

your method for looping through units could be better(but it is pretty good for first spell)
it loops through useless index's, and it is possible for it to hit the maximum array size, with non existent array's(though the latter is unlikely it still could conceivably happen)
 
Brief review as Im not testing the map yet;
- I think its better to set "S_Target_HeroOnly==false" if there are no heroes around.
- Never use arrayed variables unless needed, coz its slower than normal ones.
- Owner of (Triggering unit) >>> TriggerPlayer
- You can make a formula for "Set Swarmer_mA[Swarmer_Int[5]] = (Swarmer_A2[Swarmer_Int[5]] + 45.00)"
like this, instead of those elseif's...
  • Set Swarmer_mA[Swarmer_Int[5]] = ((Swarmer_A2[Swarmer_Int[5]]) + (level of ability X 30) + 15.00)
- I recommend using Hanky's Dynamic Indexing System, or Bribe's UnitINdexer (I preffer the last)...
 
Ender is right about those leaks.
You should try using Hanky's Dynamic Indexing because it's much safer and faster than this.

@Ender, trust me, you won't have to worry about hitting the array limit here :p
No sane person would allow the spell to be cast 8191 times at once ^.^
Still, you're right about the fact that he should update the indexing.
-------

Also:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • Swarmer_Int[3] Equal to 1
          • Swarmer_Int[3] Equal to 2
    • Then - Actions
      • Set Swarmer_mA[Swarmer_Int[5]] = (Swarmer_A2[Swarmer_Int[5]] + (360.00 - (180.00 x (Real(Swarmer_Int[3])))))
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Swarmer_Int[3] Equal to 3
        • Then - Actions
          • Set Swarmer_mA[Swarmer_Int[5]] = (Swarmer_A2[Swarmer_Int[5]] + 45.00)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Swarmer_Int[3] Equal to 4
            • Then - Actions
              • Set Swarmer_mA[Swarmer_Int[5]] = (Swarmer_A2[Swarmer_Int[5]] + 75.00)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Swarmer_Int[3] Equal to 5
                • Then - Actions
                  • Set Swarmer_mA[Swarmer_Int[5]] = (Swarmer_A2[Swarmer_Int[5]] + 135.00)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Swarmer_Int[3] Equal to 6
                    • Then - Actions
                      • Set Swarmer_mA[Swarmer_Int[5]] = (Swarmer_A2[Swarmer_Int[5]] + 165.00)
                    • Else - Actions
The procedural coupling is terrible here :O

It could be this:

  • Init
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Set val[3] = 45.00
      • Set val[4] = 75.00
      • Set val[5] = 135.00
      • Set val[6] = 165.00
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • Swarmer_Int[3] Equal to 1
          • Swarmer_Int[3] Equal to 2
    • Then - Actions
      • Set Swarmer_mA[Swarmer_Int[5]] = (Swarmer_A2[Swarmer_Int[5]] + (360.00 - (180.00 x (Real(Swarmer_Int[3])))))
    • Else - Actions
      • Set Swarmer_mA[Swarmer_Int[5]] = (Swarmer_A2[Swarmer_Int[5]] + val[Swarmer_Level[Swarmer_Int[5]]])
 
Level 5
Joined
Jan 5, 2012
Messages
134
Its a Great Idea, Just need better executed, I'll give you a...
[broke="4/5 Don't Give up!! :) +Rep!"]Reveal[/broke]
Oh and also, make the Food Level of the Rockets 0. And if it is over used it lags. Maybe Fix that? Other than that good!
 
Level 20
Joined
Jul 12, 2010
Messages
1,735
No one downloads and tests spells anymore ^.^
The triggers in the description are enough for most of us :D
i do lol

ontopic:
the spell is really good but there are some things you could improve so 4/5 for now:thumbs_up:

what i have in mind:
all cannons target the unit with the lowest hp and it's a waste of cannons if a unit has about 50hp and get's targeted by 6 cannons lol
so what i have in mind is no improve the "intelligence" of the cannons, if unit has low hp that 1 cannon can kill it then only 1 cannon will focus on that unit and the other 5 will focus on another unit, if it requires 2 cannons(depending on dmg dealt by cannons) then only 2 cannons will target that unit and the rest will target other units...
plus another thing ill like to point out, it should first target heroes and then units with low hp, this feature will be very good for dota-like maps IMO

well that's all for now, thnx for wasting your time to read my comment!!;D
 
Top