• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Lightning Storm v1.`

  • Like
Reactions: Losam and Erkki2
Jazztastic Presents
Lightning Storm
204466-albums4802-picture60045.jpg

204466-albums4802-picture60046.jpg
204466-albums4802-picture60047.jpg
  • Hashtable
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set hashtable = (Last created hashtable)
      • -------- To change the duration edit the value in the Object Editor named "Follow Through Time" --------
      • -------- If TRUE, will burn mana equal to the damage --------
      • Set manaburn = True
      • -------- Sets the damage done per bolt --------
      • Set damage[1] = 35.00
      • Set damage[2] = 55.00
      • Set damage[3] = 75.00
      • -------- The pick range for the random unit --------
      • Set areaofeffect[1] = 1200.00
      • Set areaofeffect[2] = 1400.00
      • Set areaofeffect[3] = 1600.00
      • -------- Ground SFX --------
      • Set unitsfx = Abilities\Weapons\Bolt\BoltImpact.mdl
      • -------- The Order ID. This must correspond with the ability ID in the base ability --------
      • Set orderid = channel
  • Lightning Storm Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Storm
    • Actions
      • -------- Simply primes the loop --------
      • Unit Group - Add (Triggering unit) to stormgroup
      • Trigger - Turn on Lightning Storm Loop <gen>
  • Lightning Storm Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in stormgroup and do (Actions)
        • Loop - Actions
          • Set caster = (Picked unit)
          • Custom script: set udg_handle = GetHandleId(udg_caster)
          • -------- We destroy the lightning here because we want it gone regardless of whether the unit is channeling or not --------
          • -------- If we only destroyed it if it was channeling, a lightning would be left at the end --------
          • Set boolean = (Load 1 of handle from hashtable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • boolean Equal to True
            • Then - Actions
              • Hashtable - Save False as 1 of handle in hashtable
              • Lightning - Destroy (Load 0 of handle in hashtable)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Current order of caster) Equal to (Order(orderid))
                  • (Life of caster) Greater than 0.00
                • Then - Actions
                  • -------- It only strikes every other instance. --------
                  • -------- This way there is a visible strike each time, not just it jumping from one spot to another --------
                  • -------- Setting stuff --------
                  • Set point1 = (Position of caster)
                  • Set level = (Level of Lightning Storm for caster)
                  • Custom script: set bj_wantDestroyGroup = true
                  • Set target = (Random unit from (Units within areaofeffect[level] of point1 matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to
                  • -------- Simply checks if there is a unit within AoE --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • target Equal to No unit
                    • Then - Actions
                    • Else - Actions
                      • Set point2 = (Position of target)
                      • -------- Sets the lightning, and sets the sfx --------
                      • Custom script: set udg_light = AddLightningEx("FORK", true, GetUnitX(udg_caster), GetUnitY(udg_caster), GetLocationZ(udg_point1) + 1400, GetUnitX(udg_target), GetUnitY(udg_target), GetLocationZ(udg_point2) + GetUnitFlyHeight(udg_target))
                      • Special Effect - Create a special effect attached to the origin of target using unitsfx
                      • Special Effect - Destroy (Last created special effect)
                      • -------- Damage + manaburn --------
                      • Unit - Cause caster to damage target, dealing damage[level] damage of attack type Spells and damage type Normal
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • manaburn Equal to True
                        • Then - Actions
                          • Unit - Set mana of target to ((Mana of target) - damage[level])
                        • Else - Actions
                      • Hashtable - Save Handle Oflight as 0 of handle in hashtable
                      • Hashtable - Save True as 1 of handle in hashtable
                      • Custom script: call RemoveLocation(udg_point2)
                • Else - Actions
                  • Hashtable - Clear all child hashtables of child handle in hashtable
                  • Unit Group - Remove caster from stormgroup
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in stormgroup) Equal to 0
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
              • Hashtable - Save True as 1 of handle in hashtable
              • Custom script: call RemoveLocation(udg_point1)
Authors Notes
This is the first channeling spell I've ever made. I looked at a spell by dark_g4andalf for how to trigger channeling,
so I guess a shout-out goes to him. It's hard to capture this spell with a screenshot so you should really look at it in-game.
If you use this credits go to Jazztastic.

Keywords:
Lightning Storm, Lightning, Storm
Contents

Just another Warcraft III map (Map)

Reviews
09:06, 2nd Aug 2012 Magtheridon96: Approved. You didn't really need that extra complexity with the booleans, but it's totally fine in my book. Good job. The configuration is decent too.

Moderator

M

Moderator

09:06, 2nd Aug 2012
Magtheridon96: Approved. You didn't really need that extra complexity with the booleans, but it's totally fine in my book.
Good job.
The configuration is decent too.
 
Level 25
Joined
Jun 5, 2008
Messages
2,573
This could be further optimized by removing the use of locations altogether.

For example, declare locals:
  • Custom script: local real x
  • Custom script: local real y
  • Custom script: local real tx
  • Custom script: local real ty
Then in loop:
  • Custom script: set x = GetUnitX(udg_caster)
  • Custom script set y = GetUnitY(udg_caster)
  • Custom script: set tx = GetUnitX(udg_target)
  • Custom script set ty = GetUnitY(udg_target)
Then use those coordinates how you see fit.

Edit:

  • (Units within areaofeffect[level] of point1 matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to
I am pretty sure this leaks a group also.
 
Updated. Fixed the leak from the unit group and optimized it by using GetUnitX/Y rather than the location (although I still had to have them for the Z). I also included Kingz recommendation for special effects.

EDIT: I changed the order of the loop. This way, it'll only check if it is channeling every other cycle (only when it's being created). It will be more efficient and work better. It will also make sure the loop doesnt stop before the last lightning is destroyed, and it wont destroy a lightning before it's created. I also added in the Order ID as a string for the user to change. Finally, I fixed the triggering unit in the cast trigger. This should be ready for approval unless I incorrectly changed the loop.
 
Last edited:
Level 25
Joined
Jun 5, 2008
Messages
2,573
Or you know...
JASS:
if GetUnitState(u, UNIT_STATE_MANA) < Damage then
 call UnitDamageTarget(caster, u, GetUnitState(u, UNIT_STATE_MANA), ...)
 call SetUnitState(u, UNIT_STATE_MANA, 0)
else
 call UnitDamageTarget(caster, u, Damage, ...)
 call SetUnitState(u, UNIT_STATE_MANA, GetUnitState(u, UNIT_STATE_MANA) - Damage)
endif

A simple if/then/else statement could do it also.
I know it's in jass but i can't remember the statements in GUI.
 
Top