1. Are you planning to upload your awesome pack to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  5. Dismiss Notice
  6. The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Unreasonable Chaos Spellpack

Submitted by Tank-Commander
This bundle is marked as approved. It works and satisfies the submission rules.
This is a pack containing my favourite works I have completed over my time being here on the hive, these were either fun to create for me, or ones I really loved the effect of, and I hope you will enjoy them as much as I have.
I have decided to include quite a few details on these spells, including the full trigger list, and tooltips for each of them.
FULL SPELL LIST
- Arcane Drain
- Beserk Plant
- Chaos Portal
- Energy Glyph
- Energy Matrix
- Explosive Toxic Gas
- Helios Collision
- Magnetised Energy Bombs
- Sentry Rocks
- Soul Tether
- Spirit Scorpions
- Volcanic Crush
- Weeds
- Wild Energy


Tooltips & Screenshots

TOOLTIPS

Screenshot
[​IMG]
[c]Arcane Drain[c]Disperses draining fields randomly in the general direction of the target area, draining fields will absorb life and mana from the target and return the health and mana to the caster. The form the spell takes depends on its level.

Level 1 - Drains 25 health and 12 mana per second.
Level 2 - Drains 30 health and 15 mana per second.
Level 3 - Drains 35 health and 17 mana per second.
[r]
Screenshot
[​IMG]
[c]Beserk Plant[c]Learn: Throws a small plant at the target point. Being thrown causes the plant to be unfathomably enraged and it takes it anger out by attacking nearby enemies dealing damage every hit and knocking them back away from the plant.

Level 1: Throws a small plant at the target point. Being thrown causes the plant to be unfathomably enraged and it takes it anger out by attacking enemies within a 400 range dealing 45 damage every hit and knocking them back away from the plant.

Level 2: Throws a small plant at the target point. Being thrown causes the plant to be unfathomably enraged and it takes it anger out by attacking enemies within a 500 range dealing 70 damage every hit and knocking them back away from the plant.

Level 3: Throws a small plant at the target point. Being thrown causes the plant to be unfathomably enraged and it takes it anger out by attacking enemies within a 600 range dealing 85 damage every hit and knocking them back away from the plant.
[r]
Screenshot
[​IMG]
[c]Chaos Portal[c]Creates a portal at the target point which will trap nearby units within it's effect radius and push and pull them around the cage tearing them apart dealing damage and repelling units trying to enter the cage away from it.

