Energy Matrix V1.11

Wanted to play around with lightning effects so I made this

Energy Matrix:
Tooltip:
Generates (2 + (1 * level of ability)) Energy Cores which spin around the caster absorbing (9 x level of ability) health per second from nearby units and converting the health into (1.35 x level of ability) mana per second, has up to (10 + (5 * level of ability)) targets. Lasts (3 + (2 * level of ability)) seconds and has a cooldown of 12 seconds.


- Heavily Configurable
- Aoe Draining spell
- Eye candy (lightning yay)
- Goes well with my other "Energy" spells



  • Energy Matrix Configuration
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Do not touch --------
      • Hashtable - Create a hashtable
      • Set EM_Hash = (Last created hashtable)
      • -------- -------- --------
      • -------- Determines the area which the Energy Cores will drain from --------
      • Set EM_CoreAoeBase = 200.00
      • Set EM_CoreAoePerLevel = 50.00
      • -------- Determines how far out from the hero the Cores will be --------
      • Set EM_CoreDistanceBase = 300.00
      • Set EM_CoreDistancePerLevel = 0.00
      • -------- Determines how long the Cores will last for --------
      • Set EM_DurationBase = 2.00
      • Set EM_DurationPerLevel = 3.00
      • -------- Detmines the flying height of the cores --------
      • Set EM_FlyHeight = 200.00
      • -------- Determines how much health will be drained from a unit being effected by the spell --------
      • Set EM_HealthDrainBase = 0.00
      • Set EM_HealthDrainPerLevel = 0.15
      • -------- The higher section of the lightning (up to the core) should be 75 above the fly height of the cores (if standard model is being used) --------
      • Set EM_LightningHighHeight = 275.00
      • -------- Flying height of the low points (the targets and the caster) --------
      • Set EM_LightningLowHeight = 75.00
      • -------- Determines the conversion rate of health into mana --------
      • Set EM_ManaConversionBase = 0.00
      • Set EM_ManaConversionPerLevel = 0.15
      • -------- Determines the number of cores created --------
      • Set EM_SidesBase = 2
      • Set EM_SidesPerLevel = 1
      • -------- Determines the max amount of targets for the spell --------
      • Set EM_MaxTargetsBase = 10
      • Set EM_MaxTargetsPerLevel = 5
      • -------- Determines how fast the Cores will revolve --------
      • Set EM_SpinSpeed = 5.00
      • -------- Unit used to create the Matrix --------
      • Set EM_CoreUnit = Energy Core
      • -------- Spell used to activate the triggers and create the matrix --------
      • Set EM_Spell = Energy Matrix
      • -------- SFX used on creation/death of the matrix --------
      • Set EM_SFX = Abilities\Spells\Items\AIre\AIreTarget.mdl
      • -------- Lightning effect used to link the caster and the matrix --------
      • -------- Standard is DRAM = Drain mana --------
      • Set EM_Lightning = DRAM
      • -------- Lightning effect used to link the targets and the matrix --------
      • -------- Standard is DRAL = Drain life --------
      • Set EM_Lightning2 = DRAL
      • -------- Go into the object editor and press Ctrl + D for raw data on things such as chain lightning over lightning effects to find the Code for it --------
      • -------- Pressing CTRL + D again will reset the data to the normal view --------
      • -------- -------- --------
  • Energy Matrix Activation
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to EM_Spell
    • Actions
      • Set EM_U = (Triggering unit)
      • Set EM_TempPoint = (Position of EM_U)
      • Set EM_TempRealStore = (Real((Level of EM_Spell for EM_U)))
      • For each (Integer EM_I) from 1 to (EM_SidesBase + (EM_SidesPerLevel x (Level of EM_Spell for EM_U))), do (Actions)
        • Loop - Actions
          • Set EM_Angle = (EM_Angle + (360.00 / ((Real(EM_SidesBase)) + ((Real(EM_SidesPerLevel)) x EM_TempRealStore))))
          • Set EM_TempRealStore2 = (EM_CoreDistanceBase + (EM_CoreDistancePerLevel x EM_TempRealStore))
          • Set EM_TempPoint2 = (EM_TempPoint offset by EM_TempRealStore2 towards EM_Angle degrees)
          • Unit - Create 1 EM_CoreUnit for (Owner of EM_U) at EM_TempPoint2 facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_EM_TempPoint2)
          • Set EM_TempU = (Last created unit)
          • Special Effect - Create a special effect attached to the origin of EM_TempU using EM_SFX
          • Special Effect - Destroy (Last created special effect)
          • Custom script: set udg_EM_UHandle = GetHandleId(udg_EM_TempU)
          • Animation - Change EM_TempU flying height to EM_FlyHeight at 0.00
          • Unit Group - Add EM_TempU to EM_Cores
          • Unit - Change color of EM_TempU to (Color of Neutral Hostile)
          • Unit - Add a (EM_DurationBase + (EM_DurationPerLevel x EM_TempRealStore)) second Generic expiration timer to EM_TempU
          • Hashtable - Save Handle OfEM_U as 1 of EM_UHandle in EM_Hash
          • Hashtable - Save (EM_CoreAoeBase + (EM_CoreAoePerLevel x EM_TempRealStore)) as 2 of EM_UHandle in EM_Hash
          • Hashtable - Save (EM_HealthDrainBase + (EM_HealthDrainPerLevel x EM_TempRealStore)) as 3 of EM_UHandle in EM_Hash
          • Hashtable - Save (EM_ManaConversionBase + (EM_ManaConversionPerLevel x EM_TempRealStore)) as 4 of EM_UHandle in EM_Hash
          • Hashtable - Save EM_Angle as 6 of EM_UHandle in EM_Hash
          • Hashtable - Save EM_TempRealStore2 as 7 of EM_UHandle in EM_Hash
          • Hashtable - Save (EM_MaxTargetsBase + (EM_MaxTargetsPerLevel x (Level of Energy Matrix for EM_U))) as 10 of EM_UHandle in EM_Hash
      • Trigger - Turn on Energy Matrix Loop <gen>
      • Trigger - Turn on Energy Matrix End <gen>
      • Custom script: call RemoveLocation (udg_EM_TempPoint)
  • Energy Matrix End
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to EM_CoreUnit
    • Actions
      • Set EM_U = (Triggering unit)
      • Custom script: set udg_EM_UHandle = GetHandleId(udg_EM_U)
      • Lightning - Destroy (Load 8 of EM_UHandle in EM_Hash)
      • For each (Integer EM_I) from 11 to (Load 0 of EM_UHandle from EM_Hash), do (Actions)
        • Loop - Actions
          • Lightning - Destroy (Load EM_I of EM_UHandle in EM_Hash)
      • Special Effect - Create a special effect attached to the origin of EM_U using EM_SFX
      • Special Effect - Destroy (Last created special effect)
      • Hashtable - Clear all child hashtables of child EM_UHandle in EM_Hash
      • Unit Group - Remove EM_U from EM_Cores
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (EM_Cores is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off Energy Matrix Loop <gen>
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • Energy Matrix Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in EM_Cores and do (Actions)
        • Loop - Actions
          • Set EM_U = (Picked unit)
          • Custom script: set udg_EM_UHandle = GetHandleId(udg_EM_U)
          • Lightning - Destroy (Load 8 of EM_UHandle in EM_Hash)
          • For each (Integer EM_I) from 11 to (Load 0 of EM_UHandle from EM_Hash), do (Actions)
            • Loop - Actions
              • Lightning - Destroy (Load EM_I of EM_UHandle in EM_Hash)
          • Set EM_TempPoint = (Position of (Load 1 of EM_UHandle in EM_Hash))
          • Set EM_Angle = ((Load 6 of EM_UHandle from EM_Hash) + EM_SpinSpeed)
          • Set EM_TempRealStore = (Load 7 of EM_UHandle from EM_Hash)
          • Hashtable - Save EM_Angle as 6 of EM_UHandle in EM_Hash
          • Custom script: call SetUnitX(udg_EM_U, GetLocationX(udg_EM_TempPoint) + udg_EM_TempRealStore * Cos(udg_EM_Angle * bj_DEGTORAD))
          • Custom script: call SetUnitY(udg_EM_U, GetLocationY(udg_EM_TempPoint) + udg_EM_TempRealStore * Sin(udg_EM_Angle * bj_DEGTORAD))
          • Set EM_TempPoint2 = (Position of EM_U)
          • Custom script: set udg_EM_TempZ = GetLocationZ(udg_EM_TempPoint) + udg_EM_LightningLowHeightCaster
          • Custom script: set udg_EM_TempZ2 = GetLocationZ(udg_EM_TempPoint2) + udg_EM_LightningHighHeight
          • Custom script: set udg_EM_TempLightning = AddLightningEx(udg_EM_Lightning, true, GetLocationX(udg_EM_TempPoint), GetLocationY(udg_EM_TempPoint), udg_EM_TempZ, GetLocationX(udg_EM_TempPoint2), GetLocationY(udg_EM_TempPoint2), udg_EM_TempZ2)
          • Hashtable - Save Handle OfEM_TempLightning as 8 of EM_UHandle in EM_Hash
          • Custom script: call RemoveLocation (udg_EM_TempPoint)
          • Set EM_LightningCounter = 10
          • Set EM_TempGroup = (Units within (Load 2 of EM_UHandle from EM_Hash) of EM_TempPoint2)
          • Unit Group - Pick every unit in EM_TempGroup and do (Actions)
            • Loop - Actions
              • Set EM_TempU = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (EM_TempU is Magic Immune) Equal to False
                  • ((Unit-type of EM_TempU) is A structure) Equal to False
                  • (EM_TempU is A ground unit) Equal to True
                  • (EM_TempU is alive) Equal to True
                  • (EM_TempU belongs to an enemy of (Owner of EM_U)) Equal to True
                  • EM_LightningCounter Less than ((Load 10 of EM_UHandle from EM_Hash) + 10)
                • Then - Actions
                  • Set EM_LightningCounter = (EM_LightningCounter + 1)
                  • Set EM_TempPoint = (Position of EM_TempU)
                  • Custom script: set udg_EM_TempZ = GetLocationZ(udg_EM_TempPoint) + udg_EM_LightningLowHeightTarget
                  • Custom script: set udg_EM_TempLightning = AddLightningEx(udg_EM_Lightning2, true, GetLocationX(udg_EM_TempPoint), GetLocationY(udg_EM_TempPoint), udg_EM_TempZ, GetLocationX(udg_EM_TempPoint2), GetLocationY(udg_EM_TempPoint2), udg_EM_TempZ2)
                  • Hashtable - Save Handle OfEM_TempLightning as EM_LightningCounter of EM_UHandle in EM_Hash
                  • Custom script: call RemoveLocation (udg_EM_TempPoint)
                  • Unit - Cause (Load 1 of EM_UHandle in EM_Hash) to damage EM_TempU, dealing (Load 3 of EM_UHandle from EM_Hash) damage of attack type Spells and damage type Normal
                  • Unit - Set mana of (Load 1 of EM_UHandle in EM_Hash) to ((Mana of (Load 1 of EM_UHandle in EM_Hash)) + ((Load 3 of EM_UHandle from EM_Hash) x (Load 4 of EM_UHandle from EM_Hash)))
                • Else - Actions
          • Custom script: call DestroyGroup(udg_EM_TempGroup)
          • Hashtable - Save EM_LightningCounter as 0 of EM_UHandle in EM_Hash
          • Custom script: call RemoveLocation (udg_EM_TempPoint2)



-=V1.00=-
- Initial Upload
- Expect errors (yay)
-=V1.10=-
- Corrected Unit Group Leak
- Modified lightning to account for raised terrain
- Moved Turning on Triggers out of loop
- Used Ability Variable for the for loop in Activation
-=V1.11=-
- Made Lightning Low heights independant (requested by Kam)
- Changed condition for turning off the ending trigger (as per Bribe)


This spell is a continuation of my One-Spell-A-Day self-set challenge (Day 4)

Give credits if you use this spell.

Enjoy

Keywords:
Energy, Matrix, Construct, Drain, Health, Mana, AOE, Magic, Spell, Spinning, Lightning, Effects.
Contents

Energy Matrix (Map)

Reviews
21st Dec 2011 Bribe: "(Number of units in EM_Cores) Equal to 0" can use the "group is empty" function instead. This looks quite interesting and it gives some ideas as well. 4/5 (Recommended). You're not using the ability variable in the...

Moderator

M

Moderator

21st Dec 2011
Bribe: "(Number of units in EM_Cores) Equal to 0" can use the "group is empty" function instead.

This looks quite interesting and it gives some ideas as well. 4/5 (Recommended).


Maker, Energy Matrix V1.00, 19th Dec 2011

  • You're not using the ability variable in the activation trigger, in the for loop declaration
  • Move turn on trigger actions out of the for loop
  • Lightnings appear at incorrect height if the groud level is altered.Use the raise tool and test it. You need to use GetLocationZ when you move and create the lightnings
  • Loop trigger leaks TempGroup
  • I'd like to see better tooltip description, but you don't have to change it. "Generates (2 + (1 * level of ability))..." looks bad
 
Level 7
Joined
Sep 2, 2011
Messages
349
Judging by the screenshot, I can already tell that you had a hard time creating this spell. Good job.
 
Top