• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

2D arrays

Level 6
Joined
Feb 22, 2025
Messages
87
Hi, was trying to create Angelic Armaments, so before u see the code gotta say I know there's a lot of memory cleanup missing and safety checking and reseting variables and polishing, typos etc..., I just want the foundation to work first; also is there a way to simplify this lol? The idea was to spawn 6 missiles which would rotate and rise around the caster and after 4 seconds if they acquire the target they would rush towards it, else get removed; additionally was considering periodic area damage while they orbit and follow the caster( which I'll add later);
!!! I'm getting an unexpected error at setting X,Y end of line, It's not reading DEGTORAD, like there's no space to continue the code, so I'm asking is there a simple way to do this without using fake 2d arrays :")

The Code:
----------------------------------------------------------------
  • AA Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Angelic Armaments
    • Actions
      • Set AA_Index = (AA_Index + 1)
      • Set AA_Caster[AA_Index] = (Triggering unit)
      • Set AA_Timer[AA_Index] = 4.00
      • For each (Integer AA_Loop_B) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set AA_Angle[((AA_Index x 10) + AA_Loop_B)] = (60.00 x ((Real(AA_Loop_B)) - 1.00))
          • Unit - Create 1 Spear Idle for (Owner of AA_Caster[AA_Index]) at (Position of AA_Caster[AA_Index]) facing Default building facing degrees
          • Set AA_Spear_Idle[((AA_Index x 10) + AA_Loop_B)] = (Last created unit)
          • Unit - Add a 5.00 second Generic expiration timer to AA_Spear_Idle[((AA_Index x 10) + AA_Loop_B)]
          • Unit - Add Crow Form to AA_Spear_Idle[((AA_Index x 10) + AA_Loop_B)]
          • Unit - Remove Crow Form from AA_Spear_Idle[((AA_Index x 10) + AA_Loop_B)]
          • Unit - Pause AA_Spear_Idle[((AA_Index x 10) + AA_Loop_B)]
          • Set AA_Flying_Height[((AA_Loop_A x 10) + AA_Loop_B)] = 150.00
          • Animation - Change AA_Spear_Idle[((AA_Index x 10) + AA_Loop_B)] flying height to 150.00 at 0.00
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AA_Index Equal to 1
        • Then - Actions
          • Trigger - Turn on AA Orbit <gen>
        • Else - Actions
  • AA Orbit
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer AA_Loop_A) from 1 to AA_Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (AA_Caster[AA_Loop_A] is alive) Equal to True
              • AA_Loop_A Less than or equal to AA_Index
            • Then - Actions
              • Set AA_Timer[AA_Loop_A] = (AA_Timer[AA_Loop_A] - 0.03)
              • For each (Integer AA_Loop_B) from 1 to 6, do (Actions)
                • Loop - Actions
                  • Set AA_Angle[((AA_Loop_A x 10) + AA_Loop_B)] = ((AA_Angle[((AA_Loop_A x 10) + AA_Loop_B)] + 15.00) mod 360.00)
                  • Set AA_TempPoint = (Position of AA_Caster[AA_Loop_A])
                  • Set AA_Offset = (AA_TempPoint offset by 200.00 towards AA_Angle[((AA_Loop_A x 10) + AA_Loop_B)] degrees.)
                  • Custom script: call SetUnitX( udg_AA_Spear_Idle[( udg_AA_Loop_A * 10) + udg_AA_Loop_B], GetLocationX( udg_AA_Offset))
                  • Custom script: call SetUnitY( udg_AA_Spear_Idle[( udg_AA_Loop_A * 10) + udg_AA_Loop_B], GetLocationY( udg_AA_Offset))
                  • Set AA_Flying_Height[((AA_Loop_A x 10) + AA_Loop_B)] = (AA_Flying_Height[((AA_Loop_A x 10) + AA_Loop_B)] + 2.50)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AA_Flying_Height[((AA_Loop_A x 10) + AA_Loop_B)] Greater than or equal to 250.00
                    • Then - Actions
                      • Animation - Change AA_Spear_Idle[((AA_Loop_A x 10) + AA_Loop_B)] flying height to AA_Flying_Height[((AA_Loop_A x 10) + AA_Loop_B)] at 0.00
                    • Else - Actions
                  • Custom script: call RemoveLocation( udg_AA_TempPoint)
                  • Custom script: call RemoveLocation( udg_AA_Offset)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • AA_Timer[AA_Loop_A] Less than or equal to 0.01
            • Then - Actions
              • Trigger - Turn on AA Launch <gen>
            • Else - Actions
  • AA Launch
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer AA_Loop_A) from 1 to AA_Index, do (Actions)
        • Loop - Actions
          • For each (Integer AA_Loop_B) from 1 to 6, do (Actions)
            • Loop - Actions
              • Set AA_Spear_TempPoint = (Position of AA_Spear_Idle[((AA_Loop_A x 10) + AA_Loop_B)])
              • Set AA_TargetGroup = (Units within 1000.00 of AA_Spear_TempPoint matching (((((Matching unit) is A structure) Equal to False) and (((Matching unit) is alive) Equal to True)) and ((((Matching unit) is hidden) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of A
              • Set AA_Target[AA_Loop_A] = (Random unit from AA_TargetGroup)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • AA_Target[((AA_Loop_A x 10) + AA_Loop_B)] Not equal to No unit
                • Then - Actions
                  • Set AA_TargetPoint = (Position of AA_Target[((AA_Loop_A x 10) + AA_Loop_B)])
                  • Set AA_Speed[((AA_Loop_A x 10) + AA_Loop_B)] = 40.00
                  • Set AA_Launch_Angle[((AA_Loop_A x 10) + AA_Loop_B)] = (Angle from (Position of AA_Spear_Idle[((AA_Loop_A x 10) + AA_Loop_B)]) to (Position of AA_Target[((AA_Loop_A x 10) + AA_Loop_B)]))
                  • Set AA_Boolean[((AA_Loop_A x 10) + AA_Loop_B)] = True
                  • Trigger - Turn on AA Missile Movement <gen>
                • Else - Actions
                  • Set AA_Boolean[((AA_Loop_A x 10) + AA_Loop_B)] = False
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • AA_Boolean[((AA_Loop_A x 10) + AA_Loop_B)] Equal to False
                • Then - Actions
                  • Unit - Kill AA_Spear_Idle[((AA_Loop_A x 10) + AA_Loop_B)]
                • Else - Actions
          • Custom script: call DestroyGroup( udg_AA_TargetGroup)
  • AA Missile Movement
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer AA_Loop_A) from 1 to AA_Index, do (Actions)
        • Loop - Actions
          • For each (Integer AA_Loop_B) from 1 to 6, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • AA_Boolean[((AA_Loop_A x 10) + AA_Loop_B)] Equal to True
                • Then - Actions
                  • Custom script: call SetUnitX(udg_AA_Spear_Idle[(udg_AA_Loop_A * 10) + udg_AA_Loop_B], GetUnitX(udg_AA_Spear_Idle[(udg_AA_Loop_A * 10) + udg_AA_Loop_B] + udg_AA_Speed[(udg_AA_Loop_A * 10) + udg_AA_Loop_B] * Cos(udg_AA_Launch_Angle[(udg_AA_Loop_A * 10) + udg_AA_Loop_B] * bj_D
                  • Custom script: call SetUnitY(udg_AA_Spear_Idle[(udg_AA_Loop_A * 10) + udg_AA_Loop_B], GetUnitY(udg_AA_Spear_Idle[(udg_AA_Loop_A * 10) + udg_AA_Loop_B] + udg_AA_Speed[(udg_AA_Loop_A * 10) + udg_AA_Loop_B] * Sin(udg_AA_Launch_Angle[(udg_AA_Loop_A * 10) + udg_AA_Loop_B] * bj_D
                  • Set AA_Spear_TempPoint = (Position of AA_Spear_Idle[((AA_Loop_A x 10) + AA_Loop_B)])
                  • Set AA_TargetPoint = (Position of AA_Target[((AA_Loop_A x 10) + AA_Loop_B)])
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between AA_Spear_TempPoint and AA_TargetPoint) Less than or equal to 10.00
                    • Then - Actions
                      • Unit - Kill AA_Spear_Idle[((AA_Loop_A x 10) + AA_Loop_B)]
                      • Unit - Cause AA_Caster[((AA_Loop_A x 10) + AA_Loop_B)] to damage AA_Target[((AA_Loop_A x 10) + AA_Loop_B)], dealing 1000.00 damage of attack type Spells and damage type Normal
                    • Else - Actions
                • Else - Actions
----------------------------------------------
Didn't get to test the Movement trigger since I can't fit the code :")
 
For starters, I would recommend using an integer variable to store the index. That way the 2D-array usage becomes a lot cleaner to read and easier to manage. For example, you could introduce an integer variable "CurrentIndex" to use throughout the trigger:
  • For each (Integer AA_Loop_A) from 1 to AA_Index, do (Actions)
    • Loop - Actions
      • For each (Integer AA_Loop_B) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set AA_CurrentIndex = ((AA_Loop_A x 10) + AA_Loop_B)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • AA_Boolean[AA_CurrentIndex] Equal to True
            • Then - Actions
              • Custom script: call SetUnitX(udg_AA_Spear_Idle[udg_AA_CurrentIndex], GetUnitX(udg_AA_Spear_Idle[udg_AA_CurrentIndex] + udg_AA_Speed[udg_AA_CurrentIndex] * Cos(udg_AA_Launch_Angle[udg_AA_CurrentIndex] * bj_DEG_TO_RAD))
              • Custom script: call SetUnitY(udg_AA_Spear_Idle[udg_AA_CurrentIndex], GetUnitY(udg_AA_Spear_Idle[udg_AA_CurrentIndex] + udg_AA_Speed[udg_AA_CurrentIndex] * Sin(udg_AA_Launch_Angle[udg_AA_CurrentIndex] * bj_DEG_TO_RAD))
              • -------- etc. --------
            • Else - Actions
If you still run into issues with fitting it all into a single custom script line, you can use other intermediate variables, e.g. a "Real" variable, to store the "new X" result separately, e.g. if you had a real variable named "TempReal":
  • Custom script: set udg_TempReal = GetUnitX(udg_AA_Spear_Idle[udg_AA_CurrentIndex] + udg_AA_Speed[udg_AA_CurrentIndex] * Cos(udg_AA_Launch_Angle[udg_AA_CurrentIndex] * bj_DEG_TO_RAD)
  • Custom script: call SetUnitX(udg_AA_Spear_Idle[udg_AA_CurrentIndex], udg_TempReal)
Then you could do the same for the Y-coordinate as well.
 
Level 6
Joined
Feb 22, 2025
Messages
87
For starters, I would recommend using an integer variable to store the index. That way the 2D-array usage becomes a lot cleaner to read and easier to manage. For example, you could introduce an integer variable "CurrentIndex" to use throughout the trigger:
  • For each (Integer AA_Loop_A) from 1 to AA_Index, do (Actions)
    • Loop - Actions
      • For each (Integer AA_Loop_B) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set AA_CurrentIndex = ((AA_Loop_A x 10) + AA_Loop_B)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • AA_Boolean[AA_CurrentIndex] Equal to True
            • Then - Actions
              • Custom script: call SetUnitX(udg_AA_Spear_Idle[udg_AA_CurrentIndex], GetUnitX(udg_AA_Spear_Idle[udg_AA_CurrentIndex] + udg_AA_Speed[udg_AA_CurrentIndex] * Cos(udg_AA_Launch_Angle[udg_AA_CurrentIndex] * bj_DEG_TO_RAD))
              • Custom script: call SetUnitY(udg_AA_Spear_Idle[udg_AA_CurrentIndex], GetUnitY(udg_AA_Spear_Idle[udg_AA_CurrentIndex] + udg_AA_Speed[udg_AA_CurrentIndex] * Sin(udg_AA_Launch_Angle[udg_AA_CurrentIndex] * bj_DEG_TO_RAD))
              • -------- etc. --------
            • Else - Actions
If you still run into issues with fitting it all into a single custom script line, you can use other intermediate variables, e.g. a "Real" variable, to store the "new X" result separately, e.g. if you had a real variable named "TempReal":
  • Custom script: set udg_TempReal = GetUnitX(udg_AA_Spear_Idle[udg_AA_CurrentIndex] + udg_AA_Speed[udg_AA_CurrentIndex] * Cos(udg_AA_Launch_Angle[udg_AA_CurrentIndex] * bj_DEG_TO_RAD)
  • Custom script: call SetUnitX(udg_AA_Spear_Idle[udg_AA_CurrentIndex], udg_TempReal)
Then you could do the same for the Y-coordinate as well.
Thanks!!!, would never imagine to store it that way lol, yeah it's more readable I was throwing up while writing arrays :") :goblin_boom:
 
Level 6
Joined
Feb 22, 2025
Messages
87
Just throwing out my 2 cents, but this is when I would use a Hashtable. Obviously this method works great, I just think the Hashtable would be cleaner.

Also, doesn't Custom Script have a character limit? I recall it not working beyond ~256 but maybe that limitation was patched out.
Still working on it, I'll post here, maybe even in resources idk, but let's see when it's done, lost my head to this tbh :")
This what I got for now, still needs polishing and replacing dummies with new ones( missiles )
 

Attachments

  • bandicam 2025-05-26 18-28-06-337.mp4
    5.8 MB
Last edited:
Level 6
Joined
Feb 22, 2025
Messages
87
I'm onto something, a wee bit different, it's still not working but I'm too tired to fix it atm(need sleep deffo), but here's the idea:
  • AA Config
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set AA_Speed_Initial = 1.00
      • Set AA_Speed_Max = 8.00
      • Set AA_Speed_Gain = 0.25
      • Set AA_Hover_Heigh = 250.00
      • Set AA_Side_Offset = 200.00
      • Set AA_Launch_AOE = 1000.00
      • Set AA_Max = 6
      • Set AA_Side_Spread = 80.00
  • AA Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Angelic Armaments
    • Actions
      • Set AA_Index = (AA_Index + 1)
      • Set AA_Caster[AA_Index] = (Triggering unit)
      • Set AA_Timer[AA_Index] = 4.00
      • For each (Integer AA_Loop_B) from 1 to AA_Max, do (Actions)
        • Loop - Actions
          • Set AA_Angle[((AA_Index x 10) + AA_Loop_B)] = (60.00 x ((Real(AA_Loop_B)) - 1.00))
          • Unit - Create 1 Spear Idle for (Owner of AA_Caster[AA_Index]) at (Position of AA_Caster[AA_Index]) facing Default building facing degrees
          • Set AA_Spear_Idle[((AA_Index x 10) + AA_Loop_B)] = (Last created unit)
          • Unit - Add a 5.00 second Generic expiration timer to AA_Spear_Idle[((AA_Index x 10) + AA_Loop_B)]
          • Unit - Add Crow Form to AA_Spear_Idle[((AA_Index x 10) + AA_Loop_B)]
          • Unit - Remove Crow Form from AA_Spear_Idle[((AA_Index x 10) + AA_Loop_B)]
          • Unit - Pause AA_Spear_Idle[((AA_Index x 10) + AA_Loop_B)]
          • Set AA_Flying_Height[((AA_Loop_A x 10) + AA_Loop_B)] = 150.00
          • Animation - Change AA_Spear_Idle[((AA_Index x 10) + AA_Loop_B)] flying height to 150.00 at 0.00
          • Set AA_RotationSpeed[AA_Loop_B] = AA_Speed_Initial
          • Set AA_Distance[AA_Loop_B] = 100.00
          • Set AA_Phase[((AA_Loop_A x 10) + AA_Loop_B)] = 0
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • AA_Launch_Loop Less than or equal to 3
            • Then - Actions
              • Set AA_GroupSide[AA_Loop_B] = 1
            • Else - Actions
              • Set AA_GroupSide[AA_Loop_B] = 2
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AA_Index Equal to 1
        • Then - Actions
          • Trigger - Turn on AA Orbit <gen>
        • Else - Actions
  • AA Orbit
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer AA_Loop_A) from 1 to AA_Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (AA_Caster[AA_Loop_A] is alive) Equal to True
              • AA_Loop_A Less than or equal to AA_Index
            • Then - Actions
              • Set AA_Timer[AA_Loop_A] = (AA_Timer[AA_Loop_A] - 0.03)
              • For each (Integer AA_Loop_B) from 1 to AA_Max, do (Actions)
                • Loop - Actions
                  • Set AA_CurrentIndex = ((AA_Loop_A x 10) + AA_Loop_B)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AA_Phase[AA_CurrentIndex] Equal to 0
                    • Then - Actions
                      • Set AA_RotationSpeed[AA_CurrentIndex] = (AA_RotationSpeed[AA_CurrentIndex] + AA_Speed_Gain)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • AA_RotationSpeed[AA_CurrentIndex] Greater than AA_Speed_Max
                        • Then - Actions
                          • Set AA_RotationSpeed[AA_CurrentIndex] = AA_Speed_Max
                        • Else - Actions
                      • Set AA_Angle[AA_CurrentIndex] = (AA_Angle[AA_CurrentIndex] + AA_RotationSpeed[AA_CurrentIndex])
                      • Set AA_Distance[AA_CurrentIndex] = (AA_Distance[AA_CurrentIndex] + 2.00)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • AA_Distance[AA_CurrentIndex] Greater than 300.00
                        • Then - Actions
                          • Set AA_Distance[AA_CurrentIndex] = 300.00
                        • Else - Actions
                      • Set AA_Point[0] = (Position of AA_Caster[AA_Loop_A])
                      • Set AA_Point[1] = (AA_Point[0] offset by AA_Distance[AA_CurrentIndex] towards AA_Angle[AA_CurrentIndex] degrees.)
                      • Set AA_Flying_Height[AA_CurrentIndex] = (AA_Flying_Height[AA_CurrentIndex] + 3.00)
                      • Unit - Move AA_Spear_Idle[AA_CurrentIndex] instantly to AA_Point[1], facing (AA_Angle[AA_CurrentIndex] + 180.00) degrees
                      • Animation - Change AA_Spear_Idle[AA_CurrentIndex] flying height to AA_Flying_Height[AA_CurrentIndex] at 0.00
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • AA_Flying_Height[AA_CurrentIndex] Greater than AA_Hover_Heigh
                        • Then - Actions
                          • Set AA_Flying_Height[AA_CurrentIndex] = AA_Hover_Heigh
                        • Else - Actions
                      • Custom script: call RemoveLocation( udg_AA_Point[0])
                      • Custom script: call RemoveLocation( udg_AA_Point[1])
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • AA_Timer[AA_CurrentIndex] Less than or equal to 0.01
                        • Then - Actions
                          • Set AA_Phase[AA_CurrentIndex] = 1
                          • Trigger - Turn on AA Launch <gen>
                          • Skip remaining actions
                        • Else - Actions
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • AA_Phase[AA_CurrentIndex] Equal to 1
                        • Then - Actions
                          • Trigger - Run AA MoveToSides <gen> (checking conditions)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • AA_Phase[AA_CurrentIndex] Equal to 2
                            • Then - Actions
                              • Trigger - Run AA Launch <gen> (checking conditions)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • AA_Phase[AA_CurrentIndex] Equal to 3
                                • Then - Actions
                                  • Trigger - Run AA Missile Movement <gen> (checking conditions)
                                • Else - Actions
            • Else - Actions
  • AA MoveToSides
    • Events
    • Conditions
    • Actions
      • Set AA_Point[0] = (Position of AA_Caster[AA_Loop_A])
      • Set AA_Side_Index = (((AA_Loop_B - 1) mod 3) - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AA_GroupSide[AA_Loop_A] Equal to 1
        • Then - Actions
          • Set AA_Point[1] = (AA_Point[0] offset by AA_Side_Offset towards ((Facing of AA_Caster[AA_Loop_A]) - 90.00) degrees.)
          • Set AA_Point[1] = (AA_Point[1] offset by (AA_Side_Spread x (Real(AA_Side_Index))) towards (Facing of AA_Caster[AA_Loop_A]) degrees.)
        • Else - Actions
          • Set AA_Point[1] = (AA_Point[0] offset by AA_Side_Offset towards ((Facing of AA_Caster[AA_Loop_A]) + 90.00) degrees.)
          • Set AA_Point[1] = (AA_Point[1] offset by (AA_Side_Spread x (Real(AA_Side_Index))) towards (Facing of AA_Caster[AA_Loop_A]) degrees.)
      • Unit - Move AA_Spear_Idle[AA_CurrentIndex] instantly to AA_Point[1], facing (Facing of AA_Caster[AA_Loop_A]) degrees
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between (Position of AA_Spear_Idle[AA_CurrentIndex]) and AA_Point[1]) Less than or equal to 10.00
        • Then - Actions
          • Set AA_Phase[AA_CurrentIndex] = 2
        • Else - Actions
      • Custom script: call RemoveLocation( udg_AA_Point[0])
      • Custom script: call RemoveLocation( udg_AA_Point[1])
  • AA Launch
    • Events
    • Conditions
    • Actions
      • Set AA_Point[0] = (Position of AA_Spear_Idle[AA_Loop_A])
      • Set AA_TargetGroup = (Units within 1000.00 of AA_Point[0] matching (((((Matching unit) is A structure) Equal to False) and (((Matching unit) is alive) Equal to True)) and ((((Matching unit) is hidden) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of AA_Caste
      • For each (Integer AA_Loop_B) from 1 to AA_Max, do (Actions)
        • Loop - Actions
          • Set AA_CurrentIndex = ((AA_Loop_A x 10) + AA_Loop_B)
          • Set AA_Target[AA_CurrentIndex] = (Random unit from AA_TargetGroup)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • AA_Target[AA_CurrentIndex] Not equal to No unit
            • Then - Actions
              • Set AA_Point[1] = (Position of AA_Target[AA_CurrentIndex])
              • Set AA_Launch_Angle[AA_CurrentIndex] = (Angle from AA_Point[0] to AA_Point[1])
              • Unit - Create 1 Spear Move for (Owner of AA_Caster[AA_Loop_A]) at AA_Point[0] facing AA_Point[1]
              • Set AA_Spear_Projectile[AA_CurrentIndex] = (Last created unit)
              • Set AA_Speed[AA_CurrentIndex] = 25.00
              • Set AA_Boolean[AA_CurrentIndex] = True
              • Set AA_Phase[AA_CurrentIndex] = 3
              • Unit - Remove AA_Spear_Idle[AA_CurrentIndex] from the game
              • Set AA_Spear_Idle[AA_CurrentIndex] = AA_Spear_Projectile[AA_CurrentIndex]
              • Custom script: call RemoveLocation( udg_AA_Point[1])
            • Else - Actions
      • Custom script: call RemoveLocation( udg_AA_Point[0])
      • Custom script: call DestroyGroup( udg_AA_TargetGroup)
  • AA Missile Movement
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer AA_Loop_A) from 1 to AA_Index, do (Actions)
        • Loop - Actions
          • For each (Integer AA_Loop_B) from 1 to AA_Max, do (Actions)
            • Loop - Actions
              • Set AA_CurrentIndex = ((AA_Loop_A x 10) + AA_Loop_B)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • AA_Boolean[AA_CurrentIndex] Equal to True
                • Then - Actions
                  • Set AA_Spear_TempPoint = (Position of AA_Spear_Idle[AA_CurrentIndex])
                  • Set AA_TargetPoint = (Position of AA_Target[AA_CurrentIndex])
                  • Custom script: call SetUnitX(udg_AA_Spear_Idle[udg_AA_CurrentIndex], GetUnitX(udg_AA_Spear_Idle[udg_AA_CurrentIndex]) + udg_AA_Speed[udg_AA_CurrentIndex] * Cos(udg_AA_Launch_Angle[udg_AA_CurrentIndex] * bj_DEGTORAD))
                  • Custom script: call SetUnitY(udg_AA_Spear_Idle[udg_AA_CurrentIndex], GetUnitY(udg_AA_Spear_Idle[udg_AA_CurrentIndex]) + udg_AA_Speed[udg_AA_CurrentIndex] * Sin(udg_AA_Launch_Angle[udg_AA_CurrentIndex] * bj_DEGTORAD))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between AA_Spear_TempPoint and AA_TargetPoint) Less than or equal to 50.00
                    • Then - Actions
                      • Unit - Kill AA_Spear_Idle[AA_CurrentIndex]
                      • Unit - Cause AA_Caster[AA_Loop_A] to damage AA_Target[AA_CurrentIndex], dealing 1000.00 damage of attack type Spells and damage type Normal
                      • Set AA_Spear_Idle[AA_CurrentIndex] = No unit
                      • Set AA_Boolean[AA_CurrentIndex] = False
                      • Set AA_Target[AA_CurrentIndex] = No unit
                    • Else - Actions
                  • Custom script: call RemoveLocation( udg_AA_Spear_TempPoint)
                  • Custom script: call RemoveLocation( udg_AA_TargetPoint)
                • Else - Actions
----------------------------------
Basically the idea for 6 swords is that they spawn evenly around the caster, spin and accelerate then move instantly to the sides of the caster ( separated by small distance like this: * * * Caster * * *) then before they launch they'd go a bit backwards like a slingshot( need to figure that out still) then storm towards random targets.
 
Top