Level 1 - 325 AOE, 15 Damage per hit 5 Pulses, Weak knockback
Level 2 - 425 AOE, 20 Damage per hit, 7 Pulses, Medium knockback
Level 3 - 525 AOE, 25 Damage per hit, 9 Pulses, Strong knockback
[r]
Screenshot
[​IMG]
[c]Energy Glyph[c]
Creates a Glyph on the floor which will drain the mana from all units (including allies) and then will release orbs of pure energy onto the surrounding area dealing damage (amount of orbs is based on how much mana was drained/level of ability. It can also drain the remaining energy found within dead corpses of units. All units in the area due to the draining effect have their speed reduced by 50%

Spell drains up to 400 mana (drain is spread evenly on all effected units)
[r]
Screenshot
[​IMG]
[c]Energy Matrix[c]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.[r]
Screenshot
[​IMG]
[c]Explosive Toxic Gas[c]Toxic Gas:
Spews Gas onto the target area and spreads out randomly from the target point which poisons Organic units and rusts Mechanicals, dealing damage every second, if the gas is ignited it will explode dealing extra damage and setting nearby units on fire.

Level 1 - 4 Directions, Short expansion, weak poison, weak explosion
Level 2 - 6 Directions, Medium expansion, medium poison, medium explosion
Level 3 - 8 Directions, Long expansion, Strong poison, Fatal explosion

Volanic Rock:
Throws a volcanic rock at the target area dealing damage and setting nearby units on fire dealing damage over a short time also ignites toxic gas

Level 1 - Weak damage, Small explosion, 1st degree burn
Level 2 - Medium damage, Medium explosion, 2nd Degree Burn
Level 3 - Heavy Damage, Large explosion, 3rd Degree Burn
[r]
Screenshot
[​IMG]
[c]Helios Collision[c]The power of Helios forms infront of the caster generating a micro-sun which will travel slowly toward the target point, The sun drags enemies into it, upon reaching its destination the sun explodes dealing damage and throwing the enemy units back

Level 1 - Weak Drag, 225 Damage
Level 2 - Medium Drag, 250 Damage
Level 3 - Strong Drag, 275 Damage
[r]
Screenshot
[​IMG]
[c]Magnetised Energy Bombs[c]Learn: Creates Magnetised Energy Bombs which orbit the caster, which leave a trail of fire and pull nearby units into them damaging them until they explode, knocking back all enemies caught within them. Dealing an additional 75 damage if the units collide into a rock. Also deals further mana damage with a feedback effect.

Level 1: Creates 2 Magnetised Energy Bombs which orbit the caster, which leave a trail of fire and pull nearby units into them damaging them dealing 12 damage per second until they explode dealing 150 damage and knocking back all enemies caught within them. Dealing an additional 75 damage if the units collide into a rock. Also deals a further 75 mana damage, which has a feedback effect dealing an additional 75 damage.

Level 2: Creates 3 Magnetised Energy Bombs which orbit the caster, which leave a trail of fire and pull nearby units into them damaging them dealing 24 damage per second until they explode dealing 200 damage and knocking back all enemies caught within them. Dealing an additional 75 damage if the units collide into a rock. Also deals a further 100 mana damage, which has a feedback effect dealing an additional 125 damage.

Level 3: Creates 4 Magnetised Energy Bombs which orbit the caster, which leave a trail of fire and pull nearby units into them damaging them dealing 36 damage per second until they explode dealing 250 damage and knocking back all enemies caught within them. Dealing an additional 75 damage if the units collide into a rock. Also deals a further 150 mana damage, which has a feedback effect dealing an additional 225 damage.
[r]
Screenshot
[​IMG]
[c]Sentry Rocks[c]Learn:Creates pairs of rocks which orbit eachother and the caster, they will seek out enemies which come within a given radius of the rocks and fall on them dealing damage. Rocks last a few seconds

Level 1: Creates 4 pairs of rocks which orbit eachother and the caster, they will seek out enemies which come within a 300 radius of the rocks and fall on them dealing 200 damage each. Rocks last 7 seconds

Level 2: Creates 5 pairs of rocks which orbit eachother and the caster, they will seek out enemies which come within a 400 radius of the rocks and fall on them dealing 250 damage each. Rocks last 9 seconds

Level 3: Creates 6 pairs of rocks which orbit eachother and the caster, they will seek out enemies which come within a 400 radius of the rocks and fall on them dealing 300 damage each. Rocks last 11 seconds
[r]
Screenshot
[​IMG]
[c]Soul Tether[c]Summons a Soul Tether at the target point. The Soul Tether will take hold of enemy units' souls when they become weak, restoring their power and giving control to the caster, however as a penalty they must remain close to the Tether to sustain themselves, and will die without it. The Tether can sustain their lives for a short time.

Level 1 - 250 AOE, 15 second duration, sustains for 7.5 seconds
Level 2 - 300 AOE, 20 second duration, sustains for 10 seconds
Level 3 - 350 AOE, 25 second duration, sustains for 12.5 seconds
[r]
Screenshot
[​IMG]
[c]Spirit Scorpions[c]Throws a volley of spiritual Scorpion eggs randomly onto the target area, the scorpions then hatch and chase down nearby enemies and lay a curse upon them which will deal damage as well as freeze them temporarily.

Level 1 - 8 Eggs, 75 damage, 6 second stun, 1 hit, 250 search range
Level 2 - 10 Eggs, 100 damage, 8 second stun, 2 hits, 300 search range
Level 3 - 12 Eggs, 125 damage, 10 second stun, 3 hits, 350 search range
[r]
Screenshot
[​IMG]
[c]Volcanic Crush[c]Summons 5 Flaming rocks which mark a target for a volcanic energy bomb. The bomb will grow to a critical mass, and then fall onto the location of the target. Can target both enemy and friendly targets, though only damages enemies.

Level 1 - Deals 340 damage at full size.
Level 2 - Deals 380 damage at full size.
Level 3 - Deals 420 damage at full size.
[r]
Screenshot
[​IMG]
[c]Weeds[c]Learn: Creates seeds which will absorb enemy's hitpoints to grow bigger, upon reaching full size the plant will start attacking a specfic enemy dealing heavy damage to that particular targets.
Level 1: 4 Seeds, 7 Seconds duration, 120 drain damage per second, 300 AOE.
Level 2: 5 Seeds, 9 Seconds duration, 150 drain damage per second, 400 AOE.
Level 3: 6 Seeds, 11 Seconds duration, 180 drain damage per second, 500 AOE.

Level 1: Creates seeds which will absorb enemy's hitpoints to grow bigger, upon reaching full size the plant will start attacking a specfic enemy dealing heavy damage to that particular targets.
Level 1: 4 Seeds, 7 Seconds duration, 120 drain damage per second, 300 AOE.

Level 2: Creates seeds which will absorb enemy's hitpoints to grow bigger, upon reaching full size the plant will start attacking a specfic enemy dealing heavy damage to that particular targets.
Level 2: 5 Seeds, 9 Seconds duration, 150 drain damage per second, 400 AOE.

Level 3: Creates seeds which will absorb enemy's hitpoints to grow bigger, upon reaching full size the plant will start attacking a specfic enemy dealing heavy damage to that particular targets.
Level 3: 6 Seeds, 11 Seconds duration, 180 drain damage per second, 500 AOE.
[r]
Screenshot
[​IMG]
[c]Wild Energy[c]Passive spell, Gives a chance of 20 + (20 x level of ability)% to create an orb of energy which will home in on the nearest enemy dealing (0.5 x level of ability) x (max mana - current mana) in an area of 100 + (50 x level of ability) When a spell is casted. Mana cost of spell being casted when this spell is activated is not included.




Trigger Listings

TRIGGER LISTINGS
- Arcane Drain
Configuration
  • Arcane Drain Configuration
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- -------- --------
      • -------- Determines the Parts of the spell used --------
      • -------- Launch Projectile --------
      • Set AD_Conditions[0] = True
      • -------- Drain Health --------
      • Set AD_Conditions[1] = True
      • -------- Drain Health Projectile --------
      • Set AD_Conditions[2] = True
      • -------- Drain Mana --------
      • Set AD_Conditions[3] = True
      • -------- Drain Mana Projectile --------
      • Set AD_Conditions[4] = True
      • -------- ProjectileSpeed/Incoming Time --------
      • Set AD_Conditions[5] = False
      • -------- Cycle Themes --------
      • Set AD_Conditions[6] = False
      • -------- If cycle themes is set to False, this determines which Theme will be used --------
      • Set AD_DefaultTheme = 1
      • Set AD_SpellsThemeCount = 3
      • -------- Determines the targets available for the spell --------
      • -------- Target is alive --------
      • Set AD_Conditions[7] = True
      • -------- Target is Magic Immune --------
      • Set AD_Conditions[8] = False
      • -------- Target is Structure --------
      • Set AD_Conditions[9] = False
      • -------- Target is Ground unit --------
      • Set AD_Conditions[10] = True
      • -------- Target is Belongs to an enemy --------
      • Set AD_Conditions[11] = True
      • -------- Full Mana Drain --------
      • Set AD_Conditions[12] = True
      • -------- Other conditions --------
      • -------- Healing SFX --------
      • Set AD_Conditions[13] = True
      • -------- Mana SFX --------
      • Set AD_Conditions[14] = True
      • -------- Drain Mana SFX --------
      • Set AD_Conditions[15] = True
      • -------- Drain Health SFX --------
      • Set AD_Conditions[16] = True
      • -------- Randomise Theme --------
      • Set AD_Conditions[17] = True
      • -------- Controls amount of SFX --------
      • Set AD_SFXWaitTime = 15.00
      • -------- Controls the minimum spread out distance of the drain areas --------
      • Set AD_MinDistanceSpread = 90.00
      • Set AD_RecieveSFXLimiter = 3
      • -------- Determines the Projectile Movement --------
      • -------- Launch Projectile --------
      • Set AD_LaunchArcMultiplyerBase = 0.30
      • Set AD_LaunchArcMultiplyerPL = 0.00
      • Set AD_LaunchSpeedBase = 4.00
      • Set AD_LaunchSpeedPerLevel = 1.00
      • Set AD_LaunchIncomingTimeBase = 2.50
      • Set AD_LaunchIncomingTimePerLevel = -0.50
      • -------- Heal Projectile --------
      • Set AD_HealthArcMultiplyerBase = 0.45
      • Set AD_HealthArcMultiplyerPL = 0.00
      • Set AD_HealSpeedBase = 5.00
      • Set AD_HealSpeedPerLevel = 0.00
      • Set AD_HealthIncomingTimeBase = 2.00
      • Set AD_HealthIncomingTimePerLevel = -0.25
      • -------- Mana Projectile --------
      • Set AD_ManaArcMultiplyerBase = 0.50
      • Set AD_ManaArcMultiplyerPL = 0.00
      • Set AD_ManaSpeedBase = 5.00
      • Set AD_ManaSpeedPerLevel = 0.00
      • Set AD_ManaIncomingTimeBase = 2.00
      • Set AD_ManaIncomingTimePerLevel = -0.25
      • -------- Determines the area that the Drain Areas will scatter across --------
      • Set AD_AoeBase = 200.00
      • Set AD_AoePerLevel = 50.00
      • -------- Determines how much space each Drain Area covers --------
      • Set AD_DrainAreaAOEBase = 120.00
      • Set AD_DrainAreaAOEPerLevel = 0.00
      • -------- Determines the amount of Drain areas created --------
      • Set AD_DrainAreaCountBase = 4
      • Set AD_DrainAreaCountPerLevel = 2
      • -------- Determines how much Health damage a unit takes per second --------
      • Set AD_HealthDamagePerSecBase = 20.00
      • Set AD_HealthDamagePerSecPerLevel = 5.00
      • -------- Determines how much Mana damage a unit takes per second --------
      • Set AD_ManaDamagePerSecBase = 10.00
      • Set AD_ManaDamagePerSecPerLevel = 2.50
      • -------- Determines how long the drain area will last (seconds) --------
      • -------- When changing this, remember to modify the object data spell and increase the "follow through time" to these values +2 or 3 seconds (depending on method of movement) --------
      • -------- Otherwise the spell will end early --------
      • Set AD_DrainAreaDurationBase = 2.00
      • Set AD_DrainAreaDurationPerLevel = 3.00
      • -------- Determines the scaling of the SFX --------
      • -------- Determines the scaling of the Launch Projectiles --------
      • Set AD_EffectScalingLaunchBase = 100.00
      • Set AD_EffectScalingLaunchPL = 0.00
      • -------- Determines the scaling of the Drain Areas --------
      • Set AD_EffectScalingDrainAreaBase = 80.00
      • Set AD_EffectScalingDrainAreaPL = 0.00
      • -------- Determines the scaling of the Drained Health Projectiles --------
      • Set AD_EffectScalingHealthBase = 50.00
      • Set AD_EffectScalingHealthPL = 0.00
      • -------- Determines the scaling of the Drained Mana Projectiles --------
      • Set AD_EffectScalingManaBase = 50.00
      • Set AD_EffectScalingManaPL = 0.00
      • -------- Determines the unit model used as the Drain Area --------
      • Set AD_DrainAreaSFX[1] = Abilities\Spells\Other\Drain\ManaDrainTarget.mdl
      • Set AD_DrainAreaSFX[2] = Abilities\Spells\Orc\LiquidFire\Liquidfire.mdl
      • Set AD_DrainAreaSFX[3] = Abilities\Spells\NightElf\EntanglingRoots\EntanglingRootsTarget.mdl
      • -------- Determines the SFX used as the Launch Projectile --------
      • Set AD_LaunchSFX[1] = Abilities\Weapons\FrostWyrmMissile\FrostWyrmMissile.mdl
      • Set AD_LaunchSFX[2] = Abilities\Weapons\RedDragonBreath\RedDragonMissile.mdl
      • Set AD_LaunchSFX[3] = Abilities\Weapons\GreenDragonMissile\GreenDragonMissile.mdl
      • -------- Determines the SFX used as the Drained Health Projectile --------
      • Set AD_HealthDrainSFX[1] = Abilities\Weapons\ZigguratMissile\ZigguratMissile.mdl
      • Set AD_HealthDrainSFX[2] = Abilities\Weapons\PhoenixMissile\Phoenix_Missile.mdl
      • Set AD_HealthDrainSFX[3] = Abilities\Weapons\IllidanMissile\IllidanMissile.mdl
      • -------- Determines the unit model used as the Drained Mana Projectile --------
      • Set AD_ManaDrainSFX[1] = Abilities\Weapons\FarseerMissile\FarseerMissile.mdl
      • Set AD_ManaDrainSFX[2] = Abilities\Weapons\LavaSpawnMissile\LavaSpawnMissile.mdl
      • Set AD_ManaDrainSFX[3] = Units\Human\HeroBloodElf\BloodElfBall.mdl
      • -------- Determines the unit model used as the Healing effect --------
      • Set AD_HealedLifeSFX[1] = Abilities\Spells\Items\ResourceItems\ResourceEffectTarget.mdl
      • Set AD_HealedLifeSFX[2] = Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
      • Set AD_HealedLifeSFX[3] = Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
      • -------- Determines the unit model used as the Healing effect for mana --------
      • Set AD_HealedManaSFX[1] = Abilities\Spells\Undead\FrostArmor\FrostArmorDamage.mdl
      • Set AD_HealedManaSFX[2] = Abilities\Spells\Other\Incinerate\FireLordDeathExplode.mdl
      • Set AD_HealedManaSFX[3] = Abilities\Spells\Undead\Sleep\SleepSpecialArt.mdl
      • -------- Determines the unit model used as the Drained effect --------
      • Set AD_DrainedHealthSFX[1] = Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
      • Set AD_DrainedHealthSFX[2] = Abilities\Spells\Other\Incinerate\IncinerateBuff.mdl
      • Set AD_DrainedHealthSFX[3] = Abilities\Spells\NightElf\Immolation\ImmolationDamage.mdl
      • -------- Determines the unit model used as the Drained effect for mana --------
      • Set AD_DrainedManaSFX[1] = Abilities\Spells\Items\SpellShieldAmulet\SpellShieldCaster.mdl
      • Set AD_DrainedManaSFX[2] = Abilities\Spells\Other\Incinerate\FireLordDeathExplode.mdl
      • Set AD_DrainedManaSFX[3] = Abilities\Spells\Undead\CarrionSwarm\CarrionSwarmDamage.mdl
      • -------- Determines the unit model used as the effect for ending the spell --------
      • Set AD_EndSFX[1] = Abilities\Spells\Human\DispelMagic\DispelMagicTarget.mdl
      • Set AD_EndSFX[2] = Abilities\Spells\Other\Incinerate\FireLordDeathExplode.mdl
      • Set AD_EndSFX[3] = Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
      • -------- Determines the unit model use when the effect is cancelled early --------
      • Set AD_CancelledSFX[1] = Abilities\Spells\Human\DispelMagic\DispelMagicTarget.mdl
      • Set AD_CancelledSFX[2] = Abilities\Spells\Other\Incinerate\FireLordDeathExplode.mdl
      • Set AD_CancelledSFX[3] = Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
      • -------- Determines the ability used as a dummy --------
      • Set AD_Spell = Arcane Drain
      • -------- Determines the order used to check that the spell is being cast (should match ability used) --------
      • Set AD_Order = channel
      • -------- Determines the Dummy used to attach all the effects to --------
      • Set AD_DummyType = Arcane Drain
      • -------- -------- --------
      • -------- Determines the Speed of the loop trigger --------
      • Set AD_TimerSpeed = 0.03
      • Trigger - Add to Arcane Drain Loop <gen> the event (Time - Every AD_TimerSpeed seconds of game time)
      • -------- -------- --------
Activation
  • Arcane Drain Activation
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to AD_Spell
    • Actions
      • Set AD_TempUnit2 = (Triggering unit)
      • Set AD_TempPlayer = (Owner of AD_TempUnit2)
      • Set AD_TempInteger2 = (Level of AD_Spell for AD_TempUnit2)
      • Set AD_TempReal = (Real(AD_TempInteger2))
      • Set AD_TempInteger = (AD_DrainAreaCountBase + (AD_DrainAreaCountPerLevel x (Integer(AD_TempReal))))
      • Set AD_TempPoint2 = (Target point of ability being cast)
      • -------- Identifies if you want the theme to change upon level up, randomly, or not at all --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AD_Conditions[17] Equal to True
        • Then - Actions
          • Set AD_TempInteger2 = (Random integer number between 1 and AD_SpellsThemeCount)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • AD_Conditions[6] Equal to False
            • Then - Actions
              • Set AD_TempInteger2 = AD_DefaultTheme
            • Else - Actions
      • -------- Runs depending on if you want starting projectiles --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AD_Conditions[0] Equal to True
        • Then - Actions
          • -------- Projectile Launch --------
          • Set AD_TempPoint = (Position of AD_TempUnit2)
          • For each (Integer AD_Index) from 1 to AD_TempInteger, do (Actions)
            • Loop - Actions
              • Set AD_MaxIndex = (AD_MaxIndex + 1)
              • Set AD_TempPoint3 = (AD_TempPoint2 offset by (Random real number between AD_MinDistanceSpread and (AD_AoeBase + (AD_AoePerLevel x AD_TempReal))) towards (Random angle) degrees)
              • Unit - Create 1 AD_DummyType for AD_TempPlayer at AD_TempPoint facing (Angle from AD_TempPoint to AD_TempPoint3) degrees
              • Set AD_TempUnit = (Last created unit)
              • Special Effect - Create a special effect attached to the origin of AD_TempUnit using AD_LaunchSFX[AD_TempInteger2]
              • Animation - Change AD_TempUnit's size to ((AD_EffectScalingLaunchBase + (AD_EffectScalingLaunchPL x AD_TempReal))%, 0.00%, 0.00%) of its original size
              • Set AD_OriginalCaster[AD_MaxIndex] = AD_TempUnit2
              • Set AD_SpecialEffect[AD_MaxIndex] = (Last created special effect)
              • Set AD_DrainAOE[AD_MaxIndex] = (AD_DrainAreaAOEBase + (AD_DrainAreaAOEPerLevel x AD_TempReal))
              • Set AD_HealthDrain[AD_MaxIndex] = (((AD_HealthDamagePerSecBase + (AD_HealthDamagePerSecPerLevel x AD_TempReal)) x AD_TimerSpeed) x AD_SFXWaitTime)
              • Set AD_ManaDrain[AD_MaxIndex] = (((AD_ManaDamagePerSecBase + (AD_ManaDamagePerSecPerLevel x AD_TempReal)) x AD_TimerSpeed) x AD_SFXWaitTime)
              • Set AD_Duration[AD_MaxIndex] = (AD_DrainAreaDurationBase + (AD_DrainAreaDurationPerLevel x AD_TempReal))
              • Set AD_AbilityLevel[AD_MaxIndex] = AD_TempReal
              • Set AD_CurrentDistance[AD_MaxIndex] = 0.00
              • Set AD_Theme[AD_MaxIndex] = AD_TempInteger2
              • Custom script: set udg_AD_CasterX[udg_AD_MaxIndex] = GetUnitX(udg_AD_TempUnit2)
              • Custom script: set udg_AD_CasterY[udg_AD_MaxIndex] = GetUnitY(udg_AD_TempUnit2)
              • Set AD_MaxDistance[AD_MaxIndex] = (Distance between AD_TempPoint and AD_TempPoint3)
              • Set AD_MaxHeight[AD_MaxIndex] = (AD_MaxDistance[AD_MaxIndex] x (AD_LaunchArcMultiplyerBase + (AD_LaunchArcMultiplyerPL x AD_TempReal)))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • AD_Conditions[5] Equal to True
                • Then - Actions
                  • Set AD_LaunchSpeed[AD_MaxIndex] = (AD_LaunchSpeedBase + (AD_LaunchSpeedPerLevel x AD_TempReal))
                • Else - Actions
                  • Set AD_LaunchSpeed[AD_MaxIndex] = ((AD_MaxDistance[AD_MaxIndex] x 0.03) / (AD_LaunchIncomingTimeBase + (AD_LaunchIncomingTimePerLevel x AD_TempReal)))
              • Set AD_UnitIndex[AD_MaxIndex] = AD_TempUnit
              • Set AD_StageID[AD_MaxIndex] = 1
              • Custom script: call RemoveLocation (udg_AD_TempPoint3)
              • Custom script: set udg_AD_TempPoint3 = null
          • Custom script: call RemoveLocation (udg_AD_TempPoint)
          • Custom script: set udg_AD_TempPoint = null
        • Else - Actions
          • -------- Instant Draining area creation --------
          • For each (Integer AD_Index) from 1 to AD_TempInteger, do (Actions)
            • Loop - Actions
              • Set AD_MaxIndex = (AD_MaxIndex + 1)
              • Set AD_TempPoint3 = (AD_TempPoint2 offset by (AD_AoeBase + (AD_AoePerLevel x AD_TempReal)) towards (Random angle) degrees)
              • Unit - Create 1 AD_DummyType for AD_TempPlayer at AD_TempPoint3 facing (Angle from AD_TempPoint2 to AD_TempPoint3) degrees
              • Set AD_TempUnit = (Last created unit)
              • Unit - Add a (AD_DrainAreaDurationBase + (AD_DrainAreaDurationPerLevel x AD_TempReal)) second Generic expiration timer to AD_TempUnit
              • Unit - Pause AD_TempUnit
              • Special Effect - Create a special effect attached to the origin of AD_TempUnit using AD_DrainAreaSFX[AD_TempInteger2]
              • Animation - Change AD_TempUnit's size to ((AD_EffectScalingDrainAreaBase + (AD_EffectScalingDrainAreaPL x AD_TempReal))%, 0.00%, 0.00%) of its original size
              • Set AD_OriginalCaster[AD_MaxIndex] = AD_TempUnit2
              • Set AD_SpecialEffect[AD_MaxIndex] = (Last created special effect)
              • Set AD_DrainAOE[AD_MaxIndex] = (AD_DrainAreaAOEBase + (AD_DrainAreaAOEPerLevel x AD_TempReal))
              • Set AD_AbilityLevel[AD_MaxIndex] = AD_TempReal
              • Set AD_HealthDrain[AD_MaxIndex] = (((AD_HealthDamagePerSecBase + (AD_HealthDamagePerSecPerLevel x AD_TempReal)) x AD_TimerSpeed) x AD_SFXWaitTime)
              • Set AD_ManaDrain[AD_MaxIndex] = (((AD_ManaDamagePerSecBase + (AD_ManaDamagePerSecPerLevel x AD_TempReal)) x AD_TimerSpeed) x AD_SFXWaitTime)
              • Set AD_UnitIndex[AD_MaxIndex] = AD_TempUnit
              • Set AD_Theme[AD_MaxIndex] = AD_TempInteger2
              • Set AD_StageID[AD_MaxIndex] = 2
              • Custom script: call RemoveLocation (udg_AD_TempPoint3)
              • Custom script: set udg_AD_TempPoint3 = null
      • Custom script: call RemoveLocation (udg_AD_TempPoint2)
      • Custom script: set udg_AD_TempPoint2 = null
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Arcane Drain Loop <gen> is on) Equal to False
          • AD_MaxIndex Greater than or equal to 1
        • Then - Actions
          • Trigger - Turn on Arcane Drain Loop <gen>
          • Trigger - Turn on Arcane Drain Dummy Removal <gen>
        • Else - Actions
