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

Earth Splitter v1.05

Well it had been a while since I last submitted a spell due to the lack of free time but now in the easter holidays I found some time to submit one.

But enough blah, here is the spell:

The Hero asks the heaven for help, which fires divine lasers down to the earth, splitting the ground and cutting through everything they touch.


TRIGGERS:


  • Earth Splitter Ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- This number checks how often the effects are played, 11*0.03 so every 0.33 seconds a effect is created. --------
      • Set EA_IndexSize[5] = 11
      • -------- Maximum number of used lightnings per spell instance. --------
      • Set EA_IndexSize[6] = 8
      • -------- If this number is 1 then trees will be destroyed. --------
      • Set EA_IndexSize[7] = 1
      • -------- Location which will be moved to check the heights at points. --------
      • Set EA_ZLoc = (Point(0.00, 0.00))
      • -------- This action has no real sense for the spell itself it just makes sure that the variable will get copied when using this spell in your map because it is only used in custom scripts. --------
      • Set EA_Calc_Real[1] = 0.00
      • -------- Effects --------
      • Set EA_effect[1] = Abilities\Weapons\DragonHawkMissile\DragonHawkMissile.mdl
      • Set EA_effect[2] = Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
      • Game - Preload Abilities\Weapons\DragonHawkMissile\DragonHawkMissile.mdl
      • Game - Preload Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
      • -------- Tree checker --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • EA_IndexSize[7] Equal to 1
        • Then - Actions
          • Unit - Create 1 Arbeiter for Neutral Passive at EA_ZLoc facing Default building facing (270.0) degrees
          • Set EA_Tree_checker = (Last created unit)
          • Unit - Make EA_Tree_checker Invulnerable
          • Unit - Hide EA_Tree_checker
        • Else - Actions
  • Earth Splitter main
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Earth Splitter
    • Actions
      • -------- If no spell is running, we switch the loop on. --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • EA_IndexSize[1] Equal to 0
        • Then - Actions
          • Trigger - Turn on Earth Splitter loop <gen>
        • Else - Actions
      • -------- Index System, to make this spell MUI. --------
      • Set EA_IndexSize[1] = (EA_IndexSize[1] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • EA_IndexSize[1] Greater than EA_IndexSize[3]
        • Then - Actions
          • Set EA_Index[EA_IndexSize[1]] = EA_IndexSize[1]
          • Set EA_IndexSize[3] = EA_IndexSize[1]
        • Else - Actions
      • Set EA_IndexSize[2] = EA_Index[EA_IndexSize[1]]
      • -------- Spell caster. --------
      • Set EA_Caster[EA_IndexSize[2]] = (Triggering unit)
      • -------- Saving the spell target coordinates in variables. --------
      • Custom script: set udg_EA_TargetX[udg_EA_IndexSize[2]] = GetSpellTargetX()
      • Custom script: set udg_EA_TargetY[udg_EA_IndexSize[2]] = GetSpellTargetY()
      • -------- ---------------------------------------------------------------------------------------------------------- --------
      • -------- ---------------------------SPELL SETTINGS--------------------------- --------
      • -------- ---------------------------------------------------------------------------------------------------------- --------
      • -------- How much lightnings should be created? --------
      • -------- NOTE: Make sure that this number is not higher as the variable EA_IndexSize[6], which can be changed in the Earth Splitter Ini trigger. --------
      • Set EA_Lightning_Nummber[EA_IndexSize[2]] = (2 + ((Level of Earth Splitter for EA_Caster[EA_IndexSize[2]]) x 2))
      • -------- Height of the lightning start point. --------
      • Set EA_Real[(EA_IndexSize[2] x 6)] = 1400.00
      • -------- The damage every single lightning inflicts every 0.03 seconds to valid units. --------
      • Set EA_Real[((EA_IndexSize[2] x 6) + 1)] = (((Real((Level of Earth Splitter for EA_Caster[EA_IndexSize[2]]))) x (Real((Intelligence of EA_Caster[EA_IndexSize[2]] (Include bonuses))))) x 0.05)
      • -------- Maximal area in which the lightnings can move around. --------
      • Set EA_Real[((EA_IndexSize[2] x 6) + 2)] = (200.00 + (100.00 x (Real((Level of Earth Splitter for EA_Caster[EA_IndexSize[2]])))))
      • -------- Move speed. --------
      • Set EA_Real[((EA_IndexSize[2] x 6) + 3)] = 9.00
      • -------- This affects only the speed with which the lightnings come from heaven and move back. --------
      • -------- A higher value makes them move slower. --------
      • Set EA_Real[((EA_IndexSize[2] x 6) + 4)] = 40.00
      • -------- Spell duration. --------
      • -------- NOTE: The timer starts to count when the lightnings have reached the ground, and stops when they start to move back to heaven. --------
      • Set EA_Real[((EA_IndexSize[2] x 6) + 5)] = (4.00 + (2.00 x (Real((Level of Earth Splitter for EA_Caster[EA_IndexSize[2]])))))
      • -------- Area where units are damaged around each lightning. --------
      • Set EA_LightningImpactArea[(EA_IndexSize[2] x 2)] = (170.00 + (10.00 x (Real((Level of Earth Splitter for EA_Caster[EA_IndexSize[2]])))))
      • -------- Area in which trees get killed. --------
      • Set EA_LightningImpactArea[((EA_IndexSize[2] x 2) + 1)] = 125.00
      • -------- Integer counter which is increased every 0.03 seconds, to create a effect only when it reaches a certain number, to prevent lags. --------
      • Set EA_LagPreventer[EA_IndexSize[2]] = 0
      • -------- ---------------------------------------------------------------------------------------------------------- --------
      • -------- ---------------------------END SPELL SETTINGS--------------------------- --------
      • -------- ---------------------------------------------------------------------------------------------------------- --------
      • -------- NOTE: Leave the booleans as they are othwerwise the spell will malfunction. --------
      • -------- Boolean which proves that the spell is not finished. --------
      • Set EA_Boolean[(EA_IndexSize[2] x 4)] = True
      • -------- Activates the block where the lasers come from heaven. --------
      • Set EA_Boolean[((EA_IndexSize[2] x 4) + 1)] = True
      • -------- Activates the block where the lasers move around and damage enemies. --------
      • Set EA_Boolean[((EA_IndexSize[2] x 4) + 2)] = False
      • -------- Activates the block where the lasers move back to heaven. --------
      • Set EA_Boolean[((EA_IndexSize[2] x 4) + 3)] = False
      • -------- We move the Zlocation to the coordinates where the lightnings spawn. --------
      • Custom script: call MoveLocation( udg_EA_ZLoc, udg_EA_TargetX[udg_EA_IndexSize[2]], udg_EA_TargetY[udg_EA_IndexSize[2]])
      • -------- Creating and setting values for each lightning. --------
      • For each (Integer EA_Loop_int[2]) from 1 to EA_Lightning_Nummber[EA_IndexSize[2]], do (Actions)
        • Loop - Actions
          • -------- Just a conversion for the array, to let it look cleaner. --------
          • Set EA_IndexSize[4] = ((EA_IndexSize[2] x EA_IndexSize[6]) + (EA_Loop_int[2] - 1))
          • -------- Setting the current lightning height. --------
          • Set EA_LightningHeight[EA_IndexSize[4]] = (EA_Real[(EA_IndexSize[2] x 6)] - 50.00)
          • -------- Saving the coordinates of the lightning. --------
          • Set EA_X[EA_IndexSize[4]] = EA_TargetX[EA_IndexSize[2]]
          • Set EA_Y[EA_IndexSize[4]] = EA_TargetY[EA_IndexSize[2]]
          • -------- To move the lightnings in a cone down to earth, the angle is set up. --------
          • Set EA_Angle[EA_IndexSize[4]] = ((360.00 / (Real(EA_Lightning_Nummber[EA_IndexSize[2]]))) x (Real(EA_Loop_int[2])))
          • -------- The offset from the target point to the point, where the lightnings hit the ground. --------
          • -------- NOTE: Have to be lower then the Area where the Lightnings move around == EA_Real[((EA_IndexSize[2] * 6) + 2)] --------
          • Set EA_Offset[EA_IndexSize[4]] = 200.00
          • -------- We set up the movement speed by dividing the offset, 200 at the moment, with EA_Real[((EA_IndexSize[2] * 6) + 4)]. --------
          • Set EA_OffsetDecreaser[EA_IndexSize[4]] = (EA_Offset[EA_IndexSize[4]] / EA_Real[((EA_IndexSize[2] x 6) + 4)])
          • -------- Here we do the same, by dividing through the same number we achieve that after 200 the lightning hits the ground. --------
          • Set EA_HeigtDecreaser[EA_IndexSize[4]] = (EA_LightningHeight[EA_IndexSize[4]] / EA_Real[((EA_IndexSize[2] x 6) + 4)])
          • -------- Checking how high the terrain at the Zloc is. --------
          • Custom script: set udg_EA_Calc_Real[1] = GetLocationZ(udg_EA_ZLoc)
          • -------- Setting the height of the lightning. --------
          • Custom script: set udg_EA_Calc_Real[2] = (udg_EA_LightningHeight[udg_EA_IndexSize[4]] + udg_EA_Calc_Real[1])
          • -------- Setting the base height of the lightning. --------
          • Custom script: set udg_EA_Calc_Real[3] = (udg_EA_Real[(udg_EA_IndexSize[2] * 6)] + udg_EA_Calc_Real[1])
          • -------- Creating the lightning and saving it in a variable. "DRAM" is the type of lightning, here the drain mana lightning. --------
          • -------- If you want to use another lightning, create a new trigger create via the gui function a lightning and convert the trigger to JASS then you find anywhere a word in big letters like"DRAM". Just insert this word in the action below. --------
          • Custom script: set udg_EA_Lightning[udg_EA_IndexSize[4]] = AddLightningEx("DRAM", false, udg_EA_X[udg_EA_IndexSize[4]], udg_EA_Y[udg_EA_IndexSize[4]], udg_EA_Calc_Real[2], udg_EA_TargetX[udg_EA_IndexSize[2]], udg_EA_TargetY[udg_EA_IndexSize[2]], udg_EA_Calc_Real[3])
  • Earth Splitter loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- Loop through all spell instances. --------
      • For each (Integer EA_Loop_int[1]) from 1 to EA_IndexSize[1], do (Actions)
        • Loop - Actions
          • -------- Converting the array to a variable. --------
          • Set EA_IndexSize[2] = EA_Index[EA_Loop_int[1]]
          • -------- ---------------------------------------------------------------------------------------------------------- --------
          • -------- If the condition which checks if the instance is still running is true, the spell continues. --------
          • -------- ---------------------------------------------------------------------------------------------------------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • EA_Boolean[(EA_IndexSize[2] x 4)] Equal to True
            • Then - Actions
              • -------- ---------------------------------------------------------------------------------------------------------- --------
              • -------- If this boolean is true, the lightnings are coming from the sky. --------
              • -------- ---------------------------------------------------------------------------------------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • EA_Boolean[((EA_IndexSize[2] x 4) + 1)] Equal to True
                • Then - Actions
                  • -------- Moving the Zloc. --------
                  • Custom script: call MoveLocation( udg_EA_ZLoc, udg_EA_TargetX[udg_EA_IndexSize[2]], udg_EA_TargetY[udg_EA_IndexSize[2]])
                  • -------- Looping through all Lightnings of this Instance. --------
                  • For each (Integer EA_Loop_int[2]) from 1 to EA_Lightning_Nummber[EA_IndexSize[2]], do (Actions)
                    • Loop - Actions
                      • -------- Converting the array. --------
                      • Set EA_IndexSize[4] = ((EA_IndexSize[2] x EA_IndexSize[6]) + (EA_Loop_int[2] - 1))
                      • -------- Moving the X coordinate. --------
                      • Custom script: set udg_EA_X[udg_EA_IndexSize[4]] = udg_EA_X[udg_EA_IndexSize[4]] + udg_EA_OffsetDecreaser[udg_EA_IndexSize[4]] * Cos(udg_EA_Angle[udg_EA_IndexSize[4]]*bj_DEGTORAD)
                      • -------- Moving the Y coordinate. --------
                      • Custom script: set udg_EA_Y[udg_EA_IndexSize[4]] = udg_EA_Y[udg_EA_IndexSize[4]] + udg_EA_OffsetDecreaser[udg_EA_IndexSize[4]] * Sin(udg_EA_Angle[udg_EA_IndexSize[4]]*bj_DEGTORAD)
                      • -------- Decreasing the Height. --------
                      • Set EA_LightningHeight[EA_IndexSize[4]] = (EA_LightningHeight[EA_IndexSize[4]] - EA_HeigtDecreaser[EA_IndexSize[4]])
                      • -------- Converting the coordinates to a point to check the height. --------
                      • Set EA_Loc = (Point(EA_X[EA_IndexSize[4]], EA_Y[EA_IndexSize[4]]))
                      • Custom script: set udg_EA_Calc_Real[1] = GetLocationZ(udg_EA_ZLoc)
                      • Custom script: set udg_EA_Calc_Real[4] = GetLocationZ(udg_EA_Loc)
                      • -------- Setting the new height of the lightning. --------
                      • Custom script: set udg_EA_Calc_Real[2] = (udg_EA_LightningHeight[udg_EA_IndexSize[4]] + udg_EA_Calc_Real[4])
                      • Custom script: set udg_EA_Calc_Real[3] = (udg_EA_Real[(udg_EA_IndexSize[2] * 6)] + udg_EA_Calc_Real[1])
                      • -------- Moving the lightning. --------
                      • Custom script: call MoveLightningEx(udg_EA_Lightning[udg_EA_IndexSize[4]], true, udg_EA_X[udg_EA_IndexSize[4]], udg_EA_Y[udg_EA_IndexSize[4]], udg_EA_Calc_Real[2], udg_EA_TargetX[udg_EA_IndexSize[2]], udg_EA_TargetY[udg_EA_IndexSize[2]], udg_EA_Calc_Real[3])
                      • -------- Removing the created leak. --------
                      • Custom script: call RemoveLocation(udg_EA_Loc)
                  • -------- When the height is 0, we turn this section off and switch to the part where the lightnings move and damage targets. --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • EA_LightningHeight[(EA_IndexSize[2] x EA_IndexSize[6])] Less than or equal to 0.00
                    • Then - Actions
                      • Set EA_Boolean[((EA_IndexSize[2] x 4) + 1)] = False
                      • Set EA_Boolean[((EA_IndexSize[2] x 4) + 2)] = True
                      • For each (Integer EA_Loop_int[3]) from 1 to EA_Lightning_Nummber[EA_IndexSize[2]], do (Actions)
                        • Loop - Actions
                          • Set EA_IndexSize[4] = ((EA_IndexSize[2] x EA_IndexSize[6]) + (EA_Loop_int[3] - 1))
                          • -------- We set the angle to a random value. --------
                          • Set EA_Angle[EA_IndexSize[4]] = (Random real number between 0.00 and 360.00)
                    • Else - Actions
                • Else - Actions
              • -------- ---------------------------------------------------------------------------------------------------------- --------
              • -------- This is the main part of the spell, when the lightnings reach the ground they move random around. --------
              • -------- Here the counter starts. --------
              • -------- ---------------------------------------------------------------------------------------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • EA_Boolean[((EA_IndexSize[2] x 4) + 2)] Equal to True
                • Then - Actions
                  • -------- Reducing the remaining time. --------
                  • Set EA_Real[((EA_IndexSize[2] x 6) + 5)] = (EA_Real[((EA_IndexSize[2] x 6) + 5)] - 0.03)
                  • -------- Increasing the effect counter. --------
                  • Set EA_LagPreventer[EA_IndexSize[2]] = (EA_LagPreventer[EA_IndexSize[2]] + 1)
                  • -------- Moving the Zlocation. --------
                  • Custom script: call MoveLocation( udg_EA_ZLoc, udg_EA_TargetX[udg_EA_IndexSize[2]], udg_EA_TargetY[udg_EA_IndexSize[2]])
                  • -------- Looping through all Lightnings of this spell instance. --------
                  • For each (Integer EA_Loop_int[2]) from 1 to EA_Lightning_Nummber[EA_IndexSize[2]], do (Actions)
                    • Loop - Actions
                      • -------- Converting the array. --------
                      • Set EA_IndexSize[4] = ((EA_IndexSize[2] x EA_IndexSize[6]) + (EA_Loop_int[2] - 1))
                      • -------- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --------
                      • -------- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --------
                      • -------- 66% that the Lightning will move the same direction as before and 33% that the lightning turns left or right. --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Random integer number between 1 and 3) Equal to 1
                        • Then - Actions
                        • Else - Actions
                          • -------- 50% right 50% left. --------
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Random integer number between 1 and 2) Equal to 1
                            • Then - Actions
                              • Set EA_Angle[EA_IndexSize[4]] = (EA_Angle[EA_IndexSize[4]] + 10.00)
                            • Else - Actions
                              • Set EA_Angle[EA_IndexSize[4]] = (EA_Angle[EA_IndexSize[4]] - 10.00)
                      • -------- Chance of 5% that the lightning will strong turn to the right or left. --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Random integer number between 1 and 20) Equal to 1
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Random integer number between 1 and 2) Equal to 1
                            • Then - Actions
                              • Set EA_Angle[EA_IndexSize[4]] = (EA_Angle[EA_IndexSize[4]] + 90.00)
                            • Else - Actions
                              • Set EA_Angle[EA_IndexSize[4]] = (EA_Angle[EA_IndexSize[4]] - 90.00)
                        • Else - Actions
                      • -------- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --------
                      • -------- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --------
                      • -------- Moving the X coordinate. --------
                      • Custom script: set udg_EA_X[udg_EA_IndexSize[4]] = udg_EA_X[udg_EA_IndexSize[4]] + udg_EA_Real[((udg_EA_IndexSize[2] * 6) + 3)] * Cos(udg_EA_Angle[udg_EA_IndexSize[4]]*bj_DEGTORAD)
                      • -------- Moving the Y coordinate. --------
                      • Custom script: set udg_EA_Y[udg_EA_IndexSize[4]] = udg_EA_Y[udg_EA_IndexSize[4]] + udg_EA_Real[((udg_EA_IndexSize[2] * 6) + 3)] * Sin(udg_EA_Angle[udg_EA_IndexSize[4]]*bj_DEGTORAD)
                      • -------- Converting to a point to evaluate the height and damaging units around it. --------
                      • Set EA_Loc = (Point(EA_X[EA_IndexSize[4]], EA_Y[EA_IndexSize[4]]))
                      • Custom script: set udg_EA_Calc_Real[1] = GetLocationZ(udg_EA_ZLoc)
                      • Custom script: set udg_EA_Calc_Real[4] = GetLocationZ(udg_EA_Loc)
                      • -------- Setting the new height of the lightning. --------
                      • Custom script: set udg_EA_Calc_Real[2] = (udg_EA_LightningHeight[udg_EA_IndexSize[2]] + udg_EA_Calc_Real[4])
                      • Custom script: set udg_EA_Calc_Real[3] = (udg_EA_Real[(udg_EA_IndexSize[2] * 6)] + udg_EA_Calc_Real[1])
                      • -------- Moving the lightning. --------
                      • Custom script: call MoveLightningEx(udg_EA_Lightning[udg_EA_IndexSize[4]], true, udg_EA_X[udg_EA_IndexSize[4]], udg_EA_Y[udg_EA_IndexSize[4]], udg_EA_Calc_Real[2], udg_EA_TargetX[udg_EA_IndexSize[2]], udg_EA_TargetY[udg_EA_IndexSize[2]], udg_EA_Calc_Real[3])
                      • -------- When the counter has reached the limit, a effect is created. --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • EA_LagPreventer[EA_IndexSize[2]] Equal to EA_IndexSize[5]
                        • Then - Actions
                          • Special Effect - Create a special effect at EA_Loc using EA_effect[1]
                          • Special Effect - Destroy (Last created special effect)
                          • Special Effect - Create a special effect at EA_Loc using EA_effect[2]
                          • Special Effect - Destroy (Last created special effect)
                        • Else - Actions
                      • -------- To prevent the lightnings from moving out of the area we check the distance to the target point, and when it is too high the lightning has to focus the center. --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Distance between EA_Loc and EA_ZLoc) Greater than or equal to EA_Real[((EA_IndexSize[2] x 6) + 2)]
                        • Then - Actions
                          • Set EA_Angle[EA_IndexSize[4]] = (Angle from EA_Loc to EA_ZLoc)
                        • Else - Actions
                      • -------- Custom Script which destroys the next created group. --------
                      • Custom script: set bj_wantDestroyGroup = true
                      • -------- Picking all valid units and damaging them. --------
                      • Unit Group - Pick every unit in (Units within EA_LightningImpactArea[(EA_IndexSize[2] x 2)] of EA_Loc matching (((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) is A ground unit) Equal to True))) and ((((Matching unit) and do (Actions)
                        • Loop - Actions
                          • Unit - Cause EA_Caster[EA_IndexSize[2]] to damage (Picked unit), dealing EA_Real[((EA_IndexSize[2] x 6) + 1)] damage of attack type Chaos and damage type Normal
                      • -------- If the Destroy trees option is enabled all destructables get picked and checked if they are trees or bridges for example. --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • EA_IndexSize[7] Equal to 1
                        • Then - Actions
                          • Destructible - Pick every destructible within EA_LightningImpactArea[((EA_IndexSize[2] x 2) + 1)] of EA_Loc and do (Actions)
                            • Loop - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • ((Picked destructible) is alive) Equal to True
                                • Then - Actions
                                  • Unit - Order EA_Tree_checker to Harvest (Picked destructible)
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Current order of EA_Tree_checker) Equal to (Order(harvest))
                                    • Then - Actions
                                      • Destructible - Kill (Picked destructible)
                                    • Else - Actions
                                  • Unit - Order EA_Tree_checker to Stop
                                • Else - Actions
                        • Else - Actions
                      • Custom script: call RemoveLocation(udg_EA_Loc)
                  • -------- When the effect counter has reached the limit, it will be resetted. --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • EA_LagPreventer[EA_IndexSize[2]] Equal to EA_IndexSize[5]
                    • Then - Actions
                      • Set EA_LagPreventer[EA_IndexSize[2]] = 0
                    • Else - Actions
                  • -------- When the timer is zero, we save the offset and the angle to move the lightnings back to the start position. --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • EA_Real[((EA_IndexSize[2] x 6) + 5)] Less than or equal to 0.00
                    • Then - Actions
                      • -------- Switching the booleans. --------
                      • Set EA_Boolean[((EA_IndexSize[2] x 4) + 2)] = False
                      • Set EA_Boolean[((EA_IndexSize[2] x 4) + 3)] = True
                      • -------- Evaluating the new real values for each lightning. --------
                      • For each (Integer EA_Loop_int[2]) from 1 to EA_Lightning_Nummber[EA_IndexSize[2]], do (Actions)
                        • Loop - Actions
                          • Set EA_IndexSize[4] = ((EA_IndexSize[2] x EA_IndexSize[6]) + (EA_Loop_int[2] - 1))
                          • Set EA_Loc = (Point(EA_X[EA_IndexSize[4]], EA_Y[EA_IndexSize[4]]))
                          • Set EA_Angle[EA_IndexSize[4]] = (Angle from EA_Loc to EA_ZLoc)
                          • Set EA_Offset[EA_IndexSize[4]] = (Distance between EA_Loc and EA_ZLoc)
                          • Set EA_OffsetDecreaser[EA_IndexSize[4]] = (EA_Offset[EA_IndexSize[4]] / EA_Real[((EA_IndexSize[2] x 6) + 4)])
                          • Custom script: call RemoveLocation(udg_EA_Loc)
                    • Else - Actions
                • Else - Actions
              • -------- ---------------------------------------------------------------------------------------------------------- --------
              • -------- This last block moves the lightnings back to the start point. --------
              • -------- ---------------------------------------------------------------------------------------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • EA_Boolean[((EA_IndexSize[2] x 4) + 3)] Equal to True
                • Then - Actions
                  • -------- Moving the Zloc. --------
                  • Custom script: call MoveLocation( udg_EA_ZLoc, udg_EA_TargetX[udg_EA_IndexSize[2]], udg_EA_TargetY[udg_EA_IndexSize[2]])
                  • -------- Looping through all Lightnings. --------
                  • For each (Integer EA_Loop_int[2]) from 1 to EA_Lightning_Nummber[EA_IndexSize[2]], do (Actions)
                    • Loop - Actions
                      • -------- Converting the array. --------
                      • Set EA_IndexSize[4] = ((EA_IndexSize[2] x EA_IndexSize[6]) + (EA_Loop_int[2] - 1))
                      • -------- Moving the X coordinate. --------
                      • Custom script: set udg_EA_X[udg_EA_IndexSize[4]] = udg_EA_X[udg_EA_IndexSize[4]] + udg_EA_OffsetDecreaser[udg_EA_IndexSize[4]] * Cos(udg_EA_Angle[udg_EA_IndexSize[4]]*bj_DEGTORAD)
                      • -------- Moving the Y coordinate. --------
                      • Custom script: set udg_EA_Y[udg_EA_IndexSize[4]] = udg_EA_Y[udg_EA_IndexSize[4]] + udg_EA_OffsetDecreaser[udg_EA_IndexSize[4]] * Sin(udg_EA_Angle[udg_EA_IndexSize[4]]*bj_DEGTORAD)
                      • -------- Increasing the Height of the lightning. --------
                      • Set EA_LightningHeight[EA_IndexSize[4]] = (EA_LightningHeight[EA_IndexSize[4]] + EA_HeigtDecreaser[EA_IndexSize[4]])
                      • -------- Creating a point to check for the height of the terrain. --------
                      • Set EA_Loc = (Point(EA_X[EA_IndexSize[4]], EA_Y[EA_IndexSize[4]]))
                      • Custom script: set udg_EA_Calc_Real[1] = GetLocationZ(udg_EA_ZLoc)
                      • Custom script: set udg_EA_Calc_Real[4] = GetLocationZ(udg_EA_Loc)
                      • -------- Setting the new height. --------
                      • Custom script: set udg_EA_Calc_Real[2] = (udg_EA_LightningHeight[udg_EA_IndexSize[4]] + udg_EA_Calc_Real[4])
                      • Custom script: set udg_EA_Calc_Real[3] = (udg_EA_Real[(udg_EA_IndexSize[2] * 6)] + udg_EA_Calc_Real[1])
                      • -------- Moving the lightning. --------
                      • Custom script: call MoveLightningEx(udg_EA_Lightning[udg_EA_IndexSize[4]], true, udg_EA_X[udg_EA_IndexSize[4]], udg_EA_Y[udg_EA_IndexSize[4]], udg_EA_Calc_Real[2], udg_EA_TargetX[udg_EA_IndexSize[2]], udg_EA_TargetY[udg_EA_IndexSize[2]], udg_EA_Calc_Real[3])
                      • -------- The created leak gets removed. --------
                      • Custom script: call RemoveLocation(udg_EA_Loc)
                  • -------- When the Lightnings are back to their start place the block get turned of and the boolean which check if the spell instance is running get also turned off. --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • EA_LightningHeight[(EA_IndexSize[2] x EA_IndexSize[6])] Greater than or equal to (EA_Real[(EA_IndexSize[2] x 6)] - 50.00)
                    • Then - Actions
                      • Set EA_Boolean[((EA_IndexSize[2] x 4) + 3)] = False
                      • Set EA_Boolean[(EA_IndexSize[2] x 4)] = False
                    • Else - Actions
                • Else - Actions
            • Else - Actions
              • -------- The spell is over so we remove the lightnings. --------
              • For each (Integer EA_Loop_int[2]) from 1 to EA_Lightning_Nummber[EA_IndexSize[2]], do (Actions)
                • Loop - Actions
                  • Set EA_IndexSize[4] = ((EA_IndexSize[2] x EA_IndexSize[6]) + (EA_Loop_int[2] - 1))
                  • Lightning - Destroy EA_Lightning[EA_IndexSize[4]]
              • -------- End part of the Index System. --------
              • Set EA_Index[EA_Loop_int[1]] = EA_Index[EA_IndexSize[1]]
              • Set EA_Index[EA_IndexSize[1]] = EA_IndexSize[2]
              • Set EA_IndexSize[1] = (EA_IndexSize[1] - 1)
              • Set EA_Loop_int[1] = (EA_Loop_int[1] - 1)
              • -------- If this was the last running instance we turn this trigger off. --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • EA_IndexSize[1] Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
Credits are welcome but not absolutely needed.

Update 1.05:

- removed unnessecary stuff with the tree checker
- fixed a hardcoded part
- improved speed slightly

~Blackhawk

Keywords:
Lightning, Laser, Blue, Heaven, Divine, Holy, Earth, Splitt, Cut, Cone, Cracks, Random
Contents

Earth Splitter v1.0 (Map)

Reviews
00:12, 17th Jun 2010 Hanky: The effects are cool. Also your spell is MUI and leakless. Well, I got no other choice. Approved!

Moderator

M

Moderator

00:12, 17th Jun 2010
Hanky:
The effects are cool. Also your spell is MUI and leakless. Well, I got no other choice. Approved!
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
niceeeeeeeeeeee
someone is reading my code :D
unfortunately, you also copyed a mistake I made
you won't need to set the tree checker unit's position to that of the tree for some reason
my bad, sorry ^^

very nice code, only some tiny things for next time

non-array-variables are like twice as fast as array-variables

and I just ran
JASS:
set udg_r = GetWidgetX(udg_u)
set udg_r = GetUnitX(udg_u)
5 million times (r is a real variable, u is a unit)
GetWidgetX took 23 seconds while
GetUnitX took 18 seconds
(stopped with my stop watch cause wc3 got frozen)
GetUnitX might be even faster since I ran it together with a function to count them
I think this is caused by typecasting from widget to unit

to check if a distance is bigger than some value it will be faster to use pythagoras directly (x,y,x2,y2,r are variables of type real)
JASS:
if (x-x2)*(x-x2)+(y-y2)*(y-y2) > r * r then
pow and sqrt are slow

you may also try to merge more arrays together (e.g. you can save booleans as reals (if x = 1 then...)) but if you paste all spell data when the map is ready it does not really matter

5/5 + rep from me :thumbs_up:

edit:
JASS:
set udg_r = udg_r
took 6 seconds while
JASS:
set udg_array[0] = udg_array[0]
took 9 seconds

and before somebody starts to complain about these data being damn inaccurate I'll do it first
THESE THINGS WERE MEASURED WITH MY PC AND COULD BE DIFFERENT FOR OTHER PEOPLE

edit2:
SetWidgetLife took 40 sec
SetUnitState(udg_u, UNIT_STATE_LIFE, 100) took the same
the BJ first broke the operation limit and after I adjusted it it broke the game after 40 seconds
(of cause I always handled the operation limit with running the trigger again after 25000 function calls (+ 5000 exitwhen, 5000 udg_i = udg_i + 1)

edit3:
local variables are as "slow" (compared to normal ones) as arrays (fuck! gonna recode some spells X)
and it appears like the game can't handle 5k trigger executions in a row
and booleans are as fast as reals
 
Last edited:
Level 4
Joined
Nov 8, 2009
Messages
25
Thanks D4RK_G4ND4LF for such a great review, will change the tree check thingy later when I have time.

You are right, your codes were my inspiration^^. I learned a lot from your spells :) , so I owe you a big thanks :thumbs_up: . I would rep you but I have to spread some first before I can give it to you again :/

About the array stuff, would it be faster for example to set a location without an array, EA_Loc instead of EA_Loc[1] ? Or do this just affect "2D-arrays" ?

Merging more arrays afterwards is, of course you know^^, a torture :p and I think that the code is already hard to read so when I merge even more variables it could be an overkill

@aaron79:

Thanks, feel free to edit this for your purposes

@powerloll:

Thanks :)
 
Level 14
Joined
Oct 18, 2008
Messages
599
Thanks D4RK_G4ND4LF for such a great review, will change the tree check thingy later when I have time.

You are right, your codes were my inspiration^^. I learned a lot from your spells :) , so I owe you a big thanks :thumbs_up: . I would rep you but I have to spread some first before I can give it to you again :/

About the array stuff, would it be faster for example to set a location without an array, EA_Loc instead of EA_Loc[1] ? Or do this just affect "2D-arrays" ?

Merging more arrays afterwards is, of course you know^^, a torture :p and I think that the code is already hard to read so when I merge even more variables it could be an overkill

@aaron79:

Thanks, feel free to edit this for your purposes

@powerloll:

Thanks :)


yeah i have edited it, my map required low dmg so i changed the damage formula and # of lightnings. you should also make this jass, it is like 30% custom script anyway xD
 
Top