Spell Instant Chain Lightning

Discussion in 'Spells' started by Weep, Aug 14, 2009.

  1. Weep

    Weep Godspeed to the sound of the pounding

    Ratings:
    +400 / 0 / -0
    Instant Chain Lightning
    by Weep
    Version 3.1

    [​IMG]

    I don't know what kind of wimpy electricity the Far Seer uses, but where I come from, lightning travels faster than you can blink... ;)

    -- General information --

    This spell is an instant-hit version of Chain Lightning. All bounces hit simultaneously, immediately; there is no "walking" of the spell from bounce to bounce.

    Custom spell behaviors can be easily added - modify the Hit Actions and Target Conditions triggers. Want to make chain mana burn, chain stun, chain heal, chain charm, and so on? All possible.

    -- Pros --
    • GUI (mostly!)
    • MUI without indexing or periodic actions
    • Leakless (as much as GUI+custom script can be)
    • Properly targets all units, even flying units near cliffs and trees
    • Easily modified and enhanced
    • Easily duplicated in the same map
    • Satisfyin' (zap!)

    -- Cons --
    • GUI :)P)
    • Sets more values on cast than strictly necessary (makes customization easier)
    • Uses Spirit Link to generate the lightning bounces, so it will cancel existing instances of Spirit Link on targets. (Spirit Link sucks as a stock ability anyway.)

    -- Description and implementation instructions --
    Code:
    Instant Chain Lightning -- v3.1 -- by Weep
    http://www.thehelper.net/forums/showthread.php?t=134499
    
       Requires:
       1. Unit "Dummy Caster"
       2. An ability for the spell base, default is "Instant Lightning Base (For Hero)"
       3. The dummy ability "Instant Lightning Effects (Chain)"
       3b. Any spells used for modifications to the defaults (check the Hit Actions trigger)
       4. The three triggers in this category
    
    -- What? --
       This spell is an instant-hit version of Chain Lightning with easy customizability.
       All bounces hit simultaneously, immediately; there is no "walking" of the spell from
       bounce to bounce.
    
       It is fully MUI, and can be called easily by other triggers to create compound abilities.
    
    -- How To Implement --
       1. Be sure "Automatically create unknown variables while pasting trigger data" is
          enabled in the World Editor general preferences.
       2. Copy the requirements listed above into your map.
       3. The rawcodes for the imported units and abilities have probably changed;
          pick your base ability in the conditions of the Cast trigger,
          and set the variables in the first section of the trigger to the specified resources.
    
    -- How To Modify --
       This spell is easy to duplicate for multiple versions, even in the same map.  The
       global values set at the start are there for convenience; they are only used in that
       trigger, so making a new copy of the spell is as easy as renaming the triggers
       and changing the settings before copying it into your map.
       
       To change the lightning type, copy and edit the Instant Lightning Base and
       Instant Lightning Effects abilities.
    
       Custom spell behaviors can be easily added - modify the Hit Actions and Target Conditions
       triggers.  Want to make chain mana burn, chain stun, chain heal, chain charm, and so on?
       All possible.
    
    -- Credits --
       Feel free to customize this spell for your map, but please do not specifically post
       spells based on it.  Credit in your map not needed, but appreciated, but please
       include this README.
    
    -- Version History --
       3.0: Second release; overhauled for simplicity and ease of modification, at slight cost
            to ease of duplication.
       1.0 (array): First release.
    

    -- Triggers --
    Trigger:
    • Instant Chain Cast
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Instant Lightning Base (For Hero)
      • Actions
        • -------- Instant Chain Template by Weep --------
        • -------- http://www.thehelper.net/forums/showthread.php?t=134499 --------
        • -------- @@@ Globals @@@ --------
        • -------- --------
        • -------- ••• The base hero ability ••• --------
        • -------- Default is "Instant Lightning Base (For Hero)" --------
        • Set INST__BaseAbility = Instant Lightning Base (For Hero)
        • -------- --------
        • -------- ••• The dummy unit-type ••• --------
        • -------- Default is "Dummy Caster" --------
        • Set INST__DummyType = Dummy Caster
        • -------- --------
        • -------- ••• The dummy ability for lightning effects ••• --------
        • -------- Default is "Instant Lightning Effects (Chain)" --------
        • Set INST__EffectAbility = Instant Lightning Effects (Chain)
        • -------- --------
        • -------- ••• The number of bounces of the spell, per level ••• --------
        • -------- which means Total Targets Hit = Bounces + 1 --------
        • Set INST__Bounces[1] = 2
        • Set INST__Bounces[2] = 3
        • Set INST__Bounces[3] = 4
        • Set INST__Bounces[4] = 5
        • -------- --------
        • -------- ••• Maximum range for the spell to bounce, per level ••• --------
        • Set INST__AreaToBounce[1] = 500.00
        • Set INST__AreaToBounce[2] = 500.00
        • Set INST__AreaToBounce[3] = 500.00
        • Set INST__AreaToBounce[4] = 500.00
        • -------- --------
        • -------- ••• The number of steps to use when finding a nearby target ••• --------
        • -------- Too high and it may lag; too low and it will be imprecise --------
        • Set INST__RangeSteps = 10
        • -------- --------
        • -------- ••• The base damage of the spell, per level ••• --------
        • Set INST__BaseDamage[1] = 75.00
        • Set INST__BaseDamage[2] = 100.00
        • Set INST__BaseDamage[3] = 125.00
        • Set INST__BaseDamage[4] = 150.00
        • -------- --------
        • -------- ••• The multiplier applied to the damage for each bounce, per level ••• --------
        • Set INST__BounceMultiplier[1] = 0.85
        • Set INST__BounceMultiplier[2] = 0.85
        • Set INST__BounceMultiplier[3] = 0.85
        • Set INST__BounceMultiplier[4] = 0.85
        • -------- --------
        • -------- @@@ Spell actions @@@ --------
        • -------- ••••••••••••••••••••••••••••••••••••••• --------
        • -------- Prepare the dummy caster, if necessary --------
        • -------- --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (INST_DummyCaster is dead) Equal to True
          • Then - Actions
            • Set INST_TargetPoint = (Point(0.00, 0.00))
            • Unit - Create 1 INST__DummyType for Neutral Passive at INST_TargetPoint facing Default building facing degrees
            • Unit - Add INST__EffectAbility to (Last created unit)
            • Set INST_DummyCaster = (Last created unit)
            • Custom script: call RemoveLocation(udg_INST_TargetPoint)
          • Else - Actions
        • -------- ••••••••••••••••••••••••••••••••••••••• --------
        • -------- ••• Remove the Anicent classification from all units because that is how the effects are targeted ••• --------
        • -------- --------
        • Set INST_Ancients = (Units in (Playable map area) matching (((Matching unit) is An Ancient) Equal to True))
        • Unit Group - Pick every unit in INST_Ancients and do (Actions)
          • Loop - Actions
            • Unit - Remove classification of An Ancient from (Picked unit)
        • -------- ••••••••••••••••••••••••••••••••••••••••••••••••• --------
        • -------- Perform the hit actions on the first target --------
        • -------- --------
        • Set INST_CurrentBounce = 0
        • Set INST_Target = (Target unit of ability being cast)
        • Trigger - Run Instant Chain Hit Actions <gen> (checking conditions)
        • -------- ••••••••••••••••••••••••••••••••••••••• --------
        • -------- Find a chain and save it into a group --------
        • -------- --------
        • For each (Integer INST_CurrentBounce) from 1 to INST__Bounces[(Level of INST__BaseAbility for (Triggering unit))], do (Actions)
          • Loop - Actions
            • Unit Group - Add INST_Target to INST_TargetGroup
            • -------- ••••••••••••••••••••••••••••••••••••••• --------
            • Set INST_TargetPoint = (Position of INST_Target)
            • For each (Integer INST_TempInteger) from 1 to INST__RangeSteps, do (Actions)
              • Loop - Actions
                • -------- ••••••••••••••••••••••••••••••••••••••• --------
                • -------- ••• Finding the next target ••• --------
                • -------- --------
                • Set INST_TempGroup = (Units within (INST__AreaToBounce[(Level of INST__BaseAbility for (Triggering unit))] x ((Real(INST_TempInteger)) / (Real(INST__RangeSteps)))) of INST_TargetPoint matching ((((Matching unit) is in INST_TargetGroup) Equal to False) and ((((Matching unit) is al
                • Set INST_TempUnit = (Random unit from INST_TempGroup)
                • -------- ••••••••••••••••••••••••••••••••••••••• --------
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • INST_TempUnit Not equal to No unit
                  • Then - Actions
                    • -------- ••••••••••••••••••••••••••••••••••••••••••••••••• --------
                    • -------- Create the FX for the next bounce if there is a valid target --------
                    • -------- --------
                    • Unit - Add classification of An Ancient to INST_Target
                    • Unit - Add classification of An Ancient to INST_TempUnit
                    • Unit - Order INST_DummyCaster to Orc Spirit Walker - Spirit Link INST_Target
                    • Unit - Remove Tornado (Timed Life) buff from INST_Target
                    • Unit - Remove Tornado (Timed Life) buff from INST_TempUnit
                    • Unit - Remove classification of An Ancient from INST_Target
                    • Unit - Remove classification of An Ancient from INST_TempUnit
                    • -------- ••••••••••••••••••••••••••••••••••••••••••••••••• --------
                    • -------- Perform the hit actions on the target --------
                    • -------- --------
                    • Set INST_Target = INST_TempUnit
                    • Trigger - Run Instant Chain Hit Actions <gen> (checking conditions)
                    • Custom script: exitwhen true
                  • Else - Actions
                    • Custom script: call DestroyGroup(udg_INST_TempGroup)
            • Custom script: call RemoveLocation(udg_INST_TargetPoint)
            • Custom script: call DestroyGroup(udg_INST_TempGroup)
            • -------- ••••••••••••••••••••••••••••••••••••••••••••••••• --------
            • -------- Stop the chain if there are no valid targets --------
            • -------- --------
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • INST_TempUnit Equal to No unit
              • Then - Actions
                • Custom script: exitwhen true
              • Else - Actions
        • -------- ••••••••••••••••••••••••••••••••••••••• --------
        • -------- ••• Restore the Anicent classification to units which ought to have it ••• --------
        • -------- --------
        • Unit Group - Pick every unit in INST_Ancients and do (Actions)
          • Loop - Actions
            • Unit - Add classification of An Ancient to (Picked unit)
        • Custom script: call DestroyGroup(udg_INST_Ancients)
        • -------- ••••••••••••••••••••••••••••••••••••••• --------
        • Unit Group - Remove all units from INST_TargetGroup

    Trigger:
    • Instant Chain Hit Actions
      • Events
      • Conditions
      • Actions
        • -------- The unit being hit is INST_Target. --------
        • -------- The original caster is (Triggering unit). --------
        • -------- The current bounce number is INST_CurrentBounce. --------
        • -------- ••••••••••••••••••••••••••••••••••••••••••••••••• --------
        • -------- --------
        • Unit - Cause (Triggering unit) to damage INST_Target, dealing (INST__BaseDamage[(Level of INST__BaseAbility for (Triggering unit))] x (Power(INST__BounceMultiplier[(Level of INST__BaseAbility for (Triggering unit))], (Real(INST_CurrentBounce))))) damage of attack type Spells and damage type Magic
        • Special Effect - Create a special effect attached to the origin of INST_Target using Abilities\Weapons\Bolt\BoltImpact.mdl
        • Special Effect - Destroy (Last created special effect)

    Trigger:
    • Instant Chain Target Conditions
      • Events
      • Conditions
        • ((Matching unit) is visible to (Owner of (Triggering unit))) Equal to True
        • ((Matching unit) is A structure) Equal to False
        • ((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True
        • ((Matching unit) is Magic Immune) Equal to False
      • Actions
        • -------- Add conditions to this trigger to specify permitted targets! --------
        • -------- The unit being checked is (Matching unit). --------
        • -------- The original caster is (Triggering unit). --------

    -- Version history --
    Code:
    3.1: Fixed a tiny but important error.
    3.0: Second release; overhauled for simplicity and ease of modification, at slight cost to ease of duplication.
    1.0: Initial release.

    -- Bonus --
    No bonus in initial the 3.0 release...
    [del]Pre-made variants on the base spell - Instant Chain Stun, Instant Healing Wave, Instant Chain Mana Burn, Instant Chain Venom, Instant Chain Explosion.[/del]

    --------------------------------------​

    Feedback welcome.
     

    Attached Files:

  2. 13lade619

    13lade619 is now a game developer :)

    Ratings:
    +399 / 0 / -0
    ...i think you can make the default chain lightning instant by changing a certain field.. i think the default is 0.3.. but you can reduce it.

    but the other spells you included are nice.
     
  3. Weep

    Weep Godspeed to the sound of the pounding

    Ratings:
    +400 / 0 / -0
    I've looked pretty hard and haven't found any setting that changes the chain bounce rate - not missile speed, not duration... Have I overlooked it? Do you know where this setting is?

    Thanks. :)
     
  4. Tom_Kazansky

    Tom_Kazansky --- wraith it ! ---

    Ratings:
    +157 / 0 / -0
    it's 0.25, I tested it :)

    and I don't think there is a field like that :rolleyes:
    ---------
    nice ;)
     
  5. Weep

    Weep Godspeed to the sound of the pounding

    Ratings:
    +400 / 0 / -0
    Updated to version 3.0. 2.0 was not released and was based on a faily attempt to use Forked Lightning as a glyph item; faily since many units can't use items even if given a hero inventory (eg. illusions). 3.0 is based on my realization that Spirit Link already nearly creates the visual effect of this on its own, so I can use it in the triggers.
     
  6. Weep

    Weep Godspeed to the sound of the pounding

    Ratings:
    +400 / 0 / -0
    Bump because nobody's seen it since being un-graveyarded. :eek:
     
  7. Weep

    Weep Godspeed to the sound of the pounding

    Ratings:
    +400 / 0 / -0
    Bump.
     
  8. BlackRose

    BlackRose Forum User

    Ratings:
    +239 / 0 / -0
    I don't see anything wrong with it. Makes for a nice GUI custom lightning template thingy. I think it is ready to go to heaven. Unless some evil reason comes in and intervenes.
     
  9. Sim

    Sim Forum Administrator Staff Member

    Ratings:
    +531 / 0 / -0
    My bad I missed this one. :p

    Approved!
     
  10. emjlr3

    emjlr3 Change can be a good thing Staff Member

    Ratings:
    +396 / 0 / -0
    i remember the old days of coding with GUI

    just looking at that makes my head spin
     
  11. sergykid

    sergykid Active Member

    Ratings:
    +0 / 0 / -0
    what if you use the trigger to it ? just set in the trigger the event "unit get hit by the spell..." stun the target of ability, and in the object editor you set the damage to 0, and the units that get hit are stunned from the trigger, and you have a chain stun. Would work ?
     
  12. Weep

    Weep Godspeed to the sound of the pounding

    Ratings:
    +400 / 0 / -0
    To add triggered effects, edit the actions in the trigger named "Instant Chain Hit Actions". For a chain stun, have a dummy caster use a stunning ability on the INST_Target unit.
     
  13. Weep

    Weep Godspeed to the sound of the pounding

    Ratings:
    +400 / 0 / -0
    Fixed a subtle but important error. :eek:
     

Share This Page