Loop
  • Arcane Drain Loop
    • Events
    • Conditions
    • Actions
      • For each (Integer AD_Index) from 1 to AD_MaxIndex, do (Actions)
        • Loop - Actions
          • -------- Initial projectile control --------
          • Set AD_TempUnit = AD_UnitIndex[AD_Index]
          • Custom script: set udg_AD_TempX = GetUnitX(udg_AD_OriginalCaster[udg_AD_Index])
          • Custom script: set udg_AD_TempY = GetUnitY(udg_AD_OriginalCaster[udg_AD_Index])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Current order of AD_OriginalCaster[AD_Index]) Not equal to (Order(AD_Order))
                  • AD_CasterX[AD_Index] Not equal to AD_TempX
                  • AD_CasterY[AD_Index] Not equal to AD_TempY
            • Then - Actions
              • Special Effect - Destroy AD_SpecialEffect[AD_Index]
              • Special Effect - Create a special effect attached to the origin of AD_TempUnit using AD_CancelledSFX[AD_Theme[AD_Index]]
              • Special Effect - Destroy (Last created special effect)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • AD_StageID[AD_Index] Equal to 2
                • Then - Actions
                  • Unit - Kill AD_TempUnit
                • Else - Actions
                  • Set AD_StageID[AD_Index] = 5
            • Else - Actions
          • Custom script: set udg_AD_CasterX[udg_AD_Index] = udg_AD_TempX
          • Custom script: set udg_AD_CasterY[udg_AD_Index] = udg_AD_TempY
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • AD_StageID[AD_Index] Equal to 1
            • Then - Actions
              • Custom script: set udg_AD_TempX = GetUnitX(udg_AD_TempUnit)
              • Custom script: set udg_AD_TempY = GetUnitY(udg_AD_TempUnit)
              • Custom script: set udg_AD_Angle = GetUnitFacing(udg_AD_TempUnit) * bj_DEGTORAD
              • Custom script: call SetUnitX(udg_AD_TempUnit, udg_AD_TempX + udg_AD_LaunchSpeed[udg_AD_Index] * Cos(udg_AD_Angle))
              • Custom script: call SetUnitY(udg_AD_TempUnit, udg_AD_TempY + udg_AD_LaunchSpeed[udg_AD_Index] * Sin(udg_AD_Angle))
              • Set AD_CurrentDistance[AD_Index] = (AD_CurrentDistance[AD_Index] + AD_LaunchSpeed[AD_Index])
              • Animation - Change AD_TempUnit flying height to ((((4.00 x AD_MaxHeight[AD_Index]) / AD_MaxDistance[AD_Index]) x (AD_CurrentDistance[AD_Index] / AD_MaxDistance[AD_Index])) x (AD_MaxDistance[AD_Index] - AD_CurrentDistance[AD_Index])) at 0.00
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • AD_CurrentDistance[AD_Index] Greater than or equal to AD_MaxDistance[AD_Index]
                • Then - Actions
                  • Special Effect - Destroy AD_SpecialEffect[AD_Index]
                  • Special Effect - Create a special effect attached to the origin of AD_TempUnit using AD_DrainAreaSFX[AD_Theme[AD_Index]]
                  • Set AD_SpecialEffect[AD_Index] = (Last created special effect)
                  • Animation - Change AD_TempUnit's size to ((AD_EffectScalingDrainAreaBase + (AD_EffectScalingDrainAreaPL x AD_TempReal))%, 0.00%, 0.00%) of its original size
                  • Unit - Add a AD_Duration[AD_Index] second Generic expiration timer to AD_TempUnit
                  • Set AD_StageID[AD_Index] = 2
                • Else - Actions
            • Else - Actions
              • -------- Draining control --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • AD_StageID[AD_Index] Equal to 2
                • Then - Actions
                  • Set AD_TempPoint = (Position of AD_TempUnit)
                  • Set AD_TempGroup = (Units within AD_DrainAOE[AD_Index] of AD_TempPoint)
                  • Unit Group - Pick every unit in AD_TempGroup and do (Actions)
                    • Loop - Actions
                      • Set AD_TempUnit2 = (Picked unit)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (AD_TempUnit2 is alive) Equal to AD_Conditions[7]
                          • (AD_TempUnit2 is Magic Immune) Equal to AD_Conditions[8]
                          • (AD_TempUnit2 is A structure) Equal to AD_Conditions[9]
                          • (AD_TempUnit2 is A ground unit) Equal to AD_Conditions[10]
                          • (AD_TempUnit2 belongs to an enemy of (Owner of AD_OriginalCaster[AD_Index])) Equal to AD_Conditions[11]
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • AD_Conditions[1] Equal to True
                            • Then - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • AD_SFXCurrentWaitTimeHpHeal[AD_Index] Greater than or equal to AD_SFXWaitTime
                                • Then - Actions
                                  • Set AD_TempReal = (Life of AD_TempUnit2)
                                  • Unit - Cause AD_OriginalCaster[AD_Index] to damage AD_TempUnit2, dealing AD_HealthDrain[AD_Index] damage of attack type Spells and damage type Normal
                                  • Set AD_TempReal2 = (Life of AD_TempUnit2)
                                  • Set AD_CarriedHealth[AD_Index] = (AD_TempReal - AD_TempReal2)
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • AD_Conditions[16] Equal to True
                                    • Then - Actions
                                      • Special Effect - Create a special effect attached to the chest of AD_TempUnit2 using AD_DrainedHealthSFX[AD_Theme[AD_Index]]
                                      • Special Effect - Destroy (Last created special effect)
                                    • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • AD_Conditions[2] Equal to True
                                    • Then - Actions
                                      • -------- Health Segment creation --------
                                      • Set AD_MaxIndex = (AD_MaxIndex + 1)
                                      • Set AD_TempPoint2 = (Position of AD_OriginalCaster[AD_Index])
                                      • Unit - Create 1 AD_DummyType for AD_TempPlayer at AD_TempPoint facing (Angle from AD_TempPoint to AD_TempPoint2) degrees
                                      • Set AD_TempUnit = (Last created unit)
                                      • Set AD_TempReal = AD_AbilityLevel[AD_Index]
                                      • Special Effect - Create a special effect attached to the origin of AD_TempUnit using AD_HealthDrainSFX[AD_Theme[AD_Index]]
                                      • Animation - Change AD_TempUnit's size to ((AD_EffectScalingHealthBase + (AD_EffectScalingHealthPL x AD_TempReal))%, 0.00%, 0.00%) of its original size
                                      • Set AD_OriginalCaster[AD_MaxIndex] = AD_OriginalCaster[AD_Index]
                                      • Set AD_SpecialEffect[AD_MaxIndex] = (Last created special effect)
                                      • Set AD_CarriedHealth[AD_MaxIndex] = AD_CarriedHealth[AD_Index]
                                      • Set AD_CarriedMana[AD_MaxIndex] = 0.00
                                      • Set AD_CurrentDistance[AD_MaxIndex] = 0.00
                                      • Set AD_Theme[AD_MaxIndex] = AD_TempInteger2
                                      • Set AD_MaxDistance[AD_MaxIndex] = (Distance between AD_TempPoint and AD_TempPoint2)
                                      • Set AD_MaxHeight[AD_MaxIndex] = (AD_MaxDistance[AD_MaxIndex] x (AD_HealthArcMultiplyerBase + (AD_HealthArcMultiplyerPL x AD_TempReal)))
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • AD_Conditions[5] Equal to True
                                        • Then - Actions
                                          • Set AD_HealthSpeed[AD_MaxIndex] = (AD_HealSpeedBase + (AD_HealSpeedPerLevel x AD_TempReal))
                                        • Else - Actions
                                          • Set AD_HealthSpeed[AD_MaxIndex] = ((AD_MaxDistance[AD_MaxIndex] x AD_TimerSpeed) / (AD_HealthIncomingTimeBase + (AD_HealthIncomingTimePerLevel x AD_TempReal)))
                                      • Set AD_UnitIndex[AD_MaxIndex] = AD_TempUnit
                                      • Set AD_StageID[AD_MaxIndex] = 3
                                      • Custom script: call RemoveLocation (udg_AD_TempPoint2)
                                    • Else - Actions
                                      • Set AD_SFXLimiter = (Random integer number between 1 and AD_RecieveSFXLimiter)
                                      • Unit - Set life of AD_OriginalCaster[AD_Index] to ((Life of AD_OriginalCaster[AD_Index]) + AD_CarriedHealth[AD_Index])
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • AD_Conditions[13] Equal to True
                                          • AD_SFXLimiter Equal to 1
                                        • Then - Actions
                                          • Special Effect - Create a special effect attached to the origin of AD_OriginalCaster[AD_Index] using AD_HealedLifeSFX[AD_Theme[AD_Index]]
                                          • Special Effect - Destroy (Last created special effect)
                                        • Else - Actions
                                  • Set AD_SFXCurrentWaitTimeHpHeal[AD_Index] = 0.00
                                • Else - Actions
                                  • Set AD_SFXCurrentWaitTimeHpHeal[AD_Index] = (AD_SFXCurrentWaitTimeHpHeal[AD_Index] + 1.00)
                            • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • AD_Conditions[3] Equal to True
                              • (Mana of AD_TempUnit2) Greater than 0.00
                            • Then - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • AD_SFXCurrentWaitTimeManaHeal[AD_Index] Greater than or equal to AD_SFXWaitTime
                                • Then - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • AD_Conditions[12] Equal to False
                                    • Then - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Mana of AD_TempUnit2) Greater than or equal to AD_ManaDrain[AD_Index]
                                        • Then - Actions
                                          • Unit - Set mana of AD_TempUnit2 to ((Mana of AD_TempUnit2) - AD_ManaDrain[AD_Index])
                                          • Set AD_CarriedMana[AD_Index] = AD_ManaDrain[AD_Index]
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • AD_Conditions[15] Equal to True
                                            • Then - Actions
                                              • Special Effect - Create a special effect attached to the chest of AD_TempUnit2 using AD_DrainedManaSFX[AD_Theme[AD_Index]]
                                              • Special Effect - Destroy (Last created special effect)
                                            • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • AD_Conditions[4] Equal to True
                                            • Then - Actions
                                              • -------- Mana segment creation --------
                                              • Set AD_MaxIndex = (AD_MaxIndex + 1)
                                              • Set AD_TempPoint2 = (Position of AD_OriginalCaster[AD_Index])
                                              • Unit - Create 1 AD_DummyType for AD_TempPlayer at AD_TempPoint facing (Angle from AD_TempPoint to AD_TempPoint2) degrees
                                              • Set AD_TempUnit = (Last created unit)
                                              • Set AD_TempReal = AD_AbilityLevel[AD_Index]
                                              • Special Effect - Create a special effect attached to the origin of AD_TempUnit using AD_ManaDrainSFX[AD_Theme[AD_Index]]
                                              • Animation - Change AD_TempUnit's size to ((AD_EffectScalingManaBase + (AD_EffectScalingManaPL x AD_TempReal))%, 0.00%, 0.00%) of its original size
                                              • Set AD_OriginalCaster[AD_MaxIndex] = AD_OriginalCaster[AD_Index]
                                              • Set AD_SpecialEffect[AD_MaxIndex] = (Last created special effect)
                                              • Set AD_CarriedHealth[AD_MaxIndex] = 0.00
                                              • Set AD_CarriedMana[AD_MaxIndex] = AD_CarriedMana[AD_Index]
                                              • Set AD_CurrentDistance[AD_MaxIndex] = 0.00
                                              • Set AD_Theme[AD_MaxIndex] = AD_TempInteger2
                                              • Set AD_MaxDistance[AD_MaxIndex] = (Distance between AD_TempPoint and AD_TempPoint2)
                                              • Set AD_MaxHeight[AD_MaxIndex] = (AD_MaxDistance[AD_MaxIndex] x (AD_ManaArcMultiplyerBase + (AD_ManaArcMultiplyerPL x AD_TempReal)))
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • AD_Conditions[5] Equal to True
                                                • Then - Actions
                                                  • Set AD_ManaSpeed[AD_MaxIndex] = (AD_ManaSpeedBase + (AD_ManaSpeedPerLevel x AD_TempReal))
                                                • Else - Actions
                                                  • Set AD_ManaSpeed[AD_MaxIndex] = ((AD_MaxDistance[AD_MaxIndex] x AD_TimerSpeed) / (AD_ManaIncomingTimeBase + (AD_ManaIncomingTimePerLevel x AD_TempReal)))
                                              • Set AD_UnitIndex[AD_MaxIndex] = AD_TempUnit
                                              • Set AD_StageID[AD_MaxIndex] = 4
                                              • Custom script: call RemoveLocation (udg_AD_TempPoint2)
                                            • Else - Actions
                                              • Set AD_SFXLimiter = (Random integer number between 1 and AD_RecieveSFXLimiter)
                                              • Unit - Set mana of AD_OriginalCaster[AD_Index] to ((Mana of AD_OriginalCaster[AD_Index]) + AD_CarriedMana[AD_Index])
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • AD_Conditions[14] Equal to True
                                                  • AD_SFXLimiter Equal to 1
                                                • Then - Actions
                                                  • Special Effect - Create a special effect attached to the chest of AD_OriginalCaster[AD_Index] using AD_HealedManaSFX[AD_Theme[AD_Index]]
                                                  • Special Effect - Destroy (Last created special effect)
                                                • Else - Actions
                                        • Else - Actions
                                          • Set AD_CarriedMana[AD_Index] = 0.00
                                    • Else - Actions
                                      • Set AD_TempReal = (Mana of AD_TempUnit2)
                                      • Unit - Set mana of AD_TempUnit2 to ((Mana of AD_TempUnit2) - AD_ManaDrain[AD_Index])
                                      • Set AD_TempReal2 = (Mana of AD_TempUnit2)
                                      • Set AD_CarriedMana[AD_Index] = (AD_TempReal - AD_TempReal2)
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • AD_Conditions[15] Equal to True
                                        • Then - Actions
                                          • Special Effect - Create a special effect attached to the chest of AD_TempUnit2 using AD_DrainedManaSFX[AD_Theme[AD_Index]]
                                          • Special Effect - Destroy (Last created special effect)
                                        • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • AD_Conditions[4] Equal to True
                                        • Then - Actions
                                          • -------- Mana segment creation --------
                                          • Set AD_MaxIndex = (AD_MaxIndex + 1)
                                          • Set AD_TempPoint2 = (Position of AD_OriginalCaster[AD_Index])
                                          • Unit - Create 1 AD_DummyType for AD_TempPlayer at AD_TempPoint facing (Angle from AD_TempPoint to AD_TempPoint2) degrees
                                          • Set AD_TempUnit = (Last created unit)
                                          • Set AD_TempReal = AD_AbilityLevel[AD_Index]
                                          • Special Effect - Create a special effect attached to the origin of AD_TempUnit using AD_ManaDrainSFX[AD_Theme[AD_Index]]
                                          • Animation - Change AD_TempUnit's size to ((AD_EffectScalingManaBase + (AD_EffectScalingManaPL x AD_TempReal))%, 0.00%, 0.00%) of its original size
                                          • Set AD_OriginalCaster[AD_MaxIndex] = AD_OriginalCaster[AD_Index]
                                          • Set AD_SpecialEffect[AD_MaxIndex] = (Last created special effect)
                                          • Set AD_CarriedHealth[AD_MaxIndex] = 0.00
                                          • Set AD_CarriedMana[AD_MaxIndex] = AD_CarriedMana[AD_Index]
                                          • Set AD_CurrentDistance[AD_MaxIndex] = 0.00
                                          • Set AD_Theme[AD_MaxIndex] = AD_TempInteger2
                                          • Set AD_MaxDistance[AD_MaxIndex] = (Distance between AD_TempPoint and AD_TempPoint2)
                                          • Set AD_MaxHeight[AD_MaxIndex] = (AD_MaxDistance[AD_MaxIndex] x (AD_ManaArcMultiplyerBase + (AD_ManaArcMultiplyerPL x AD_TempReal)))
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • AD_Conditions[5] Equal to True
                                            • Then - Actions
                                              • Set AD_ManaSpeed[AD_MaxIndex] = (AD_ManaSpeedBase + (AD_ManaSpeedPerLevel x AD_TempReal))
                                            • Else - Actions
                                              • Set AD_ManaSpeed[AD_MaxIndex] = ((AD_MaxDistance[AD_MaxIndex] x AD_TimerSpeed) / (AD_ManaIncomingTimeBase + (AD_ManaIncomingTimePerLevel x AD_TempReal)))
                                          • Set AD_UnitIndex[AD_MaxIndex] = AD_TempUnit
                                          • Set AD_StageID[AD_MaxIndex] = 4
                                          • Custom script: call RemoveLocation (udg_AD_TempPoint2)
                                        • Else - Actions
                                          • Set AD_SFXLimiter = (Random integer number between 1 and AD_RecieveSFXLimiter)
                                          • Unit - Set mana of AD_OriginalCaster[AD_Index] to ((Mana of AD_OriginalCaster[AD_Index]) + AD_CarriedMana[AD_Index])
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • AD_Conditions[14] Equal to True
                                              • AD_SFXLimiter Equal to 1
                                            • Then - Actions
                                              • Special Effect - Create a special effect attached to the chest of AD_OriginalCaster[AD_Index] using AD_HealedManaSFX[AD_Theme[AD_Index]]
                                              • Special Effect - Destroy (Last created special effect)
                                            • Else - Actions
                                  • Set AD_SFXCurrentWaitTimeManaHeal[AD_Index] = 0.00
                                • Else - Actions
                                  • Set AD_SFXCurrentWaitTimeManaHeal[AD_Index] = (AD_SFXCurrentWaitTimeManaHeal[AD_Index] + 1.00)
                            • Else - Actions
                        • Else - Actions
                  • Custom script: call DestroyGroup (udg_AD_TempGroup)
                  • Custom script: call RemoveLocation (udg_AD_TempPoint)
                  • Custom script: set udg_AD_TempPoint = null
                  • Custom script: set udg_AD_TempGroup = null
                • Else - Actions
                  • -------- Health Segments control --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AD_StageID[AD_Index] Equal to 3
                    • Then - Actions
                      • Set AD_TempPoint3 = (Position of AD_OriginalCaster[AD_Index])
                      • Set AD_TempPoint2 = (Position of AD_TempUnit)
                      • Unit - Make AD_TempUnit face AD_OriginalCaster[AD_Index] over 0.00 seconds
                      • Custom script: set udg_AD_TempX = GetUnitX(udg_AD_TempUnit)
                      • Custom script: set udg_AD_TempY = GetUnitY(udg_AD_TempUnit)
                      • Custom script: set udg_AD_Angle = GetUnitFacing(udg_AD_TempUnit) * bj_DEGTORAD
                      • Custom script: call SetUnitX(udg_AD_TempUnit, udg_AD_TempX + udg_AD_HealthSpeed[udg_AD_Index] * Cos(udg_AD_Angle))
                      • Custom script: call SetUnitY(udg_AD_TempUnit, udg_AD_TempY + udg_AD_HealthSpeed[udg_AD_Index] * Sin(udg_AD_Angle))
                      • Set AD_CurrentDistance[AD_Index] = (AD_CurrentDistance[AD_Index] + AD_HealthSpeed[AD_Index])
                      • Animation - Change AD_TempUnit flying height to ((((4.00 x AD_MaxHeight[AD_Index]) / AD_MaxDistance[AD_Index]) x (AD_CurrentDistance[AD_Index] / AD_MaxDistance[AD_Index])) x (AD_MaxDistance[AD_Index] - AD_CurrentDistance[AD_Index])) at 0.00
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Distance between AD_TempPoint2 and AD_TempPoint3) Less than or equal to 50.00
                        • Then - Actions
                          • Special Effect - Destroy AD_SpecialEffect[AD_Index]
                          • Set AD_SFXLimiter = (Random integer number between 1 and AD_RecieveSFXLimiter)
                          • Unit - Set life of AD_OriginalCaster[AD_Index] to ((Life of AD_OriginalCaster[AD_Index]) + AD_CarriedHealth[AD_Index])
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • AD_Conditions[13] Equal to True
                              • AD_SFXLimiter Equal to 1
                            • Then - Actions
                              • Special Effect - Create a special effect attached to the origin of AD_OriginalCaster[AD_Index] using AD_HealedLifeSFX[AD_Theme[AD_Index]]
                              • Special Effect - Destroy (Last created special effect)
                            • Else - Actions
                          • Set AD_StageID[AD_Index] = 5
                        • Else - Actions
                      • Custom script: call RemoveLocation (udg_AD_TempPoint3)
                      • Custom script: call RemoveLocation (udg_AD_TempPoint2)
                      • Custom script: set udg_AD_TempPoint3 = null
                      • Custom script: set udg_AD_TempPoint2 = null
                    • Else - Actions
                      • -------- Mana Segments control --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • AD_StageID[AD_Index] Equal to 4
                        • Then - Actions
                          • Set AD_TempPoint3 = (Position of AD_OriginalCaster[AD_Index])
                          • Set AD_TempPoint2 = (Position of AD_TempUnit)
                          • Unit - Make AD_TempUnit face AD_OriginalCaster[AD_Index] over 0.00 seconds
                          • Custom script: set udg_AD_TempX = GetUnitX(udg_AD_TempUnit)
                          • Custom script: set udg_AD_TempY = GetUnitY(udg_AD_TempUnit)
                          • Custom script: set udg_AD_Angle = GetUnitFacing(udg_AD_TempUnit) * bj_DEGTORAD
                          • Custom script: call SetUnitX(udg_AD_TempUnit, udg_AD_TempX + udg_AD_ManaSpeed[udg_AD_Index] * Cos(udg_AD_Angle))
                          • Custom script: call SetUnitY(udg_AD_TempUnit, udg_AD_TempY + udg_AD_ManaSpeed[udg_AD_Index] * Sin(udg_AD_Angle))
                          • Set AD_CurrentDistance[AD_Index] = (AD_CurrentDistance[AD_Index] + AD_ManaSpeed[AD_Index])
                          • Animation - Change AD_TempUnit flying height to ((((4.00 x AD_MaxHeight[AD_Index]) / AD_MaxDistance[AD_Index]) x (AD_CurrentDistance[AD_Index] / AD_MaxDistance[AD_Index])) x (AD_MaxDistance[AD_Index] - AD_CurrentDistance[AD_Index])) at 0.00
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Distance between AD_TempPoint2 and AD_TempPoint3) Less than or equal to 50.00
                            • Then - Actions
                              • Special Effect - Destroy AD_SpecialEffect[AD_Index]
                              • Unit - Set mana of AD_OriginalCaster[AD_Index] to ((Mana of AD_OriginalCaster[AD_Index]) + AD_CarriedMana[AD_Index])
                              • Set AD_SFXLimiter = (Random integer number between 1 and AD_RecieveSFXLimiter)
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • AD_Conditions[14] Equal to True
                                  • AD_SFXLimiter Equal to 1
                                • Then - Actions
                                  • Special Effect - Create a special effect attached to the chest of AD_OriginalCaster[AD_Index] using AD_HealedManaSFX[AD_Theme[AD_Index]]
                                  • Special Effect - Destroy (Last created special effect)
                                • Else - Actions
                              • Set AD_StageID[AD_Index] = 5
                            • Else - Actions
                          • Custom script: call RemoveLocation (udg_AD_TempPoint3)
                          • Custom script: call RemoveLocation (udg_AD_TempPoint2)
                          • Custom script: set udg_AD_TempPoint3 = null
                          • Custom script: set udg_AD_TempPoint2 = null
                        • Else - Actions
                          • -------- Index recycling --------
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • AD_StageID[AD_Index] Equal to 5
                            • Then - Actions
                              • Set AD_OriginalCaster[AD_Index] = AD_OriginalCaster[AD_MaxIndex]
                              • Set AD_SpecialEffect[AD_Index] = AD_SpecialEffect[AD_MaxIndex]
                              • Set AD_DrainAOE[AD_MaxIndex] = (AD_DrainAreaAOEBase + (AD_DrainAreaAOEPerLevel x AD_TempReal))
                              • Set AD_Duration[AD_Index] = AD_Duration[AD_MaxIndex]
                              • Set AD_AbilityLevel[AD_Index] = AD_AbilityLevel[AD_MaxIndex]
                              • Set AD_HealthDrain[AD_Index] = AD_HealthDrain[AD_MaxIndex]
                              • Set AD_ManaDrain[AD_Index] = AD_ManaDrain[AD_MaxIndex]
                              • Set AD_CarriedHealth[AD_Index] = AD_CarriedHealth[AD_MaxIndex]
                              • Set AD_CarriedMana[AD_Index] = AD_CarriedMana[AD_MaxIndex]
                              • Set AD_CurrentDistance[AD_Index] = AD_CurrentDistance[AD_MaxIndex]
                              • Set AD_SFXCurrentWaitTimeHpHeal[AD_Index] = AD_SFXCurrentWaitTimeHpHeal[AD_MaxIndex]
                              • Set AD_SFXCurrentWaitTimeManaHeal[AD_Index] = AD_SFXCurrentWaitTimeManaHeal[AD_MaxIndex]
                              • Set AD_HealthSpeed[AD_Index] = AD_HealthSpeed[AD_MaxIndex]
                              • Set AD_ManaSpeed[AD_Index] = AD_ManaSpeed[AD_MaxIndex]
                              • Set AD_LaunchSpeed[AD_Index] = AD_LaunchSpeed[AD_MaxIndex]
                              • Set AD_Theme[AD_Index] = AD_Theme[AD_MaxIndex]
                              • Set AD_MaxDistance[AD_Index] = AD_MaxDistance[AD_MaxIndex]
                              • Set AD_MaxHeight[AD_Index] = AD_MaxHeight[AD_MaxIndex]
                              • Set AD_UnitIndex[AD_Index] = AD_UnitIndex[AD_MaxIndex]
                              • Set AD_StageID[AD_Index] = AD_StageID[AD_MaxIndex]
                              • Custom script: set udg_AD_CasterX[udg_AD_Index] = udg_AD_CasterX[udg_AD_MaxIndex]
                              • Custom script: set udg_AD_CasterY[udg_AD_Index] = udg_AD_CasterY[udg_AD_MaxIndex]
                              • Set AD_MaxIndex = (AD_MaxIndex - 1)
                              • Set AD_Index = (AD_Index - 1)
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • AD_MaxIndex Equal to 0
                                • Then - Actions
                                  • Trigger - Turn off Arcane Drain Loop <gen>
                                  • Trigger - Turn off Arcane Drain Dummy Removal <gen>
                                • Else - Actions
                              • Unit - Remove AD_TempUnit from the game
                            • Else - Actions
