[GUI] Electrify v1e

This bundle is marked as approved. It works and satisfies the submission rules.

The hero throws a lightning ball in the air. When it reaches its limit, it will hit the ground dealing radius damage. It also can destroy trees. Each enemy unit will be pulled toward the lightning ball for a few seconds, which make them unable to move, cast spells or attack.

Level 1 - Deals 75 damage in 250 radius and pull enemies for 1 second.
Level 2 - Deals 125 damage in 300 radius and pull enemies for 1.5 second.
Level 3 - Deals 175 damage in 350 radius and pull enemies for 2 seconds.



  • Electrify Settings
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set E0_AttackType = Spells
      • Set E0_DamageType = Magic
      • -------- ------- --------
      • Set E0_DestroyTree = True
      • -------- ------- --------
      • Set E0_AoE_Base = 200.00
      • Set E0_AoE_Increment = 50.00
      • Set E0_DamageAmount_Base = 25.00
      • Set E0_DamageAmount_Increment = 50.00
      • Set E0_DamageDelay = 0.51
      • Set E0_Dummy_Size = 1.15
      • Set E0_Duration_Base = 0.50
      • Set E0_Duration_Increment = 0.50
      • Set E0_Travel_Time = 1.20
      • Set E0_Speed_Enemy = 1.50
      • Set E0_ProjectileMaximumZ = 750.00
      • Set E0_ProjectileLaunchZ = 60.00
      • Set E0_ProjectileImpactZ = 60.00
      • -------- ------- --------
      • Set E0_MaxTargets_Base = 2
      • Set E0_MaxTargets_Increment = 2
      • -------- ------- --------
      • Set E0_LightningType = Forked Lightning
      • Set E0_S_Chest_Primary = ZapMissile.mdx
      • Set E0_S_Chest_Alternative = LightningSphere_FX.mdx
      • Set E0_S_Chest_Enemy = Abilities\Spells\Orc\Purge\PurgeBuffTarget.mdl
      • Set E0_S_DamageUnit = Abilities\Weapons\Bolt\BoltImpact.mdl
      • Set E0_S_Impact = EMPBomb.mdx
      • Set E0_S_Origin = Abilities\Spells\Orc\LightningShield\LightningShieldTarget.mdl
      • -------- Tree Checker --------
      • Set Point1 = (Center of (Playable map area))
      • Unit - Create 1 Peasant for Neutral Passive at Point1 facing Default building facing degrees
      • Set E0_TreeChecker = (Last created unit)
      • Unit - Make E0_TreeChecker Invulnerable
      • Unit - Hide E0_TreeChecker
      • Custom script: call RemoveLocation(udg_Point1)
      • -------- Preload --------
      • Game - Preload E0_S_Chest_Alternative
      • Game - Preload E0_S_Chest_Primary
      • Game - Preload E0_S_Chest_Enemy
      • Game - Preload E0_S_DamageUnit
      • Game - Preload E0_S_Impact
      • Game - Preload E0_S_Origin
  • Electrify Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Electrify
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • E1_Index_Size Equal to 0
        • Then - Actions
          • Trigger - Turn on Electrify Loop <gen>
        • Else - Actions
      • Set E1_Index_Size = (E1_Index_Size + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • E1_Index_Size Greater than E1_Index_Max
        • Then - Actions
          • Set E1_Index_Itself[E1_Index_Size] = E1_Index_Size
          • Set E1_Index_Max = E1_Index_Size
        • Else - Actions
      • Set E1_Current = E1_Index_Itself[E1_Index_Size]
      • Set E1_Caster[E1_Current] = (Triggering unit)
      • Set E1_Level[E1_Current] = (Level of Electrify for E1_Caster[E1_Current])
      • Set Point1 = (Position of E1_Caster[E1_Current])
      • Set Point2 = (Target point of ability being cast)
      • Custom script: set udg_E2_x1 = GetLocationX(udg_Point2) - GetUnitX(udg_E1_Caster[udg_E1_Current])
      • Custom script: set udg_E2_y1 = GetLocationY(udg_Point2) - GetUnitY(udg_E1_Caster[udg_E1_Current])
      • Custom script: set udg_E1_Angle[udg_E1_Current] = Atan2(udg_E2_y1, udg_E2_x1)
      • Set E1_Splash[E1_Current] = False
      • Set E1_Boom[E1_Current] = False
      • Set E1_ZDuration[E1_Current] = 0.00
      • Set E1_ZInterval[E1_Current] = ((0.90 / E0_Travel_Time) x 3.00)
      • Set E1_ZMaxHeight[E1_Current] = E0_ProjectileMaximumZ
      • Set E1_AoE[E1_Current] = (E0_AoE_Base + (E0_AoE_Increment x (Real(E1_Level[E1_Current]))))
      • Set E1_Duration[E1_Current] = (E0_Duration_Base + (E0_Duration_Increment x (Real(E1_Level[E1_Current]))))
      • Custom script: set udg_E1_Speed[udg_E1_Current] = ( SquareRoot(udg_E2_x1 * udg_E2_x1 + udg_E2_y1 * udg_E2_y1) / udg_E0_Travel_Time ) * 0.03
      • Set E1_MaxTarget[E1_Current] = (E0_MaxTargets_Base + (E0_MaxTargets_Increment x E1_Level[E1_Current]))
      • Set E1_Damage[E1_Current] = (E0_DamageAmount_Base + (E0_DamageAmount_Increment x (Real(E1_Level[E1_Current]))))
      • Unit - Create 1 dummy for Neutral Passive at Point1 facing ((180.00 / 3.14) x E1_Angle[E1_Current]) degrees
      • Set E1_Dummy[E1_Current] = (Last created unit)
      • Animation - Change E1_Dummy[E1_Current] flying height to E0_ProjectileLaunchZ at 0.00
      • Animation - Change E1_Dummy[E1_Current]'s size to ((E0_Dummy_Size x 100.00)%, (E0_Dummy_Size x 100.00)%, (E0_Dummy_Size x 100.00)%) of its original size
      • Special Effect - Create a special effect attached to the origin of E1_Dummy[E1_Current] using E0_S_Chest_Primary
      • Set E1_SFX_Chest[E1_Current] = (Last created special effect)
      • Custom script: call RemoveLocation(udg_Point1)
      • Custom script: call RemoveLocation(udg_Point2)
  • Electrify Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer E1_Loop) from 1 to E1_Index_Size, do (Actions)
        • Loop - Actions
          • Set E1_Current = E1_Index_Itself[E1_Loop]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • E1_Splash[E1_Current] Equal to False
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • E1_ZDuration[E1_Current] Less than 90.00
                • Then - Actions
                  • Custom script: set udg_E2_x1 = GetUnitX(udg_E1_Dummy[udg_E1_Current])
                  • Custom script: set udg_E2_y1 = GetUnitY(udg_E1_Dummy[udg_E1_Current])
                  • Custom script: set udg_E2_x2 = udg_E2_x1 + udg_E1_Speed[udg_E1_Current] * Cos(udg_E1_Angle[udg_E1_Current])
                  • Custom script: set udg_E2_y2 = udg_E2_y1 + udg_E1_Speed[udg_E1_Current] * Sin(udg_E1_Angle[udg_E1_Current])
                  • Custom script: call SetUnitX(udg_E1_Dummy[udg_E1_Current], udg_E2_x2)
                  • Custom script: call SetUnitY(udg_E1_Dummy[udg_E1_Current], udg_E2_y2)
                  • Set E1_ZDuration[E1_Current] = (E1_ZDuration[E1_Current] + E1_ZInterval[E1_Current])
                  • Animation - Change E1_Dummy[E1_Current] flying height to (((Sin(E1_ZDuration[E1_Current])) x E1_ZMaxHeight[E1_Current]) + E0_ProjectileLaunchZ) at 0.00
                • Else - Actions
                  • Set E1_Splash[E1_Current] = True
                  • Set E1_ZDuration[E1_Current] = 0.00
                  • Set E1_ZInterval[E1_Current] = ((0.90 / E0_DamageDelay) x 3.00)
                  • Set E1_ZMaxHeight[E1_Current] = E0_ProjectileMaximumZ
                  • Set Point1 = (Position of E1_Dummy[E1_Current])
                  • Special Effect - Create a special effect at Point1 using E0_S_Origin
                  • Set E1_SFX_Origin[E1_Current] = (Last created special effect)
                  • Custom script: call RemoveLocation(udg_Point1)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • E1_Boom[E1_Current] Equal to False
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • E1_ZDuration[E1_Current] Less than 90.00
                    • Then - Actions
                      • Set E1_ZDuration[E1_Current] = (E1_ZDuration[E1_Current] + E1_ZInterval[E1_Current])
                      • Animation - Change E1_Dummy[E1_Current] flying height to (((Cos(E1_ZDuration[E1_Current])) x E1_ZMaxHeight[E1_Current]) + E0_ProjectileImpactZ) at 0.00
                    • Else - Actions
                      • Set Point1 = (Position of E1_Dummy[E1_Current])
                      • Set E1_Boom[E1_Current] = True
                      • Custom script: set bj_wantDestroyGroup = true
                      • Unit Group - Pick every unit in (Units within E1_AoE[E1_Current] of Point1 matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is dead) Equal to False) and (((Matching unit) belongs to an enemy of (Owner and do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • E1_MaxTarget[E1_Current] Greater than 0
                            • Then - Actions
                              • Set E1_MaxTarget[E1_Current] = (E1_MaxTarget[E1_Current] - 1)
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • E2_Index_Size Equal to 0
                                • Then - Actions
                                  • Set E2_Allow = True
                                • Else - Actions
                              • Set E2_Index_Size = (E2_Index_Size + 1)
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • E2_Index_Size Greater than E2_Index_Max
                                • Then - Actions
                                  • Set E2_Index_Itself[E2_Index_Size] = E2_Index_Size
                                  • Set E2_Index_Max = E2_Index_Size
                                • Else - Actions
                              • Set E2_Current = E2_Index_Itself[E2_Index_Size]
                              • Set E2_Enemy[E2_Current] = (Picked unit)
                              • Set E2_Source[E2_Current] = E1_Dummy[E1_Current]
                              • Set E2_Duration[E2_Current] = E1_Duration[E1_Current]
                              • Custom script: call UnitDamageTarget( udg_E1_Caster[udg_E1_Current], udg_E2_Enemy[udg_E2_Current], udg_E1_Damage[udg_E1_Current], true, true, udg_E0_AttackType, udg_E0_DamageType, null )
                              • Special Effect - Create a special effect attached to the origin of E2_Enemy[E2_Current] using E0_S_Chest_Enemy
                              • Set E2_SFX_Enemy[E2_Current] = (Last created special effect)
                              • Special Effect - Create a special effect attached to the origin of E2_Enemy[E2_Current] using E0_S_DamageUnit
                              • Special Effect - Destroy (Last created special effect)
                              • Custom script: set udg_E2_x1 = GetUnitX(udg_E2_Source[udg_E2_Current])
                              • Custom script: set udg_E2_y1 = GetUnitY(udg_E2_Source[udg_E2_Current])
                              • Custom script: set udg_E2_x2 = GetUnitX(udg_E2_Enemy[udg_E2_Current])
                              • Custom script: set udg_E2_y2 = GetUnitY(udg_E2_Enemy[udg_E2_Current])
                              • Set Point2 = (Position of E2_Enemy[E2_Current])
                              • Lightning - Create a E0_LightningType lightning effect from source Point1 to target Point2
                              • Set E2_Lightning[E2_Current] = (Last created lightning effect)
                              • Custom script: call MoveLightningEx(udg_E2_Lightning[udg_E2_Current], true, udg_E2_x1, udg_E2_y1, GetLocationZ(udg_Point1) + udg_E0_ProjectileImpactZ, udg_E2_x2, udg_E2_y2, GetLocationZ(udg_Point2) + GetUnitFlyHeight(udg_E2_Enemy[udg_E2_Current]) + 45.)
                              • Custom script: call RemoveLocation(udg_Point2)
                            • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • E0_DestroyTree Equal to True
                        • Then - Actions
                          • Destructible - Pick every destructible within E1_AoE[E1_Current] of Point1 and do (Actions)
                            • Loop - Actions
                              • Custom script: if GetWidgetLife( GetEnumDestructable() ) > 0.405 then
                              • Unit - Order E0_TreeChecker to Harvest (Picked destructible)
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Current order of E0_TreeChecker) Equal to (Order(harvest))
                                • Then - Actions
                                  • Destructible - Kill (Picked destructible)
                                • Else - Actions
                              • Unit - Order E0_TreeChecker to Stop
                              • Custom script: endif
                        • Else - Actions
                      • Special Effect - Destroy E1_SFX_Chest[E1_Current]
                      • Special Effect - Create a special effect attached to the origin of E1_Dummy[E1_Current] using E0_S_Chest_Alternative
                      • Set E1_SFX_Chest[E1_Current] = (Last created special effect)
                      • Animation - Change E1_Dummy[E1_Current] flying height to E0_ProjectileImpactZ at 0.00
                      • Special Effect - Create a special effect attached to the origin of E1_Dummy[E1_Current] using E0_S_Impact
                      • Special Effect - Destroy (Last created special effect)
                      • Custom script: call RemoveLocation(udg_Point1)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • E1_Duration[E1_Current] Greater than 0.00
                    • Then - Actions
                      • Set E1_Duration[E1_Current] = (E1_Duration[E1_Current] - 0.03)
                    • Else - Actions
                      • Special Effect - Destroy E1_SFX_Chest[E1_Current]
                      • Special Effect - Destroy E1_SFX_Origin[E1_Current]
                      • Unit - Add a 2.00 second Generic expiration timer to E1_Dummy[E1_Current]
                      • Set E1_Index_Itself[E1_Loop] = E1_Index_Itself[E1_Index_Size]
                      • Set E1_Index_Itself[E1_Index_Size] = E1_Current
                      • Set E1_Index_Size = (E1_Index_Size - 1)
                      • Set E1_Loop = (E1_Loop - 1)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • E1_Index_Size Equal to 0
                        • Then - Actions
                          • Trigger - Turn off (This trigger)
                          • Skip remaining actions
                        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • E2_Allow Equal to True
        • Then - Actions
          • For each (Integer E2_Loop) from 1 to E2_Index_Size, do (Actions)
            • Loop - Actions
              • Set E2_Current = E2_Index_Itself[E2_Loop]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • E2_Duration[E2_Current] Greater than 0.00
                • Then - Actions
                  • Set E2_Duration[E2_Current] = (E2_Duration[E2_Current] - 0.03)
                  • Custom script: set udg_E2_Angle = Atan2(GetUnitY(udg_E2_Source[udg_E2_Current]) - GetUnitY(udg_E2_Enemy[udg_E2_Current]), GetUnitX(udg_E2_Source[udg_E2_Current]) - GetUnitX(udg_E2_Enemy[udg_E2_Current]))
                  • Custom script: set udg_E2_x1 = GetUnitX(udg_E2_Enemy[udg_E2_Current])
                  • Custom script: set udg_E2_y1 = GetUnitY(udg_E2_Enemy[udg_E2_Current])
                  • Custom script: set udg_E2_x2 = udg_E2_x1 + udg_E0_Speed_Enemy * Cos(udg_E2_Angle)
                  • Custom script: set udg_E2_y2 = udg_E2_y1 + udg_E0_Speed_Enemy * Sin(udg_E2_Angle)
                  • Custom script: call SetUnitX(udg_E2_Enemy[udg_E2_Current], udg_E2_x2)
                  • Custom script: call SetUnitY(udg_E2_Enemy[udg_E2_Current], udg_E2_y2)
                  • Unit - Order E2_Enemy[E2_Current] to Stop
                  • Custom script: set udg_E2_x1 = GetUnitX(udg_E2_Source[udg_E2_Current])
                  • Custom script: set udg_E2_y1 = GetUnitY(udg_E2_Source[udg_E2_Current])
                  • Set Point1 = (Position of E2_Source[E2_Current])
                  • Set Point2 = (Position of E2_Enemy[E2_Current])
                  • Custom script: call MoveLightningEx(udg_E2_Lightning[udg_E2_Current], true, udg_E2_x1, udg_E2_y1, GetLocationZ(udg_Point1) + udg_E0_ProjectileImpactZ, udg_E2_x2, udg_E2_y2, GetLocationZ(udg_Point2) + GetUnitFlyHeight(udg_E2_Enemy[udg_E2_Current]) + 45.)
                  • Custom script: call RemoveLocation(udg_Point1)
                  • Custom script: call RemoveLocation(udg_Point2)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (E2_Enemy[E2_Current] is dead) Equal to True
                    • Then - Actions
                      • Set E2_Duration[E2_Current] = 0.00
                    • Else - Actions
                • Else - Actions
                  • Special Effect - Destroy E2_SFX_Enemy[E2_Current]
                  • Lightning - Destroy E2_Lightning[E2_Current]
                  • Set E2_Index_Itself[E2_Loop] = E2_Index_Itself[E2_Index_Size]
                  • Set E2_Index_Itself[E2_Index_Size] = E2_Current
                  • Set E2_Index_Size = (E2_Index_Size - 1)
                  • Set E2_Loop = (E2_Loop - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • E2_Index_Size Equal to 0
                    • Then - Actions
                      • Set E2_Allow = False
                      • Skip remaining actions
                    • Else - Actions
        • Else - Actions


v1e:
- Projectile and Pull triggers are now merged into only one. (Loop)
- Now, AoE is stored into a variable when an unit casts the spell.
v1d:
- Fixed DamageDelay Var, where the spell could not work properly if delay > duration.
- Fixed dummy units giving vision.
- Dummy model should now change in the correct time.
- Removed useless IF and some variables.
- Moved some actions from Pull trigger to Projectile trigger.
v1c:
- Renamed two variables:
E0_MinHeight to E0_ProjectileImpactZ;
E0_MaxHeight to E0_ProjectileMaximumZ.
- Added one more variable: E0_ProjectileLaunchZ.
- Improved "How to import", It wasn't clarifying the need to create some variables manually.
- Improved E1_Speed[]. Previously was returning an imprecise value.
v1b:
- When the dummy reaches its maximum height, It will fall down according to the DamageDelayVar.
- Now targets and dummies are moved using coordinates (SetUnitXY).
- Removed a Leak.
v1a:
- Removed Preload Ability
v1:
- Uploaded


WILL THE ALMIGHTY - EMP Bomb
PeeKay - Lightning Sphere
Thrikodius - Zap Missile
Hanky - Dynamic Indexing System
Paladon - Flying height Method
Magtheridon96 and Tank-Commander - For their feedback.


There's Documentation and you can see it in the trigger editor. Btw, I still learning english and, yeah, you know...

Keywords:
Lightning, Missile, Projectile, Electrify, Zap, Target-Ground, GUI, dadadadaboomdoonnndo
Contents

Electrify v1e (Map)

Reviews
19:33, 16th Jul 2012 Magtheridon96: Status: Approved. The configuration is exceptional. The spell is also quite original. The indexing method is fine. You need to merge the periodic triggers. Just take the code of the second one and put...

Moderator

M

Moderator

19:33, 16th Jul 2012
Magtheridon96:

Status: Approved.

The configuration is exceptional.
The spell is also quite original.
The indexing method is fine.

You need to merge the periodic triggers. Just take the code
of the second one and put it below the code of the first one.

edit
Another thing I would recommend is caching the AoE into a variable
so you don't have to recalculate it each time you do one iteration of
the spell.


edit
Excellent work.
 
Level 13
Joined
May 10, 2009
Messages
868
Those loops triggers might as well be one trigger as opposed to two, also what's the purpose of the dummy which is created in the preload section?

I've made 2 triggers, because I thought they could "lag" the game if both of them were in same trigger. And about the dummy part: When you learn a spell for the first time, it might cause little lag. So, I did that to "remove" the lag. If it is useless, tell me, so I can remove it.
 
Top