• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Wild Energy V1.10

I made this as my first passive spell out of curiousty and also just to try something new.

Wild Energy:
Tooltip:
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.


- Heavily configurable
- Homing projectile
- Single-target spell (although with AOE damage)
- Passive spell



  • Wild Energy Configuration
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Do not touch --------
      • Hashtable - Create a hashtable
      • Set WE_WildEnergyHash = (Last created hashtable)
      • -------- ---------- --------
      • -------- Sets the AOE of the damage of the Energy Sphere --------
      • Set WE_EnergyAOEBase = 100.00
      • Set WE_EnergyAOEPerLevel = 50.00
      • -------- Sets how close the Sphere must be to detonate --------
      • Set WE_EnergyDetonationRange = 50.00
      • -------- Sets the chance of the spell activating (%) --------
      • Set WE_EnergyChanceBase = 20
      • Set WE_EnergyChancePerLevel = 20
      • -------- Sets the search range for finding a target (if none is found the Sphere is not created) --------
      • Set WE_EnergyMaxSearchRangeBase = 400.00
      • Set WE_EnergyMaxSearchRangePerLevl = 100.00
      • -------- Sets the speed of how fast the search is made (change depending on your computer speed) --------
      • Set WE_EnergySearchGrowthSpeed = 10.00
      • -------- Sets the damage of the Sphere based on this x the missing mana (out of max) for the unit using it --------
      • Set WE_EnergyMultiplyerBase = 0.00
      • Set WE_EnergyMultiplyerPerLevel = 0.50
      • -------- Sets the speed the Sphere moves --------
      • Set WE_EnergySpeed = 6.00
      • -------- Sets how long the Sphere will follow for --------
      • Set WE_EnergyTime = 15.00
      • -------- Sets how high the lightning effect will be --------
      • Set WE_EnergyHeight = 75.00
      • -------- Sets the number of spheres created when it's activated --------
      • Set WE_EnergyCountMax = 1
      • -------- ---------- --------
  • Wild Energy Activation
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Level of Wild Energy for (Triggering unit)) Greater than or equal to 1
    • Actions
      • Set WE_u = (Triggering unit)
      • Set WE_EnergyChanceRandomiser = (Random integer number between 1 and 100)
      • Set TempIntStore = (Level of Wild Energy for WE_u)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WE_EnergyChanceRandomiser Less than or equal to (WE_EnergyChanceBase + (WE_EnergyChancePerLevel x TempIntStore))
          • (Mana of WE_u) Not equal to (Max mana of WE_u)
        • Then - Actions
          • Set WE_TempPoint = (Position of WE_u)
          • Set WE_EnergyCurrentSearchRange = 0.00
          • Set WE_EnergyCount = WE_EnergyCountMax
          • For each (Integer WE_i) from 1 to (((Integer(WE_EnergyMaxSearchRangeBase)) + ((Integer(WE_EnergyMaxSearchRangePerLevl)) x TempIntStore)) / (Integer(WE_EnergySearchGrowthSpeed))), do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • WE_EnergyCount Not equal to 0
                • Then - Actions
                  • Set WE_EnergyCurrentSearchRange = (WE_EnergyCurrentSearchRange + WE_EnergySearchGrowthSpeed)
                  • Set WE_TempGroup = (Units within WE_EnergyCurrentSearchRange of WE_TempPoint)
                  • Unit Group - Pick every unit in WE_TempGroup and do (Actions)
                    • Loop - Actions
                      • Set WE_TempU = (Picked unit)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (WE_TempU is A ground unit) Equal to True
                          • (WE_TempU is alive) Equal to True
                          • (WE_TempU is Magic Immune) Equal to False
                          • (WE_TempU is A structure) Equal to False
                          • (WE_TempU belongs to an enemy of (Owner of WE_u)) Equal to True
                        • Then - Actions
                          • Set WE_TempRealStore = (Real((Level of Wild Energy for WE_u)))
                          • Set WE_EnergyCount = (WE_EnergyCount - 1)
                          • Trigger - Turn on Wild Energy Loop <gen>
                          • Unit - Create 1 Energy Sphere for (Owner of WE_u) at WE_TempPoint facing Default building facing degrees
                          • Set WE_TempU = (Last created unit)
                          • Unit - Add a WE_EnergyTime second Generic expiration timer to WE_TempU
                          • Unit - Change color of WE_TempU to (Color of Neutral Hostile)
                          • Unit Group - Add WE_TempU to WE_WildEnergyGroup
                          • Special Effect - Create a special effect at WE_TempPoint using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
                          • Special Effect - Destroy (Last created special effect)
                          • Custom script: set udg_WE_UHandle = GetHandleId(udg_WE_TempU)
                          • Set WE_TempU = (Picked unit)
                          • Hashtable - Save Handle OfWE_TempU as 1 of WE_UHandle in WE_WildEnergyHash
                          • Hashtable - Save (((Max mana of WE_u) - (Mana of WE_u)) x (WE_EnergyMultiplyerBase + (WE_EnergyMultiplyerPerLevel x WE_TempRealStore))) as 2 of WE_UHandle in (Last created hashtable)
                          • Hashtable - Save (WE_EnergyAOEBase + (WE_EnergyAOEPerLevel x WE_TempRealStore)) as 3 of WE_UHandle in (Last created hashtable)
                          • Hashtable - Save Handle OfWE_u as 4 of WE_UHandle in WE_WildEnergyHash
                        • Else - Actions
                  • Custom script: call DestroyGroup (udg_WE_TempGroup)
                • Else - Actions
        • Else - Actions
          • Custom script: call RemoveLocation(udg_WE_TempPoint)
  • Wild Energy Sphere death
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Energy Sphere
    • Actions
      • Set WE_u = (Triggering unit)
      • Set WE_UHandle = (Key (Triggering unit))
      • Set WE_TempPoint = (Position of WE_u)
      • Unit - Kill WE_u
      • Unit Group - Remove WE_u from WE_WildEnergyGroup
      • Lightning - Destroy (Load 5 of WE_UHandle in WE_WildEnergyHash)
      • Special Effect - Create a special effect at WE_TempPoint using Objects\Spawnmodels\NightElf\NEDeathMedium\NEDeath.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set WE_TempGroup = (Units within (Load 3 of WE_UHandle from WE_WildEnergyHash) of WE_TempPoint)
      • Unit Group - Pick every unit in WE_TempGroup and do (Actions)
        • Loop - Actions
          • Set WE_TempU = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (WE_TempU is Magic Immune) Equal to False
              • ((Unit-type of WE_TempU) is A structure) Equal to False
              • (WE_TempU is A ground unit) Equal to True
              • (WE_TempU is alive) Equal to True
              • (WE_TempU belongs to an enemy of (Owner of WE_u)) Equal to True
            • Then - Actions
              • Unit - Cause (Load 4 of WE_UHandle in WE_WildEnergyHash) to damage (Picked unit), dealing (Load 2 of WE_UHandle from WE_WildEnergyHash) damage of attack type Spells and damage type Normal
            • Else - Actions
      • Custom script: call DestroyGroup (udg_WE_TempGroup)
      • Custom script: call RemoveLocation(udg_WE_TempPoint)
      • If ((Number of units in WE_WildEnergyGroup) Equal to 0) then do (Trigger - Turn off Wild Energy Loop <gen>) else do (Do nothing)
  • Wild Energy Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in WE_WildEnergyGroup and do (Actions)
        • Loop - Actions
          • Set WE_u = (Picked unit)
          • Set WE_UHandle = (Key (Picked unit))
          • Lightning - Destroy (Load 5 of WE_UHandle in WE_WildEnergyHash)
          • Set WE_TempPoint = (Position of WE_u)
          • Set WE_TempPoint2 = (Position of (Load 1 of WE_UHandle in WE_WildEnergyHash))
          • Custom script: set udg_WE_TempLightning = AddLightningEx("CLPB", true, GetLocationX(udg_WE_TempPoint), GetLocationY(udg_WE_TempPoint), udg_WE_EnergyHeight, GetLocationX(udg_WE_TempPoint2), GetLocationY(udg_WE_TempPoint2), udg_WE_EnergyHeight)
          • Hashtable - Save Handle OfWE_TempLightning as 5 of WE_UHandle in WE_WildEnergyHash
          • Set WE_Angle = (Angle from WE_TempPoint to WE_TempPoint2)
          • Custom script: call RemoveLocation(udg_WE_TempPoint2)
          • Custom script: set udg_WE_TempX = GetUnitX(udg_WE_u)
          • Custom script: set udg_WE_TempY = GetUnitY(udg_WE_u)
          • Custom script: call SetUnitX(udg_WE_u, udg_WE_TempX + udg_WE_EnergySpeed * Cos(udg_WE_Angle * bj_DEGTORAD))
          • Custom script: call SetUnitY(udg_WE_u, udg_WE_TempY + udg_WE_EnergySpeed * Sin(udg_WE_Angle * bj_DEGTORAD))
          • Set WE_TempGroup = (Units within WE_EnergyDetonationRange of WE_TempPoint matching ((((Matching unit) is A ground unit) Equal to True) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of WE_u)) Equal to True) and ((((M
          • Unit Group - Pick every unit in WE_TempGroup and do (Actions)
            • Loop - Actions
              • Set WE_TempU = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (WE_TempU is Magic Immune) Equal to False
                  • ((Unit-type of WE_TempU) is A structure) Equal to False
                  • (WE_TempU is A ground unit) Equal to True
                  • (WE_TempU is alive) Equal to True
                  • (WE_TempU belongs to an enemy of (Owner of WE_u)) Equal to True
                  • (Number of units in WE_TempGroup) Greater than 0
                • Then - Actions
                  • Unit - Kill WE_u
                • Else - Actions
          • Custom script: call RemoveLocation(udg_WE_TempPoint)
          • Custom script: call DestroyGroup (udg_WE_TempGroup)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Load 1 of WE_UHandle in WE_WildEnergyHash) is dead) Equal to True
            • Then - Actions
              • Unit - Kill WE_u
            • Else - Actions



-=V1.00=-
- Initial upload
- expect errors (yay)
-=V1.05=-
- Quick modification to the unit group selection for impact


Give credits if you use this spell.

This spell is a continuation of my self-set 1 spell a day challenge for a week (day 3)

Enjoy

Keywords:
Wild, Uncontrollable, Mana, Energy, Release, Homing, Magic, Summon, sphere, ball, passive, spell.
Contents

Wild Energy (Map)

Reviews
19th Dec 2011 Bribe: I like it, and the coding skill is above requirements. Approved 4/5 (Recommended).

Moderator

M

Moderator

19th Dec 2011
Bribe: I like it, and the coding skill is above requirements. Approved 4/5 (Recommended).
 
  • Set WE_TempGroup = (Units within (Load 3 of WE_UHandle from WE_WildEnergyHash) of WE_TempPoint)
  • Unit Group - Pick every unit in WE_TempGroup and do (Actions)
    • Loop - Actions
      • Set WE_TempU = (Picked unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (WE_TempU is Magic Immune) Equal to False
          • ((Unit-type of WE_TempU) is A structure) Equal to False
          • (WE_TempU is A ground unit) Equal to True
          • (WE_TempU is alive) Equal to True
          • (WE_TempU belongs to an enemy of (Owner of WE_u)) Equal to True
        • Then - Actions
          • Unit - Cause (Load 4 of WE_UHandle in WE_WildEnergyHash) to damage (Picked unit), dealing (Load 2 of WE_UHandle from WE_WildEnergyHash) damage of attack type Spells and damage type Normal
        • Else - Actions
  • Custom script: call DestroyGroup (udg_WE_TempGroup)
You can use that 'set bj_wantDestroyGroup = true' thing instead:

  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units within (Load 3 of WE_UHandle from WE_WildEnergyHash) of WE_TempPoint) and do (Actions)
    • Loop - Actions
      • Set WE_TempU = (Picked unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (WE_TempU is Magic Immune) Equal to False
          • ((Unit-type of WE_TempU) is A structure) Equal to False
          • (WE_TempU is A ground unit) Equal to True
          • (WE_TempU is alive) Equal to True
          • (WE_TempU belongs to an enemy of (Owner of WE_u)) Equal to True
        • Then - Actions
          • Unit - Cause (Load 4 of WE_UHandle in WE_WildEnergyHash) to damage (Picked unit), dealing (Load 2 of WE_UHandle from WE_WildEnergyHash) damage of attack type Spells and damage type Normal
        • Else - Actions
edit

In the second trigger:

  • Set WE_UHandle = (Key (Last created unit))
->
  • Custom script: set udg_WE_UHandle = GetHandleId(udg_WE_TempU)
(Since you already cached the last created unit previously)

Oh and that bj_wantDestroyGroup thing can apply everywhere else too.

edit

  • Custom script: call RemoveLocation(udg_WE_TempPoint)
This line should be parallel to this: (meaning that you should put the custom script outside of the For loop.)

  • Set WE_TempPoint = (Position of WE_u)
Otherwise, it could leak.


It looks pretty decent overall.
 
Thanks for the notes, I'll make the appropriate changes momentarily, don't know if I'll bother with the wantdestroygroup thing - I like sticking to the standard format I normally use (even if it's a little less efficient).

Edit: Not sure about the set WE_UHandle change, I'll have to look at it again and get my head around it
Edit2: just got it, give me a second
 
Top