Dummy Removal
  • Arcane Drain Dummy Removal
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • -------- Clears up draining areas after they expire --------
      • Set AD_TempUnit = (Triggering unit)
      • For each (Integer AD_Index) from 1 to AD_MaxIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of AD_TempUnit) Equal to AD_DummyType
              • AD_TempUnit Equal to AD_UnitIndex[AD_Index]
            • Then - Actions
              • Set AD_TempPoint = (Position of AD_TempUnit)
              • Special Effect - Destroy AD_SpecialEffect[AD_Index]
              • Special Effect - Create a special effect at AD_TempPoint using AD_EndSFX[AD_Theme[AD_Index]]
              • Special Effect - Destroy (Last created special effect)
              • Set AD_StageID[AD_Index] = 5
              • Custom script: call RemoveLocation (udg_AD_TempPoint)
              • Custom script: set udg_AD_TempPoint = null
            • Else - Actions


- Beserk Plant
Configuration
  • Beserk Plant Configuration
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Do not touch --------
      • Hashtable - Create a hashtable
      • Set BP_Hash = (Last created hashtable)
      • -------- ------ --------
      • -------- Determines the Minimum casting range of the spell --------
      • Set BP_MinRange = 200.00
      • -------- Determines the strength of the knockback --------
      • Set BP_KnockbackStrengthBase = 20.00
      • Set BP_KnockbackStrengthPerLevel = 5.00
      • -------- Determines how fast the knockback will deteriorate --------
      • Set BP_KnockbackDetriment = 1.00
      • -------- Determines the AOE of the Plant --------
      • Set BP_AoeBase = 300.00
      • Set BP_AoePerLevel = 100.00
      • -------- Determines the Damage of the branches --------
      • Set BP_DamageBase = 30.00
      • Set BP_DamagePerLevel = 15.00
      • -------- Determines the duration of the plant --------
      • Set BP_DurationBase = 3.00
      • Set BP_DurationPerLevel = 2.00
      • -------- Determines the Arc shape of the plant and its branches --------
      • Set BP_HeightMultiplyer = 1.00
      • -------- Determines the Speed of the branches --------
      • Set BP_BranchSpeed = 15.00
      • -------- Determines the Speed of the Plants moving through the air --------
      • Set BP_PlantSpeed = 7.50
      • -------- Determines the Damage AOE of the branches --------
      • Set BP_BranchAoe = 90.00
      • -------- Determines the unit used as the plant --------
      • Set BP_Plant = Plant
      • -------- Determines the unit used as the branch --------
      • Set BP_BranchCore = BranchCore
      • -------- Determines the spell used by the triggers --------
      • Set BP_Spell = Beserk Plant
      • -------- Determines the SFX created on knockback --------
      • Set BP_KnockbackSFX = Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
      • -------- Determines the impact SFX of the branches hitting a target --------
      • Set BP_BranchHitSFX = Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
      • -------- Determines whether or not the spell will destroy trees --------
      • Set BP_TreeKill = True
      • -------- Determines the area of trees that will be destroyed when a unit comes within range of it during knockback --------
      • Set BP_TreeDestroyArea = 100.00
      • -------- ------- --------
      • -------- Do not touch --------
      • -------- Tree Checking Set up --------
      • Set BP_TempPoint = (Center of (Playable map area))
      • Unit - Create 1 Peasant for Neutral Passive at BP_TempPoint facing Default building facing degrees
      • Set BP_TreeChecker = (Last created unit)
      • Unit - Hide BP_TreeChecker
      • Unit - Make BP_TreeChecker Invulnerable
      • Custom script: call RemoveLocation (udg_BP_TempPoint)
      • -------- ------ --------
Activation
  • Beserk Plant Activation
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to BP_Spell
    • Actions
      • -------- Creating Plant --------
      • Set BP_U = (Triggering unit)
      • Set BP_TempPoint = (Position of BP_U)
      • Set BP_TempPoint2 = (Target point of ability being cast)
      • Set BP_TempReal = (Real((Level of BP_Spell for BP_U)))
      • Set BP_Angle = (Angle from BP_TempPoint to BP_TempPoint2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between BP_TempPoint and BP_TempPoint2) Less than BP_MinRange
        • Then - Actions
          • Custom script: call RemoveLocation (udg_BP_TempPoint2)
          • Set BP_TempPoint2 = (BP_TempPoint offset by BP_MinRange towards BP_Angle degrees)
        • Else - Actions
      • Unit - Create 1 BP_Plant for (Owner of BP_U) at BP_TempPoint facing BP_Angle degrees
      • -------- ------ --------
      • -------- Passing Parameters --------
      • Set BP_TempU = (Last created unit)
      • Custom script: set udg_BP_UHandle = GetHandleId(udg_BP_TempU)
      • -------- Casting Unit ID --------
      • Hashtable - Save Handle OfBP_U as 1 of BP_UHandle in BP_Hash
      • -------- Searching AOE for the plant --------
      • Hashtable - Save (BP_AoeBase + (BP_AoePerLevel x BP_TempReal)) as 2 of BP_UHandle in BP_Hash
      • -------- Branch Damage --------
      • Hashtable - Save (BP_DamageBase + (BP_DamagePerLevel x BP_TempReal)) as 3 of BP_UHandle in BP_Hash
      • -------- Plant Duration --------
      • Hashtable - Save (BP_DurationBase + (BP_DurationPerLevel x BP_TempReal)) as 4 of BP_UHandle in BP_Hash
      • -------- Branch Knockback power --------
      • Hashtable - Save (BP_KnockbackStrengthBase + (BP_KnockbackStrengthPerLevel x BP_TempReal)) as 5 of BP_UHandle in BP_Hash
      • -------- ID in unit group --------
      • Hashtable - Save 1 as 6 of BP_UHandle in BP_Hash
      • -------- Max distance (parabola) --------
      • Hashtable - Save (Distance between BP_TempPoint and BP_TempPoint2) as 7 of BP_UHandle in BP_Hash
      • -------- Max height (parabola) --------
      • Hashtable - Save ((Distance between BP_TempPoint and BP_TempPoint2) x BP_HeightMultiplyer) as 8 of BP_UHandle in BP_Hash
      • -------- ------ --------
      • Unit Group - Add BP_TempU to BP_Plants
      • Custom script: call RemoveLocation (udg_BP_TempPoint2)
      • Custom script: call RemoveLocation (udg_BP_TempPoint)
      • Trigger - Turn on Beserk Plant Loop <gen>
Loop
  • Beserk Plant Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in BP_Plants and do (Actions)
        • Loop - Actions
          • Set BP_U = (Picked unit)
          • Custom script: set udg_BP_UHandle = GetHandleId(udg_BP_U)
          • -------- Stage 1 --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 6 of BP_UHandle from BP_Hash) Equal to 1
            • Then - Actions
              • -------- Movement --------
              • Custom script: set udg_BP_TempX = GetUnitX(udg_BP_U)
              • Custom script: set udg_BP_TempY = GetUnitY(udg_BP_U)
              • Set BP_Angle = (Facing of BP_U)
              • Custom script: call SetUnitX(udg_BP_U, udg_BP_TempX + udg_BP_PlantSpeed * Cos(udg_BP_Angle * bj_DEGTORAD))
              • Custom script: call SetUnitY(udg_BP_U, udg_BP_TempY + udg_BP_PlantSpeed * Sin(udg_BP_Angle * bj_DEGTORAD))
              • -------- ------ --------
              • -------- Fly Height --------
              • Set BP_RealCache[1] = (Load 7 of BP_UHandle from BP_Hash)
              • Set BP_RealCache[2] = (Load 8 of BP_UHandle from BP_Hash)
              • Set BP_RealCache[3] = ((Load 9 of BP_UHandle from BP_Hash) + BP_PlantSpeed)
              • Hashtable - Save BP_RealCache[3] as 9 of BP_UHandle in BP_Hash
              • Set BP_RealCache[4] = (((4.00 x BP_RealCache[2]) / BP_RealCache[1]) x ((BP_RealCache[3] / BP_RealCache[1]) x (BP_RealCache[1] - BP_RealCache[3])))
              • Animation - Change BP_U flying height to BP_RealCache[4] at 0.00
              • -------- ------ --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • BP_RealCache[4] Less than 0.00
                • Then - Actions
                  • -------- Stage 2 Setup --------
                  • Hashtable - Save 2 as 6 of BP_UHandle in BP_Hash
                  • Unit - Add a (Load 4 of BP_UHandle from BP_Hash) second Generic expiration timer to BP_U
                  • -------- ------ --------
                • Else - Actions
            • Else - Actions
          • -------- Stage 2 --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 6 of BP_UHandle from BP_Hash) Equal to 2
            • Then - Actions
              • Set BP_TempPoint = (Position of BP_U)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load 20 of BP_UHandle from BP_Hash) Equal to 3
                • Then - Actions
                  • -------- Plant creation timer reset --------
                  • Hashtable - Save 0 as 20 of BP_UHandle in BP_Hash
                  • -------- ------ --------
                  • -------- Finding Targets --------
                  • Set BP_TempGroup = (Units within (Load 2 of BP_UHandle from BP_Hash) of BP_TempPoint)
                  • Unit Group - Pick every unit in BP_TempGroup and do (Actions)
                    • Loop - Actions
                      • Set BP_TempU = (Picked unit)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (BP_TempU is Magic Immune) Equal to False
                          • (BP_TempU is A structure) Equal to False
                          • (BP_TempU is alive) Equal to True
                          • (BP_TempU belongs to an enemy of (Owner of BP_U)) Equal to True
                          • (BP_TempU is A ground unit) Equal to True
                          • (BP_TempU is in BP_Plants) Equal to False
                        • Then - Actions
                          • -------- Creating Branch --------
                          • Set BP_TempPoint2 = (Position of BP_TempU)
                          • Set BP_Angle = (Angle from BP_TempPoint to BP_TempPoint2)
                          • Unit - Create 1 BP_BranchCore for (Owner of BP_U) at BP_TempPoint facing BP_Angle degrees
                          • -------- ------ --------
                          • -------- Passing Parameters --------
                          • Set BP_TempU = (Last created unit)
                          • Custom script: set udg_BP_UHandleC = GetHandleId(udg_BP_TempU)
                          • Unit Group - Add BP_TempU to BP_Plants
                          • -------- Casting Unit ID --------
                          • Hashtable - Save Handle Of(Load 1 of BP_UHandle in BP_Hash) as 1 of BP_UHandleC in BP_Hash
                          • -------- ID in unit group --------
                          • Hashtable - Save 3 as 6 of BP_UHandleC in BP_Hash
                          • -------- Relevent Plant ID --------
                          • Hashtable - Save Handle OfBP_U as 2 of BP_UHandleC in BP_Hash
                          • -------- Branch Damage --------
                          • Hashtable - Save (Load 3 of BP_UHandle from BP_Hash) as 3 of BP_UHandleC in BP_Hash
                          • -------- Branch Knockback power --------
                          • Hashtable - Save (Load 5 of BP_UHandle from BP_Hash) as 5 of BP_UHandleC in BP_Hash
                          • -------- Max distance (parabola) --------
                          • Hashtable - Save (Distance between BP_TempPoint and BP_TempPoint2) as 7 of BP_UHandleC in BP_Hash
                          • -------- Max height (parabola) --------
                          • Hashtable - Save ((Distance between BP_TempPoint and BP_TempPoint2) x BP_HeightMultiplyer) as 8 of BP_UHandleC in BP_Hash
                          • -------- ------ --------
                          • Custom script: call RemoveLocation (udg_BP_TempPoint2)
                        • Else - Actions
                  • -------- ------ --------
                  • Custom script: call DestroyGroup (udg_BP_TempGroup)
                • Else - Actions
                  • -------- Plant creation timer increase --------
                  • Hashtable - Save ((Load 20 of BP_UHandle from BP_Hash) + 1) as 20 of BP_UHandle in BP_Hash
                  • -------- ------ --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (BP_U is dead) Equal to True
                • Then - Actions
                  • Unit Group - Remove BP_U from BP_Plants
                  • Hashtable - Clear all child hashtables of child BP_UHandle in BP_Hash
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (BP_Plants is empty) Equal to True
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
              • Custom script: call RemoveLocation (udg_BP_TempPoint)
            • Else - Actions
          • -------- Branches --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 6 of BP_UHandle from BP_Hash) Equal to 3
            • Then - Actions
              • Custom script: set udg_BP_TempX = GetUnitX(udg_BP_U)
              • Custom script: set udg_BP_TempY = GetUnitY(udg_BP_U)
              • Set BP_Angle = (Facing of BP_U)
              • Custom script: call SetUnitX(udg_BP_U, udg_BP_TempX + udg_BP_BranchSpeed * Cos(udg_BP_Angle * bj_DEGTORAD))
              • Custom script: call SetUnitY(udg_BP_U, udg_BP_TempY + udg_BP_BranchSpeed * Sin(udg_BP_Angle * bj_DEGTORAD))
              • Set BP_RealCache[1] = (Load 7 of BP_UHandle from BP_Hash)
              • Set BP_RealCache[2] = (Load 8 of BP_UHandle from BP_Hash)
              • Set BP_RealCache[3] = ((Load 9 of BP_UHandle from BP_Hash) + BP_BranchSpeed)
              • Hashtable - Save BP_RealCache[3] as 9 of BP_UHandle in BP_Hash
              • Set BP_RealCache[4] = (((4.00 x BP_RealCache[2]) / BP_RealCache[1]) x ((BP_RealCache[3] / BP_RealCache[1]) x (BP_RealCache[1] - BP_RealCache[3])))
              • Animation - Change BP_U flying height to BP_RealCache[4] at 0.00
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • BP_RealCache[4] Less than 0.00
                • Then - Actions
                  • Set BP_TempPoint = (Position of BP_U)
                  • Set BP_TempGroup = (Units within BP_BranchAoe of BP_TempPoint)
                  • Unit Group - Pick every unit in BP_TempGroup and do (Actions)
                    • Loop - Actions
                      • Set BP_TempU = (Picked unit)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (BP_TempU is Magic Immune) Equal to False
                          • (BP_TempU is A structure) Equal to False
                          • (BP_TempU is alive) Equal to True
                          • (BP_TempU belongs to an enemy of (Owner of BP_U)) Equal to True
                          • (BP_TempU is A ground unit) Equal to True
                          • (BP_TempU is in BP_Plants) Equal to False
                        • Then - Actions
                          • Custom script: set udg_BP_UHandleC = GetHandleId(udg_BP_TempU)
                          • Unit - Cause (Load 1 of BP_UHandle in BP_Hash) to damage BP_TempU, dealing (Load 3 of BP_UHandle from BP_Hash) damage of attack type Spells and damage type Normal
                          • Special Effect - Create a special effect at BP_TempPoint using BP_BranchHitSFX
                          • Special Effect - Destroy (Last created special effect)
                          • Set BP_TempU2 = (Load 2 of BP_UHandle in BP_Hash)
                          • Custom script: set udg_BP_TempX = GetUnitX(udg_BP_TempU2)
                          • Custom script: set udg_BP_TempY = GetUnitY(udg_BP_TempU2)
                          • Hashtable - Save BP_TempX as 17 of BP_UHandleC in BP_Hash
                          • Hashtable - Save BP_TempY as 18 of BP_UHandleC in BP_Hash
                          • Hashtable - Save (Load 5 of BP_UHandle from BP_Hash) as 16 of BP_UHandleC in BP_Hash
                          • Unit Group - Add BP_TempU to BP_Plants
                          • Hashtable - Save 4 as 6 of BP_UHandleC in BP_Hash
                        • Else - Actions
                  • Custom script: call DestroyGroup (udg_BP_TempGroup)
                  • Custom script: call RemoveLocation (udg_BP_TempPoint)
                  • Custom script: set udg_BP_UHandleC = GetHandleId(udg_BP_TempU)
                  • Unit Group - Remove BP_U from BP_Plants
                  • Hashtable - Clear all child hashtables of child BP_UHandle in BP_Hash
                  • Unit - Kill BP_U
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (BP_Plants is empty) Equal to True
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
            • Else - Actions
          • -------- Knockback --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 6 of BP_UHandle from BP_Hash) Equal to 4
            • Then - Actions
              • -------- Movement --------
              • Set BP_TempPoint = (Point((Load 17 of BP_UHandle from BP_Hash), (Load 18 of BP_UHandle from BP_Hash)))
              • Set BP_TempPoint2 = (Position of BP_U)
              • -------- ------ --------
              • -------- Knockback effects --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load 20 of BP_UHandle from BP_Hash) Equal to 3
                • Then - Actions
                  • Special Effect - Create a special effect at BP_TempPoint2 using BP_KnockbackSFX
                  • Special Effect - Destroy (Last created special effect)
                  • Hashtable - Save 0 as 20 of BP_UHandle in BP_Hash
                • Else - Actions
                  • Hashtable - Save ((Load 20 of BP_UHandle from BP_Hash) + 1) as 20 of BP_UHandle in BP_Hash
              • -------- ------ --------
              • -------- Movement --------
              • Set BP_TempReal = ((Load 16 of BP_UHandle from BP_Hash) - BP_KnockbackDetriment)
              • Hashtable - Save BP_TempReal as 16 of BP_UHandle in BP_Hash
              • Set BP_Angle = (Angle from BP_TempPoint to BP_TempPoint2)
              • Custom script: call RemoveLocation(udg_BP_TempPoint)
              • Set BP_TempPoint = (BP_TempPoint2 offset by BP_TempReal towards BP_Angle degrees)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Playable map area) contains BP_TempPoint) Equal to True
                  • (Terrain pathing at BP_TempPoint of type Walkability is off) Equal to False
                • Then - Actions
                  • Custom script: set udg_BP_TempX = GetUnitX(udg_BP_U)
                  • Custom script: set udg_BP_TempY = GetUnitY(udg_BP_U)
                  • Custom script: call SetUnitX(udg_BP_U, udg_BP_TempX + udg_BP_TempReal * Cos(udg_BP_Angle * bj_DEGTORAD))
                  • Custom script: call SetUnitY(udg_BP_U, udg_BP_TempY + udg_BP_TempReal * Sin(udg_BP_Angle * bj_DEGTORAD))
                  • -------- Tree Destruction --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • BP_TreeKill Equal to True
                    • Then - Actions
                      • Destructible - Pick every destructible within BP_TreeDestroyArea of BP_TempPoint and do (Actions)
                        • Loop - Actions
                          • Unit - Order BP_TreeChecker to Harvest (Picked destructible)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Current order of BP_TreeChecker) Equal to (Order(harvest))
                            • Then - Actions
                              • Destructible - Kill (Picked destructible)
                            • Else - Actions
                          • Unit - Order BP_TreeChecker to Stop
                    • Else - Actions
                  • -------- ------ --------
                • Else - Actions
              • -------- ------ --------
              • Custom script: call RemoveLocation(udg_BP_TempPoint2)
              • Custom script: call RemoveLocation(udg_BP_TempPoint)
              • -------- End of Knockback --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load 16 of BP_UHandle from BP_Hash) Less than or equal to 0.00
                • Then - Actions
                  • Unit Group - Remove BP_U from BP_Plants
                  • Hashtable - Clear all child hashtables of child BP_UHandle in BP_Hash
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (BP_Plants is empty) Equal to True
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
              • -------- ------ --------
            • Else - Actions
          • -------- ------ --------


- Chaos Portal
Configuration
  • Chaos Portal Configuration
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Do not touch --------
      • Hashtable - Create a hashtable
      • Set CP_Hash = (Last created hashtable)
      • -------- -------- --------
      • -------- Determines the area that will be caught --------
      • Set CP_AoeBase = 225.00
      • Set CP_AoePerLevel = 100.00
      • -------- Determines the damage dealt by Knockback/Pulses --------
      • Set CP_DamageBase = 10.00
      • Set CP_DamagePerLevel = 5.00
      • -------- Determines the strength of the knockback --------
      • Set CP_KnockbackStrengthBase = 14.00
      • Set CP_KnockbackStrengthPerLevel = 5.00
      • Set CP_KnockbackStrengthDetriment = 1.00
      • -------- Determines the amount of pulses --------
      • Set CP_PulsesBase = 2
      • Set CP_PulsesPerLevel = 2
      • -------- Determines the settings of the portal --------
      • Set CP_PortalStartSize = 2.00
      • Set CP_PortalGrowthSpeed = 2.00
      • Set CP_PortalMaxSize = 150.00
      • -------- Determines the settings of the Cage --------
      • -------- The Aoe of each part (comes into calculating how many parts there will be) --------
      • Set CP_CageSegmentAoe = 250.00
      • -------- Determines how fast each segment of the cage will fly --------
      • Set CP_CageSpeed = 20.00
      • -------- Determines the delay between each segment (also effects pulse rate) --------
      • Set CP_CageProjectileFireRate = 5
      • -------- Determines the height of the arc in relevence to the distance the Cage will be thrown at --------
      • Set CP_HeightMultiplyer = 0.75
      • -------- Determines the Dummy unit of the spell --------
      • Set CP_Portal = Chaos Portal
      • -------- Determines the unit model used as the Portal --------
      • Set CP_PortalModel = Abilities\Spells\Undead\Possession\PossessionCaster.mdl
      • -------- Determines the unit model used as the Cage --------
      • Set CP_CageModel = Abilities\Spells\Undead\OrbOfDeath\AnnihilationMissile.mdl
      • -------- Determines the unit model used as the Pulse --------
      • Set CP_PulseModel = Abilities\Spells\Other\HowlOfTerror\HowlCaster.mdl
      • -------- Determines the scale of the cage segments --------
      • Set CP_CageScale = 20.00
      • -------- Determines the spell used to act as the activation spell --------
      • Set CP_Spell = Chaos Portal
      • -------- Do not touch --------
      • -------- Tree Checking Set up --------
      • Set CP_TreeKill = True
      • Set CP_TreeAreaDestroy = 150.00
      • Set CP_TempPoint = (Center of (Playable map area))
      • Unit - Create 1 Peasant for Neutral Passive at CP_TempPoint facing Default building facing degrees
      • Set CP_TreeChecker = (Last created unit)
      • Unit - Hide CP_TreeChecker
      • Unit - Make CP_TreeChecker Invulnerable
      • Custom script: call RemoveLocation (udg_CP_TempPoint)
      • -------- ------ --------
Activation
  • Chaos Portal Activation
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to CP_Spell
    • Actions
      • -------- Spell setup --------
      • Set CP_U = (Triggering unit)
      • Set CP_TempPoint = (Target point of ability being cast)
      • Set CP_TempReal = (Real((Level of Chaos Portal for CP_U)))
      • -------- -------- --------
      • -------- Creating the portal --------
      • Unit - Create 1 CP_Portal for (Owner of CP_U) at CP_TempPoint facing Default building facing degrees
      • -------- -------- --------
      • Custom script: call RemoveLocation(udg_CP_TempPoint)
      • -------- Unit setup --------
      • Set CP_TempU = (Last created unit)
      • Custom script: set udg_CP_UHandle = GetHandleId(udg_CP_TempU)
      • Special Effect - Create a special effect attached to the overhead of CP_TempU using CP_PortalModel
      • -------- -------- --------
      • -------- Aoe calculation --------
      • Set CP_RealCache[1] = (CP_AoeBase + (CP_TempReal x CP_AoePerLevel))
      • -------- Original Casting Unit --------
      • Hashtable - Save Handle OfCP_U as 1 of CP_UHandle in CP_Hash
      • -------- Stage ID --------
      • Hashtable - Save 1 as 2 of CP_UHandle in CP_Hash
      • -------- Number of Pulses --------
      • Hashtable - Save (CP_PulsesBase + ((Integer(CP_TempReal)) x CP_PulsesPerLevel)) as 3 of CP_UHandle in CP_Hash
      • -------- AOE --------
      • Hashtable - Save CP_RealCache[1] as 4 of CP_UHandle in CP_Hash
      • -------- Damage --------
      • Hashtable - Save (CP_DamageBase + (CP_TempReal x CP_DamagePerLevel)) as 5 of CP_UHandle in CP_Hash
      • -------- Knockback Strength --------
      • Hashtable - Save (CP_KnockbackStrengthBase + (CP_TempReal x CP_KnockbackStrengthPerLevel)) as 6 of CP_UHandle in CP_Hash
      • -------- Number of Cage Segments Needed --------
      • Hashtable - Save (Integer(((3.12 x (2.00 x CP_RealCache[1])) / CP_CageSegmentAoe))) as 7 of CP_UHandle in CP_Hash
      • -------- Current Size --------
      • Hashtable - Save CP_PortalStartSize as 8 of CP_UHandle in CP_Hash
      • -------- Current Projectile Counter --------
      • Hashtable - Save 0 as 9 of CP_UHandle in CP_Hash
      • -------- Current Pulse Counter --------
      • Hashtable - Save 0 as 10 of CP_UHandle in CP_Hash
      • -------- Current Pulses released --------
      • Hashtable - Save 0 as 11 of CP_UHandle in CP_Hash
      • -------- Starting size applied --------
      • Animation - Change CP_TempU's size to (CP_PortalStartSize%, CP_PortalStartSize%, CP_PortalMaxSize%) of its original size
      • -------- Added to unit group --------
      • Unit Group - Add CP_TempU to CP_PortalGroup
      • Trigger - Turn on Chaos Portal Loop <gen>
Loop
  • Chaos Portal Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CP_PortalGroup and do (Actions)
        • Loop - Actions
          • Set CP_U = (Picked unit)
          • Custom script: set udg_CP_UHandle = GetHandleId(udg_CP_U)
          • Set CP_TempInteger = (Load 2 of CP_UHandle from CP_Hash)
          • -------- Stage 1 (of 4) --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CP_TempInteger Equal to 1
            • Then - Actions
              • -------- Calculate current growth --------
              • Set CP_RealCache[1] = ((Load 8 of CP_UHandle from CP_Hash) + CP_PortalGrowthSpeed)
              • -------- Check current size --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CP_RealCache[1] Less than CP_PortalMaxSize
                • Then - Actions
                  • -------- Change size --------
                  • Animation - Change CP_U's size to (CP_RealCache[1]%, CP_RealCache[1]%, CP_RealCache[1]%) of its original size
                  • -------- Save size --------
                  • Hashtable - Save CP_RealCache[1] as 8 of CP_UHandle in CP_Hash
                • Else - Actions
                  • -------- Change stage --------
                  • Hashtable - Save 2 as 2 of CP_UHandle in CP_Hash
            • Else - Actions
              • -------- Stage 2 --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CP_TempInteger Equal to 2
                • Then - Actions
                  • -------- Check Projectile delay timer --------
                  • Set CP_TempInteger = (Load 9 of CP_UHandle from CP_Hash)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • CP_TempInteger Equal to CP_CageProjectileFireRate
                    • Then - Actions
                      • -------- Resetting delay timer --------
                      • Hashtable - Save 0 as 9 of CP_UHandle in CP_Hash
                      • -------- Porjectile setup --------
                      • Set CP_TempPoint = (Position of CP_U)
                      • Set CP_Angle = 0.00
                      • -------- Launching projectiles --------
                      • Set CP_TempU2 = (Load 1 of CP_UHandle in CP_Hash)
                      • Set CP_RealCache[0] = (Real((Load 7 of CP_UHandle from CP_Hash)))
                      • Set CP_RealCache[1] = (Load 4 of CP_UHandle from CP_Hash)
                      • Set CP_RealCache[2] = (Load 5 of CP_UHandle from CP_Hash)
                      • Set CP_RealCache[3] = (Load 6 of CP_UHandle from CP_Hash)
                      • For each (Integer CP_i) from 1 to (Load 7 of CP_UHandle from CP_Hash), do (Actions)
                        • Loop - Actions
                          • -------- Projectile data setup --------
                          • Set CP_Angle = (CP_Angle + (360.00 / CP_RealCache[0]))
                          • Set CP_TempPoint2 = (CP_TempPoint offset by CP_RealCache[1] towards CP_Angle degrees)
                          • Set CP_TempReal = (Distance between CP_TempPoint and CP_TempPoint2)
                          • Custom script: call RemoveLocation(udg_CP_TempPoint2)
                          • -------- Creating projectile --------
                          • Unit - Create 1 CP_Portal for (Owner of CP_U) at CP_TempPoint facing CP_Angle degrees
                          • Set CP_TempU = (Last created unit)
                          • Custom script: set udg_CP_UHandleC = GetHandleId(udg_CP_TempU)
                          • Special Effect - Create a special effect attached to the chest of CP_TempU using CP_CageModel
                          • Hashtable - Save Handle Of(Last created special effect) as 20 of CP_UHandleC in CP_Hash
                          • Animation - Change CP_TempU's size to (CP_CageScale%, CP_CageScale%, CP_CageScale%) of its original size
                          • -------- Original Casting Unit --------
                          • Hashtable - Save Handle OfCP_TempU2 as 1 of CP_UHandleC in CP_Hash
                          • -------- Stage ID --------
                          • Hashtable - Save 3 as 2 of CP_UHandleC in CP_Hash
                          • -------- Damage --------
                          • Hashtable - Save CP_RealCache[2] as 5 of CP_UHandleC in CP_Hash
                          • -------- Knockback Strength --------
                          • Hashtable - Save CP_RealCache[3] as 6 of CP_UHandleC in CP_Hash
                          • -------- Saving Max distance --------
                          • Hashtable - Save CP_TempReal as 7 of CP_UHandleC in CP_Hash
                          • -------- Saving Max height --------
                          • Hashtable - Save (CP_TempReal x CP_HeightMultiplyer) as 8 of CP_UHandleC in CP_Hash
                          • -------- Initialising starting distance --------
                          • Hashtable - Save 0.00 as 9 of CP_UHandleC in CP_Hash
                          • -------- Original Portal --------
                          • Hashtable - Save Handle OfCP_U as 10 of CP_UHandleC in CP_Hash
                          • -------- Adding to unit group --------
                          • Unit Group - Add CP_TempU to CP_PortalGroup
                      • Custom script: call RemoveLocation(udg_CP_TempPoint)
                    • Else - Actions
                      • -------- Increasing delay timer --------
                      • Hashtable - Save (CP_TempInteger + 1) as 9 of CP_UHandle in CP_Hash
                  • -------- Check Pulse delay timer --------
                  • Set CP_TempInteger = (Load 10 of CP_UHandle from CP_Hash)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • CP_TempInteger Equal to (CP_CageProjectileFireRate x 10)
                    • Then - Actions
                      • -------- Resetting delay timer --------
                      • Hashtable - Save 0 as 10 of CP_UHandle in CP_Hash
                      • -------- Checking pulse count --------
                      • Set CP_TempInteger = (Load 11 of CP_UHandle from CP_Hash)
                      • Set CP_TempPoint = (Position of CP_U)
                      • -------- Creating pulse --------
                      • Unit - Create 1 CP_Portal for (Owner of CP_U) at CP_TempPoint facing Default building facing degrees
                      • -------- Scaling pulse --------
                      • Set CP_RealCache[1] = ((Load 4 of CP_UHandle from CP_Hash) / 3.00)
                      • Animation - Change (Last created unit)'s size to (CP_RealCache[1]%, CP_RealCache[1]%, CP_RealCache[1]%) of its original size
                      • Special Effect - Create a special effect attached to the overhead of (Last created unit) using CP_PulseModel
                      • -------- Removing pulse --------
                      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                      • -------- Pulse effects setup --------
                      • Set CP_TempGroup = (Units within (Load 4 of CP_UHandle from CP_Hash) of CP_TempPoint)
                      • Custom script: set udg_CP_TempX = GetUnitX(udg_CP_U)
                      • Custom script: set udg_CP_TempY = GetUnitY(udg_CP_U)
                      • -------- Pulse effects --------
                      • Unit Group - Pick every unit in CP_TempGroup and do (Actions)
                        • Loop - Actions
                          • -------- Finding target units --------
                          • Set CP_TempU = (Picked unit)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (CP_TempU is Magic Immune) Equal to False
                              • (CP_TempU is A structure) Equal to False
                              • (CP_TempU is alive) Equal to True
                              • (CP_TempU belongs to an enemy of (Owner of CP_U)) Equal to True
                              • (CP_TempU is A ground unit) Equal to True
                            • Then - Actions
                              • -------- Getting co-ordinates and setup --------
                              • Custom script: set udg_CP_TempX2 = GetUnitX(udg_CP_TempU)
                              • Custom script: set udg_CP_TempY2 = GetUnitY(udg_CP_TempU)
                              • Custom script: set udg_CP_UHandleC = GetHandleId(udg_CP_TempU)
                              • -------- Damage --------
                              • Unit - Cause (Load 1 of CP_UHandle in CP_Hash) to damage CP_TempU, dealing (Load 5 of CP_UHandle from CP_Hash) damage of attack type Spells and damage type Normal
                              • -------- Knockback setup --------
                              • -------- Knockback strength --------
                              • Hashtable - Save (Load 6 of CP_UHandle from CP_Hash) as 13 of CP_UHandleC in CP_Hash
                              • -------- Knockback Angle setup --------
                              • Hashtable - Save CP_TempX as 14 of CP_UHandleC in CP_Hash
                              • Hashtable - Save CP_TempY as 15 of CP_UHandleC in CP_Hash
                              • Hashtable - Save CP_TempX2 as 16 of CP_UHandleC in CP_Hash
                              • Hashtable - Save CP_TempY2 as 17 of CP_UHandleC in CP_Hash
                              • -------- Added to group --------
                              • Unit Group - Add CP_TempU to CP_PortalGroup
                              • -------- Stage ID --------
                              • Hashtable - Save 4 as 2 of CP_UHandleC in CP_Hash
                            • Else - Actions
                      • -------- Cleanup --------
                      • Custom script: call DestroyGroup (udg_CP_TempGroup)
                      • Custom script: call RemoveLocation (udg_CP_TempPoint)
                      • -------- Checking pulse count (cleanup) --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • CP_TempInteger Equal to (Load 3 of CP_UHandle from CP_Hash)
                        • Then - Actions
                          • Unit Group - Remove CP_U from CP_PortalGroup
                          • Hashtable - Clear all child hashtables of child CP_UHandle in CP_Hash
                          • Unit - Kill CP_U
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (CP_PortalGroup is empty) Equal to True
                            • Then - Actions
                              • Trigger - Turn off (This trigger)
                            • Else - Actions
                        • Else - Actions
                          • Hashtable - Save (CP_TempInteger + 1) as 11 of CP_UHandle in CP_Hash
                    • Else - Actions
                      • -------- Increasing delay timer --------
                      • Hashtable - Save (CP_TempInteger + 1) as 10 of CP_UHandle in CP_Hash
                • Else - Actions
                  • -------- Stage 3 --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • CP_TempInteger Equal to 3
                    • Then - Actions
                      • -------- Projectile movement setup --------
                      • Custom script: set udg_CP_TempX = GetUnitX(udg_CP_U)
                      • Custom script: set udg_CP_TempY = GetUnitY(udg_CP_U)
                      • Custom script: set udg_CP_Angle = (GetUnitFacing(udg_CP_U) * bj_DEGTORAD)
                      • -------- Projectile movement --------
                      • Custom script: call SetUnitX(udg_CP_U, udg_CP_TempX + udg_CP_CageSpeed * Cos(udg_CP_Angle))
                      • Custom script: call SetUnitY(udg_CP_U, udg_CP_TempY + udg_CP_CageSpeed * Sin(udg_CP_Angle))
                      • -------- Height calculation --------
                      • Set CP_RealCache[1] = (Load 7 of CP_UHandle from CP_Hash)
                      • Set CP_RealCache[2] = (Load 8 of CP_UHandle from CP_Hash)
                      • Set CP_RealCache[3] = ((Load 9 of CP_UHandle from CP_Hash) + CP_CageSpeed)
                      • Hashtable - Save CP_RealCache[3] as 9 of CP_UHandle in CP_Hash
                      • Set CP_RealCache[4] = (((4.00 x CP_RealCache[2]) / CP_RealCache[1]) x ((CP_RealCache[3] / CP_RealCache[1]) x (CP_RealCache[1] - CP_RealCache[3])))
                      • Animation - Change CP_U flying height to CP_RealCache[4] at 0.00
                      • -------- Checking height --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • CP_RealCache[4] Less than 0.00
                        • Then - Actions
                          • -------- Damage and target setup --------
                          • Set CP_TempU2 = (Load 10 of CP_UHandle in CP_Hash)
                          • Custom script: set udg_CP_UHandleC2 = GetHandleId(udg_CP_TempU2)
                          • Custom script: set udg_CP_TempX2 = GetUnitX(udg_CP_TempU2)
                          • Custom script: set udg_CP_TempY2 = GetUnitY(udg_CP_TempU2)
                          • Set CP_TempPoint2 = (Position of CP_TempU2)
                          • Set CP_TempPoint = (Position of CP_U)
                          • Set CP_TempGroup = (Units within CP_CageSegmentAoe of CP_TempPoint)
                          • -------- Damage and knockback --------
                          • Unit Group - Pick every unit in CP_TempGroup and do (Actions)
                            • Loop - Actions
                              • -------- Finding targets --------
                              • Set CP_TempU = (Picked unit)
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (CP_TempU is Magic Immune) Equal to False
                                  • (CP_TempU is A structure) Equal to False
                                  • (CP_TempU is alive) Equal to True
                                  • (CP_TempU belongs to an enemy of (Owner of CP_U)) Equal to True
                                  • (CP_TempU is A ground unit) Equal to True
                                • Then - Actions
                                  • -------- setup --------
                                  • Custom script: set udg_CP_UHandleC = GetHandleId(udg_CP_TempU)
                                  • -------- Damage --------
                                  • Unit - Cause (Load 1 of CP_UHandle in CP_Hash) to damage CP_TempU, dealing (Load 5 of CP_UHandle from CP_Hash) damage of attack type Spells and damage type Normal
                                  • -------- Knockback setup --------
                                  • -------- Knockback strength --------
                                  • Hashtable - Save (Load 6 of CP_UHandle from CP_Hash) as 13 of CP_UHandleC in CP_Hash
                                  • -------- Knockback Angle setup --------
                                  • Set CP_TempPoint3 = (Position of CP_TempU)
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Distance between CP_TempPoint2 and CP_TempPoint3) Greater than or equal to ((Load 4 of CP_UHandleC2 from CP_Hash) + (CP_CageSegmentAoe / 2.00))
                                    • Then - Actions
                                      • Hashtable - Save CP_TempX2 as 14 of CP_UHandleC in CP_Hash
                                      • Hashtable - Save CP_TempY2 as 15 of CP_UHandleC in CP_Hash
                                      • Hashtable - Save CP_TempY as 17 of CP_UHandleC in CP_Hash
                                      • Hashtable - Save CP_TempX as 16 of CP_UHandleC in CP_Hash
                                    • Else - Actions
                                      • Hashtable - Save CP_TempX as 14 of CP_UHandleC in CP_Hash
                                      • Hashtable - Save CP_TempY as 15 of CP_UHandleC in CP_Hash
                                      • Hashtable - Save CP_TempX2 as 16 of CP_UHandleC in CP_Hash
                                      • Hashtable - Save CP_TempY2 as 17 of CP_UHandleC in CP_Hash
                                  • -------- Added to group --------
                                  • Unit Group - Add CP_TempU to CP_PortalGroup
                                  • -------- Stage ID --------
                                  • Hashtable - Save 4 as 2 of CP_UHandleC in CP_Hash
                                  • Custom script: call RemoveLocation (udg_CP_TempPoint3)
                                • Else - Actions
                          • Custom script: call DestroyGroup (udg_CP_TempGroup)
                          • Custom script: call RemoveLocation (udg_CP_TempPoint2)
                          • Custom script: call RemoveLocation (udg_CP_TempPoint)
                          • -------- Cleanup --------
                          • Special Effect - Destroy (Load 20 of CP_UHandle in CP_Hash)
                          • Unit Group - Remove CP_U from CP_PortalGroup
                          • Hashtable - Clear all child hashtables of child CP_UHandle in CP_Hash
                          • Unit - Kill CP_U
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (CP_PortalGroup is empty) Equal to True
                            • Then - Actions
                              • Trigger - Turn off (This trigger)
                            • Else - Actions
                        • Else - Actions
                    • Else - Actions
                      • -------- Stage 4 --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • CP_TempInteger Equal to 4
                        • Then - Actions
                          • -------- Movement setup --------
                          • Set CP_TempPoint = (Point((Load 14 of CP_UHandle from CP_Hash), (Load 15 of CP_UHandle from CP_Hash)))
                          • Set CP_TempPoint2 = (Point((Load 16 of CP_UHandle from CP_Hash), (Load 17 of CP_UHandle from CP_Hash)))
                          • -------- ------ --------
                          • -------- Movement --------
                          • Set CP_TempReal = ((Load 13 of CP_UHandle from CP_Hash) - CP_KnockbackStrengthDetriment)
                          • Hashtable - Save CP_TempReal as 13 of CP_UHandle in CP_Hash
                          • Custom script: set udg_CP_Angle = AngleBetweenPoints(udg_CP_TempPoint, udg_CP_TempPoint2) * bj_DEGTORAD
                          • Custom script: call RemoveLocation(udg_CP_TempPoint)
                          • Set CP_TempPoint = (CP_TempPoint2 offset by CP_TempReal towards CP_Angle degrees)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ((Playable map area) contains CP_TempPoint) Equal to True
                              • (Terrain pathing at CP_TempPoint of type Walkability is off) Equal to False
                            • Then - Actions
                              • Custom script: set udg_CP_TempX = GetUnitX(udg_CP_U)
                              • Custom script: set udg_CP_TempY = GetUnitY(udg_CP_U)
                              • Custom script: call SetUnitX(udg_CP_U, udg_CP_TempX + udg_CP_TempReal * Cos(udg_CP_Angle))
                              • Custom script: call SetUnitY(udg_CP_U, udg_CP_TempY + udg_CP_TempReal * Sin(udg_CP_Angle))
                              • -------- Tree Destruction --------
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • CP_TreeKill Equal to True
                                • Then - Actions
                                  • Destructible - Pick every destructible within CP_TreeAreaDestroy of CP_TempPoint and do (Actions)
                                    • Loop - Actions
                                      • Unit - Order CP_TreeChecker to Harvest (Picked destructible)
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Current order of CP_TreeChecker) Equal to (Order(harvest))
                                        • Then - Actions
                                          • Destructible - Kill (Picked destructible)
                                        • Else - Actions
                                      • Unit - Order CP_TreeChecker to Stop
                                • Else - Actions
                              • -------- ------ --------
                            • Else - Actions
                          • -------- ------ --------
                          • Custom script: call RemoveLocation(udg_CP_TempPoint2)
                          • Custom script: call RemoveLocation(udg_CP_TempPoint)
                          • -------- End of Knockback --------
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Load 13 of CP_UHandle from CP_Hash) Less than or equal to 0.00
                            • Then - Actions
                              • Unit Group - Remove CP_U from CP_PortalGroup
                              • Hashtable - Clear all child hashtables of child CP_UHandle in CP_Hash
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (CP_PortalGroup is empty) Equal to True
                                • Then - Actions
                                  • Trigger - Turn off (This trigger)
                                • Else - Actions
                            • Else - Actions
                          • -------- ------ --------
                        • Else - Actions


- Energy Glyph
Configuration
  • Energy Glyph Configuration
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Do not touch --------
      • Hashtable - Create a hashtable
      • Set EG_EnergyGlyphHash = (Last created hashtable)
      • -------- ---------- --------
      • -------- Determines how big the Glyph will appear (should be set to match the AOE) --------
      • -------- The AOE of the spell should be 10x the scale --------
      • -------- level 1 AOE = 300. 3.00 x 100 = 300.00 --------
      • Set EG_GlyphScalingBase = 2.00
      • Set EG_GlyphScalingPerLevel = 1.00
      • -------- Determines how long the Glyph will extract mana for (assuming it doesn't hit the limit) before activating or being destroyed --------
      • -------- Time is in seconds --------
      • Set EG_GlyphDurationBase = 10.00
      • Set EG_GlyphDurationPerLevel = 0.00
      • -------- Determines the max amount of Mana the Glyph will absorb before activating --------
      • -------- The absorbing will be spread evenly among the target units --------
      • Set EG_GlyphManaStealMax = 400.00
      • -------- Determines the rate of mana draining --------
      • -------- divide by 0.03 to get how much mana this is per second --------
      • Set EG_EnergyDrainBase = 0.75
      • Set EG_EnergyDrainPerLevel = 0.00
      • -------- Determines the strength of the slowing effect of the Glyph by dividing the standard speed by this number --------
      • -------- Standard is 2 (meaning / 2, meaning 50% speed reduction) --------
      • -------- Shouldn't really be anything higher than 2 --------
      • Set EG_EnergySlowDivider = 2.00
      • -------- Determines the damage each Orb will deal --------
      • -------- level one Orbs deal 15 damage (base 10 + per level 5) --------
      • Set EG_OrbDamageBase = 10.00
      • Set EG_OrbDamagePerLevel = 5.00
      • -------- Determines the AOE of the Orbs for them to damage --------
      • -------- 90 = melee range --------
      • Set EG_OrbAoeBase = 90.00
      • Set EG_OrbAoePerLevel = 0.00
      • -------- This is the AOE of the spell --------
      • -------- Should be 100x the scaling settings --------
      • Set EG_OrbRangeAOEBase = 200.00
      • Set EG_OrbRangeAOEPerLevel = 100.00
      • -------- This is how fast the Orbs will travel when moving --------
      • -------- / 0.03 to find how far this is per second --------
      • Set EG_OrbSpeed = 5.00
      • -------- This determines the arc the Orbs create while moving based on how high they will go in relivence to distance --------
      • -------- 1 = every unit it moves across it goes up as high as it goes far --------
      • -------- 1.1 = it goes up higher than it goes far --------
      • -------- 0.9 = it goes up lower than it goes far --------
      • Set EG_OrbHeightMultiplyer = 1.10
      • -------- ---------- --------
      • -------- This will set the difference between each draining level --------
      • -------- the minimum required to activate is 2x this number --------
      • Set EG_EnergyPerDrainingLevel = 100
      • -------- Number of Orbs created --------
      • Set EG_GlyphOrbsBase = 40
      • Set EG_GlyphOrbsPerLevel = 20
      • -------- Draining level: every 100 mana after 200 adds this many Orbs --------
      • Set EG_GlyphOrbsPerDrainedLevel = 30
      • -------- Example: Fully "Charged" level 1: (((400-100)/100) * PerDrainedLevel) + (Base + (PerLevel * AbilityLevel) = Number of orbs --------
      • -------- ---------------------------------------------------- (((400-100)/100) * 30) + (40 + (20 * 1) = Number of orbs --------
      • -------- ---------------------------------------------------- (90) + (60) = Number of orbs --------
      • -------- ---------------------------------------------------- 150 = Number of orbs --------
      • -------- Unit used as the Glyph --------
      • Set EG_Unit_Glyph = Energy Glyph
      • -------- Unit used as the Orb --------
      • Set EG_Unit_Orb = Energy Orb
      • -------- Unit used as the summoning SFX --------
      • Set EG_Unit_SFX = Energy Glyph SFX
      • -------- Model used for the draining SFX --------
      • Set EG_Unit_SFX2 = Abilities\Spells\Items\AIil\AIilTarget.mdl
      • -------- Spell used to activate the ability --------
      • Set EG_Spell = Energy Glyph
Activation
  • Energy Glyph Activation
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to EG_Unit_Glyph
    • Actions
      • Set EG_UHandle = (Key (Triggering unit))
      • Set EG_u = (Triggering unit)
      • Set EG_TempPoint = (Position of EG_u)
      • Set EG_TempRealStore = (Load 8 of EG_UHandle from EG_EnergyGlyphHash)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Load 1 of EG_UHandle from EG_EnergyGlyphHash) Equal to 1
          • (Mana of (Triggering unit)) Greater than or equal to (2.00 x (Real(EG_EnergyPerDrainingLevel)))
        • Then - Actions
          • Unit - Create 1 Energy Glyph for (Owner of EG_u) at EG_TempPoint facing Default building facing degrees
          • Set EG_UHandleC = (Key (Last created unit))
          • Set EG_Tempu = (Last created unit)
          • Animation - Change EG_Tempu's size to (EG_TempRealStore%, EG_TempRealStore%, EG_TempRealStore%) of its original size
          • -------- Glyph Stage Indicator --------
          • Hashtable - Save 2 as 1 of EG_UHandleC in EG_EnergyGlyphHash
          • -------- Glyph Creator Indicator --------
          • Hashtable - Save Handle Of(Load 3 of EG_UHandle in EG_EnergyGlyphHash) as 3 of EG_UHandleC in EG_EnergyGlyphHash
          • -------- Orb Damage --------
          • Hashtable - Save (Load 4 of EG_UHandle from EG_EnergyGlyphHash) as 4 of EG_UHandleC in EG_EnergyGlyphHash
          • -------- Orb AOE --------
          • Hashtable - Save (Load 5 of EG_UHandle from EG_EnergyGlyphHash) as 5 of EG_UHandleC in EG_EnergyGlyphHash
          • -------- Orb Count --------
          • Hashtable - Save ((((Integer((Mana of EG_u))) - EG_EnergyPerDrainingLevel) / EG_EnergyPerDrainingLevel) x (EG_GlyphOrbsPerDrainedLevel + (Load 6 of EG_UHandle from EG_EnergyGlyphHash))) as 6 of EG_UHandleC in EG_EnergyGlyphHash
          • -------- Orb AOE Range --------
          • Hashtable - Save (Load 7 of EG_UHandle from EG_EnergyGlyphHash) as 7 of EG_UHandleC in EG_EnergyGlyphHash
          • -------- Scaling --------
          • Hashtable - Save (Load 8 of EG_UHandle from EG_EnergyGlyphHash) as 8 of EG_UHandleC in EG_EnergyGlyphHash
          • Unit Group - Add (Last created unit) to EG_EnergyGlyphs
          • Hashtable - Clear all child hashtables of child EG_UHandle in EG_EnergyGlyphHash
        • Else - Actions
          • -------- Death sfx --------
          • Hashtable - Clear all child hashtables of child EG_UHandle in EG_EnergyGlyphHash
          • Unit - Create 1 EG_Unit_SFX for (Owner of EG_u) at EG_TempPoint facing Default building facing degrees
          • Set EG_Tempu = (Last created unit)
          • Animation - Change EG_Tempu's size to (EG_TempRealStore%, EG_TempRealStore%, EG_TempRealStore%) of its original size
          • Unit - Add a 3.00 second Generic expiration timer to EG_Tempu
          • If ((Number of units in EG_EnergyGlyphs) Equal to 0) then do (Trigger - Turn off (This trigger)) else do (Do nothing)
          • -------- ---------- --------
      • Custom script: call RemoveLocation (udg_EG_TempPoint)
  • Energy Glyph
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to EG_Spell
    • Actions
      • Set EG_u = (Triggering unit)
      • Trigger - Turn on Energy Glyph Loop <gen>
      • Trigger - Turn on Energy Glyph Activation <gen>
      • Set EG_TempPoint = (Target point of ability being cast)
      • -------- Glyph --------
      • Unit - Create 1 Energy Glyph for (Owner of EG_u) at EG_TempPoint facing Default building facing degrees
      • Set EG_Tempu = (Last created unit)
      • Set EG_UHandleC = (Key (Last created unit))
      • Hashtable - Save (100.00 x (EG_GlyphScalingBase + (EG_GlyphScalingPerLevel x (Real((Level of Energy Glyph for EG_u)))))) as 8 of EG_UHandleC in EG_EnergyGlyphHash
      • Set EG_TempRealStore = (Load 8 of EG_UHandleC from EG_EnergyGlyphHash)
      • Animation - Change EG_Tempu's size to (EG_TempRealStore%, EG_TempRealStore%, EG_TempRealStore%) of its original size
      • Unit - Add a (EG_GlyphDurationBase + (EG_GlyphDurationPerLevel x (Real((Level of Energy Glyph for EG_u))))) second Generic expiration timer to EG_Tempu
      • Unit Group - Add EG_Tempu to EG_EnergyGlyphs
      • -------- ---------- --------
      • -------- Creation SFX --------
      • Unit - Create 1 Energy Glyph SFX for (Owner of EG_u) at EG_TempPoint facing Default building facing degrees
      • Set EG_Tempu = (Last created unit)
      • Animation - Change EG_Tempu's size to (EG_TempRealStore%, EG_TempRealStore%, EG_TempRealStore%) of its original size
      • Unit - Add a 3.00 second Generic expiration timer to EG_Tempu
      • -------- ---------- --------
      • Custom script: call RemoveLocation (udg_EG_TempPoint)
      • -------- Passing Information --------
      • Set EG_TempRealStore = (Real((Level of Energy Glyph for EG_u)))
      • -------- Glyph Stage Indicator --------
      • Hashtable - Save 1 as 1 of EG_UHandleC in EG_EnergyGlyphHash
      • -------- Energy drain speed --------
      • Hashtable - Save (EG_EnergyDrainBase + (EG_EnergyDrainPerLevel x EG_TempRealStore)) as 2 of EG_UHandleC in EG_EnergyGlyphHash
      • -------- Glyph Creator Indicator --------
      • Hashtable - Save Handle OfEG_u as 3 of EG_UHandleC in EG_EnergyGlyphHash
      • -------- Orb Damage --------
      • Hashtable - Save (EG_OrbDamageBase + (EG_OrbDamagePerLevel x EG_TempRealStore)) as 4 of EG_UHandleC in EG_EnergyGlyphHash
      • -------- Orb AOE --------
      • Hashtable - Save (EG_OrbAoeBase + (EG_OrbAoePerLevel x EG_TempRealStore)) as 5 of EG_UHandleC in EG_EnergyGlyphHash
      • -------- Orb Count --------
      • Hashtable - Save (EG_GlyphOrbsBase + (EG_GlyphOrbsPerLevel x (Level of Energy Glyph for EG_u))) as 6 of EG_UHandleC in EG_EnergyGlyphHash
      • -------- Orb AOE Range --------
      • Hashtable - Save (EG_OrbRangeAOEBase + (EG_OrbRangeAOEPerLevel x (Real((Level of Energy Glyph for EG_u))))) as 7 of EG_UHandleC in EG_EnergyGlyphHash
      • -------- ---------- --------
Loop
  • Energy Glyph Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in EG_EnergyGlyphs and do (Actions)
        • Loop - Actions
          • Set EG_UHandle = (Key (Picked unit))
          • Set EG_u = (Picked unit)
          • -------- Stage 1 - Mana drain --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 1 of EG_UHandle from EG_EnergyGlyphHash) Equal to 1
            • Then - Actions
              • Set EG_TempPoint = (Position of EG_u)
              • Set EG_TempGroup = (Units within (Load 7 of EG_UHandle from EG_EnergyGlyphHash) of EG_TempPoint)
              • Custom script: call RemoveLocation (udg_EG_TempPoint)
              • Unit Group - Pick every unit in EG_TempGroup and do (Actions)
                • Loop - Actions
                  • Set EG_Tempu = (Picked unit)
                  • Set EG_TempRealStore = (Load 2 of EG_UHandle from EG_EnergyGlyphHash)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (EG_Tempu is A ground unit) Equal to True
                      • (EG_Tempu is alive) Equal to True
                      • (EG_Tempu is Magic Immune) Equal to False
                      • (Mana of EG_Tempu) Greater than or equal to EG_TempRealStore
                    • Then - Actions
                      • Unit - Set mana of EG_Tempu to ((Mana of EG_Tempu) - EG_TempRealStore)
                      • Set EG_TempPoint = (Position of EG_Tempu)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Load 15 of EG_UHandle from EG_EnergyGlyphHash) Equal to 20
                        • Then - Actions
                          • Special Effect - Create a special effect at EG_TempPoint using EG_Unit_SFX2
                          • Special Effect - Destroy (Last created special effect)
                          • Hashtable - Save 0 as 15 of EG_UHandle in EG_EnergyGlyphHash
                        • Else - Actions
                      • Hashtable - Save ((Load 15 of EG_UHandle from EG_EnergyGlyphHash) + 1) as 15 of EG_UHandle in EG_EnergyGlyphHash
                      • Custom script: call RemoveLocation (udg_EG_TempPoint)
                      • Unit - Set mana of EG_u to ((Mana of EG_u) + EG_TempRealStore)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Mana of EG_u) Greater than or equal to EG_GlyphManaStealMax
                        • Then - Actions
                          • Unit Group - Remove EG_u from EG_EnergyGlyphs
                          • Unit - Kill EG_u
                        • Else - Actions
                    • Else - Actions
              • Custom script: call DestroyGroup(udg_EG_TempGroup)
            • Else - Actions
          • -------- Stage 2 - Creating Orbs --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 1 of EG_UHandle from EG_EnergyGlyphHash) Equal to 2
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load 6 of EG_UHandle from EG_EnergyGlyphHash) Greater than 0
                • Then - Actions
                  • Hashtable - Save ((Load 6 of EG_UHandle from EG_EnergyGlyphHash) - 1) as 6 of EG_UHandle in EG_EnergyGlyphHash
                  • Set EG_TempPoint = (Position of EG_u)
                  • Set EG_TempPoint2 = (EG_TempPoint offset by (Random real number between 50.00 and (Load 7 of EG_UHandle from EG_EnergyGlyphHash)) towards (Random angle) degrees)
                  • Unit - Create 1 EG_Unit_Orb for (Owner of EG_u) at EG_TempPoint facing (Angle from EG_TempPoint to EG_TempPoint2) degrees
                  • Set EG_UHandleC = (Key (Last created unit))
                  • Hashtable - Save (Distance between EG_TempPoint and EG_TempPoint2) as 9 of EG_UHandleC in EG_EnergyGlyphHash
                  • Hashtable - Save ((Load 9 of EG_UHandleC from EG_EnergyGlyphHash) x EG_OrbHeightMultiplyer) as 10 of EG_UHandleC in EG_EnergyGlyphHash
                  • Custom script: call RemoveLocation (udg_EG_TempPoint2)
                  • Custom script: call RemoveLocation (udg_EG_TempPoint)
                  • -------- Glyph Stage Indicator --------
                  • Hashtable - Save 3 as 1 of EG_UHandleC in EG_EnergyGlyphHash
                  • -------- Glyph Creator Indicator --------
                  • Hashtable - Save Handle Of(Load 3 of EG_UHandle in EG_EnergyGlyphHash) as 3 of EG_UHandleC in EG_EnergyGlyphHash
                  • -------- Orb Damage --------
                  • Hashtable - Save (Load 4 of EG_UHandle from EG_EnergyGlyphHash) as 4 of EG_UHandleC in EG_EnergyGlyphHash
                  • -------- Orb AOE --------
                  • Hashtable - Save (Load 5 of EG_UHandle from EG_EnergyGlyphHash) as 5 of EG_UHandleC in EG_EnergyGlyphHash
                  • Unit Group - Add (Last created unit) to EG_EnergyGlyphs
                • Else - Actions
                  • Unit - Kill EG_u
                  • Unit Group - Remove EG_u from EG_EnergyGlyphs
                  • If ((Number of units in EG_EnergyGlyphs) Equal to 0) then do (Trigger - Turn off (This trigger)) else do (Do nothing)
            • Else - Actions
          • -------- Stage 3 - Moving Orbs/Orb damage --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 1 of EG_UHandle from EG_EnergyGlyphHash) Equal to 3
            • Then - Actions
              • Custom script: set udg_EG_TempX = GetUnitX(udg_EG_u)
              • Custom script: set udg_EG_TempY = GetUnitY(udg_EG_u)
              • Set EG_Angle = (Facing of EG_u)
              • Custom script: call SetUnitX(udg_EG_u, udg_EG_TempX + udg_EG_OrbSpeed * Cos(udg_EG_Angle * bj_DEGTORAD))
              • Custom script: call SetUnitY(udg_EG_u, udg_EG_TempY + udg_EG_OrbSpeed * Sin(udg_EG_Angle * bj_DEGTORAD))
              • Hashtable - Save ((Load 11 of EG_UHandle from EG_EnergyGlyphHash) + EG_OrbSpeed) as 11 of EG_UHandle in EG_EnergyGlyphHash
              • Hashtable - Save (((4.00 x (Load 10 of EG_UHandle from EG_EnergyGlyphHash)) / (Load 9 of EG_UHandle from EG_EnergyGlyphHash)) x (((Load 11 of EG_UHandle from EG_EnergyGlyphHash) / (Load 9 of EG_UHandle from EG_EnergyGlyphHash)) x ((Load 9 of EG_UHandle from EG_EnergyGlyphHash as 12 of EG_UHandle in EG_EnergyGlyphHash
              • Animation - Change EG_u flying height to (Load 12 of EG_UHandle from EG_EnergyGlyphHash) at 0.00
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load 12 of EG_UHandle from EG_EnergyGlyphHash) Less than 0.00
                • Then - Actions
                  • Set EG_TempPoint = (Position of EG_u)
                  • Set EG_TempGroup = (Units within (Load 5 of EG_UHandle from EG_EnergyGlyphHash) of EG_TempPoint)
                  • Unit Group - Pick every unit in EG_TempGroup and do (Actions)
                    • Loop - Actions
                      • Set EG_Tempu = (Picked unit)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (EG_Tempu is A ground unit) Equal to True
                          • (EG_Tempu is alive) Equal to True
                          • (EG_Tempu is Magic Immune) Equal to False
                          • (EG_Tempu belongs to an enemy of (Owner of EG_u)) Equal to True
                        • Then - Actions
                          • Unit - Cause (Load 3 of EG_UHandle in EG_EnergyGlyphHash) to damage EG_Tempu, dealing (Load 4 of EG_UHandle from EG_EnergyGlyphHash) damage of attack type Spells and damage type Normal
                        • Else - Actions
                  • Custom script: call RemoveLocation (udg_EG_TempPoint)
                  • Custom script: call DestroyGroup(udg_EG_TempGroup)
                  • Unit Group - Remove EG_u from EG_EnergyGlyphs
                  • Unit - Kill EG_u
                • Else - Actions
            • Else - Actions
          • -------- Movement speed reduction/increase (entry/exit) --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 1 of EG_UHandle from EG_EnergyGlyphHash) Equal to 4
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load 13 of EG_UHandle from EG_EnergyGlyphHash) Greater than 0
                • Then - Actions
                  • Unit - Set EG_u movement speed to ((Current movement speed of EG_u) / EG_EnergySlowDivider)
                  • Hashtable - Save ((Load 13 of EG_UHandle from EG_EnergyGlyphHash) - 1) as 13 of EG_UHandle in EG_EnergyGlyphHash
                • Else - Actions
                  • Unit - Set EG_u movement speed to ((Current movement speed of EG_u) x EG_EnergySlowDivider)
                  • Unit Group - Remove EG_u from EG_EnergyGlyphs
                  • Hashtable - Save 0 as 1 of EG_UHandle in EG_EnergyGlyphHash
            • Else - Actions
          • -------- Adding units to the movement speed reduction --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of EG_u) Equal to Energy Glyph
            • Then - Actions
              • Set EG_TempPoint = (Position of EG_u)
              • Set EG_TempGroup = (Units within (Load 7 of EG_UHandle from EG_EnergyGlyphHash) of EG_TempPoint)
              • Unit Group - Pick every unit in EG_TempGroup and do (Actions)
                • Loop - Actions
                  • Set EG_Tempu = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (EG_Tempu is A ground unit) Equal to True
                      • (EG_Tempu is alive) Equal to True
                      • (EG_Tempu is Magic Immune) Equal to False
                      • (EG_Tempu belongs to an enemy of (Owner of EG_u)) Equal to True
                    • Then - Actions
                      • Set EG_UHandleC = (Key (Picked unit))
                      • Hashtable - Save ((Load 13 of EG_UHandleC from EG_EnergyGlyphHash) + 1) as 13 of EG_UHandleC in EG_EnergyGlyphHash
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Matching unit) is in EG_EnergyGlyphs) Equal to False
                        • Then - Actions
                          • Hashtable - Save 4 as 1 of EG_UHandleC in EG_EnergyGlyphHash
                          • Unit Group - Add EG_Tempu to EG_EnergyGlyphs
                        • Else - Actions
                    • Else - Actions
              • Custom script: call RemoveLocation (udg_EG_TempPoint)
              • Custom script: call DestroyGroup(udg_EG_TempGroup)
            • Else - Actions


- Energy Matrix
Configuration
  • 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_LightningLowHeightCaster = 75.00
      • Set EM_LightningLowHeightTarget = 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 --------
      • -------- -------- --------
Activation
  • 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)
Loop
  • 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