• 🏆 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!

Electric Charge - Version 1.1a

Sorry, it was very hard to get a good picture for the spell, check it ingame instead.


I created this ability because I didn't have anything to do exactly. Well, it's 100% MUI and LEAKLESS (what I can see, tell me if you find any leaks or something that makes this non-MUI).

The spell is a target-unit spell, it's really easy how it works. You simply electrify an enemie target unit. Each 2.5 second (you can change this) a lightning will be created and damage nearby units of this unit (enemie units). The lightning will jump x times, but it will deal less damage each jump it does. The electrified unit can't create lightnings at it self, it must have a nearby unit close to it to create a lightning. Yes, the lightning is able to jump back to the electrified unit.


- - - - - - - README - - - - - - -

This spell is called: Electric Charge.
Spell version: 1.1a
Spell created by: The_Flood (Flood @ hiveworkshop)

How do I modify this spell?

Well, the only things you'll have to change can be found in the "Electric Charge Cast" trigger. Read the comments and modify the spell
in the way you want it.

Remember, that a part of the spell is also located in the Object Editor. The ability EC_DummyAbility contains some things that this spell
uses. Like, damage, number of jumps, and more...



- - - - - - - How to import this spell? - - - - - - -

Make sure you've checked the box in: File > Preferences > General > Automatically create unknown variables while pasting trigger data.
This will make the import ALOT easier, or else you'll have to copy and paste all variables one by one.

The second thing you'll have to do is copy two spells and one unit. Copy those abilities:

1. Electric Charge
and
2. EC_DummyAbility

...and copy this unit:

1. EC_DummyUnit

When you're done with this you'll have to copy two triggers, they are below this "comment-trigger", they are:

1. Electric Charge Cast
and
2. Electric Charge Loop

...this is the only things you'll need for this ability.




  • Electric Charge Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Electric Charge
    • Actions
      • -------- - - - - - - - - - - - - - - - - - --------
      • -------- Do not change this --------
      • -------- - - - - - - - - - - - - - - - - - --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • EC_Index[2] Less than or equal to 0
        • Then - Actions
          • Trigger - Turn on Electric Charge Loop <gen>
        • Else - Actions
      • Set EC_Index[1] = (EC_Index[1] + 1)
      • Set EC_Index[2] = (EC_Index[2] + 1)
      • Set EC_Off[EC_Index[1]] = False
      • Set EC_CastingPlayer[EC_Index[1]] = (Owner of (Triggering unit))
      • Set EC_TargetUnit[EC_Index[1]] = (Target unit of ability being cast)
      • Set EC_AbilityLevel[EC_Index[1]] = (Level of (Ability being cast) for (Triggering unit))
      • Set EC_LightningTimer[EC_Index[1]] = 0.00
      • Set EC_MaxLightningTargetsCounter[EC_Index[1]] = 0
      • -------- - - - - - - - - - - - - - - - - - --------
      • -------- Change this to how you want it to be --------
      • -------- - - - - - - - - - - - - - - - - - --------
      • -------- - - - - - - - - - - - - - - - - - --------
      • -------- This is the "hit-effect" that will appear on the targeted unit when you cast the spell the first time (Default: Abilities\Weapons\Bolt\BoltImpact.mdl) --------
      • -------- - - - - - - - - - - - - - - - - - --------
      • Special Effect - Create a special effect attached to the origin of EC_TargetUnit[EC_Index[1]] using Abilities\Weapons\Bolt\BoltImpact.mdl
      • Special Effect - Destroy (Last created special effect)
      • -------- - - - - - - - - - - - - - - - - - --------
      • -------- Set this to the dummy ability, it's very important that you select the correct ability (Default: EC_DummyAbility) --------
      • -------- - - - - - - - - - - - - - - - - - --------
      • Set EC_DummyAbility[EC_Index[1]] = EC_DummyAbility
      • -------- - - - - - - - - - - - - - - - - - --------
      • -------- Set this to the dummy unit, it's very important that you select the correct unit (Default: EC_DummyUnit) --------
      • -------- - - - - - - - - - - - - - - - - - --------
      • Set EC_DummyUnit[EC_Index[1]] = EC_DummyUnit
      • -------- - - - - - - - - - - - - - - - - - --------
      • -------- This is the maximum targets that can be hit by a lightning each time a lightning is created (Default: 1) --------
      • -------- - - - - - - - - - - - - - - - - - --------
      • Set EC_MaxLightningTargets[EC_Index[1]] = 1
      • -------- - - - - - - - - - - - - - - - - - --------
      • -------- This is the effect of the targeted unit that will appear everytime a lightning will created from the targeted units body (Default: Abilities\Weapons\Bolt\BoltImpact.mdl) --------
      • -------- - - - - - - - - - - - - - - - - - --------
      • Set EC_TargetUnitEffect[EC_Index[1]] = Abilities\Weapons\Bolt\BoltImpact.mdl
      • -------- - - - - - - - - - - - - - - - - - --------
      • -------- This is the duration of the spell (Default: 20.00) --------
      • -------- - - - - - - - - - - - - - - - - - --------
      • Set EC_Duration[EC_Index[1]] = 20.00
      • -------- - - - - - - - - - - - - - - - - - --------
      • -------- This is how far the "targeted-lightning-unit" will detect nearby units and cast a lightning at them (Default: 500.00) --------
      • -------- - - - - - - - - - - - - - - - - - --------
      • Set EC_LightningDetectionAoE[EC_Index[1]] = 500.00
      • -------- - - - - - - - - - - - - - - - - - --------
      • -------- This is the duration until a new lightning will appear from the targeted units body to attack a nearby enemie unit (Default: 2.50) --------
      • -------- - - - - - - - - - - - - - - - - - --------
      • Set EC_LightningTimerMax[EC_Index[1]] = 2.50
      • -------- - - - - - - - - - - - - - - - - - --------
      • -------- - - - - - - - - - - - - - - - - - --------
      • -------- This is the effect that always will be visible until the duration ends at the targeted unit (Default: Abilities\Spells\Orc\LightningShield\LightningShieldTarget.mdl) --------
      • -------- - - - - - - - - - - - - - - - - - --------
      • Set EC_Effect_Show[EC_Index[1]] = Abilities\Spells\Orc\LightningShield\LightningShieldTarget.mdl
      • -------- - - - - - - - - - - - - - - - - - --------
      • -------- - - - - - - - - - - - - - - - - - --------
      • -------- Do not change this --------
      • -------- - - - - - - - - - - - - - - - - - --------
      • Special Effect - Create a special effect attached to the chest of EC_TargetUnit[EC_Index[1]] using EC_Effect_Show[EC_Index[1]]
      • Set EC_SEffect_Show[EC_Index[1]] = (Last created special effect)
      • -------- - - - - - - - - - - - - - - - - - --------
  • Electric Charge Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- - - - - - - - - - - - - - - - - - --------
      • -------- This is the core of the spell, you should not change anything here, unless you know what you're doing. --------
      • -------- - - - - - - - - - - - - - - - - - --------
      • For each (Integer EC_Index[3]) from 1 to EC_Index[1], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • EC_Off[EC_Index[3]] Equal to False
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • EC_Duration[EC_Index[3]] Less than or equal to 0.00
                      • (EC_TargetUnit[EC_Index[3]] is alive) Equal to False
                • Then - Actions
                  • -------- - - - - - - - - - - - - - - - - - --------
                  • -------- END of spell (Duration <= 0.00 || TargetedUnit = Dead) --------
                  • -------- - - - - - - - - - - - - - - - - - --------
                  • Special Effect - Destroy EC_SEffect_Show[EC_Index[3]]
                  • Set EC_Off[EC_Index[3]] = True
                  • Set EC_Index[2] = (EC_Index[2] - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • EC_Index[2] Less than or equal to 0
                    • Then - Actions
                      • -------- - - - - - - - - - - - - - - - - - --------
                      • -------- The spell has detected zero uses of this spell and will turn off the core. --------
                      • -------- - - - - - - - - - - - - - - - - - --------
                      • Set EC_Index[1] = 0
                      • Trigger - Turn off Electric Charge Loop <gen>
                    • Else - Actions
                • Else - Actions
                  • Set EC_Duration[EC_Index[3]] = (EC_Duration[EC_Index[3]] - 0.03)
                  • -------- - - - - - - - - - - - - - - - - - --------
                  • -------- This is the actions for the lightnings that will be created from the targeted units body. --------
                  • -------- - - - - - - - - - - - - - - - - - --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • EC_LightningTimer[EC_Index[3]] Greater than or equal to EC_LightningTimerMax[EC_Index[3]]
                    • Then - Actions
                      • Set EC_LightningTimer[EC_Index[3]] = 0.00
                      • -------- - - - - - - - - - - - - - - - - - --------
                      • Special Effect - Create a special effect attached to the chest of EC_TargetUnit[EC_Index[3]] using EC_TargetUnitEffect[EC_Index[3]]
                      • Special Effect - Destroy (Last created special effect)
                      • -------- - - - - - - - - - - - - - - - - - --------
                      • Set EC_Point = (Position of EC_TargetUnit[EC_Index[3]])
                      • Set EC_UnitGroup = (Units within EC_LightningDetectionAoE[EC_Index[3]] of EC_Point matching (((((Matching unit) belongs to an enemy of EC_CastingPlayer[EC_Index[3]]) Equal to True) and (((Matching unit) is alive) Equal to True)) and ((((Matching unit) is A structure) Equal to F
                      • Unit Group - Pick every unit in EC_UnitGroup and do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • EC_MaxLightningTargetsCounter[EC_Index[3]] Less than EC_MaxLightningTargets[EC_Index[3]]
                            • Then - Actions
                              • Set EC_MaxLightningTargetsCounter[EC_Index[3]] = (EC_MaxLightningTargetsCounter[EC_Index[3]] + 1)
                              • Unit - Create 1 EC_DummyUnit[EC_Index[3]] for EC_CastingPlayer[EC_Index[3]] at EC_Point facing Default building facing degrees
                              • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
                              • Unit - Add EC_DummyAbility[EC_Index[3]] to (Last created unit)
                              • Unit - Set level of EC_DummyAbility[EC_Index[3]] for (Last created unit) to EC_AbilityLevel[EC_Index[3]]
                              • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning (Picked unit)
                            • Else - Actions
                      • Custom script: call DestroyGroup(udg_EC_UnitGroup)
                      • Custom script: call RemoveLocation(udg_EC_Point)
                      • Set EC_MaxLightningTargetsCounter[EC_Index[3]] = 0
                    • Else - Actions
                      • Set EC_LightningTimer[EC_Index[3]] = (EC_LightningTimer[EC_Index[3]] + 0.03)
            • Else - Actions



- - - - Version 1.0a - - - -
> Release

- - - - Version 1.0b - - - -
> Added an option that allow you to change how many targets that can be hit by the lightning each time.

- - - - Version 1.1a - - - -
> Reworked the code a little. (Thanks to Kingz)



Please, rate and comment! :)

Keywords:
Chain, Lightning, Flood, The, The_Food, hiveworkshop, Electric, Electrify, Charge, GUI, MUI, Leakless, leak, less, unit, target, simple, MPI, lol, epi
Contents

Electric Charge - Version 1.1a (Map)

Reviews
15:28, 6th Feb 2010 The_Reborn_Devil: The triggering looks ok, and there are no leaks. Status: Approved Rating: Useful

Moderator

M

Moderator

15:28, 6th Feb 2010
The_Reborn_Devil:
The triggering looks ok, and there are no leaks.

Status: Approved
Rating: Useful
 
Level 9
Joined
Apr 25, 2009
Messages
468
Rating: 9/10

Spell seems to be MUI and Leakfree and I like it :)
No errors found or anything, spell works smoothly.

Good job, voting for approval.
 
Level 25
Joined
Jun 5, 2008
Messages
2,572
  • ((Picked unit) is A structure) Equal to False
  • ((Picked unit) is Magic Immune) Equal to False
  • ((Picked unit) is alive) Equal to True
  • (Picked unit) Not equal to EC_TargetUnit[EC_Index[3]]
  • EC_MaxLightningTargetsCounter[EC_Index[3]] Less than EC_MaxLightningTargets[EC_Index[3]]
No,no and no. Use group filters, not if/then/else.

Also you have 2 temp variables (EC_Point[] and EC_UnitGroup[]) no need for them to be arrays, remove the arrays and use them like that.
 
Level 5
Joined
Dec 8, 2008
Messages
102
  • ((Picked unit) is A structure) Equal to False
  • ((Picked unit) is Magic Immune) Equal to False
  • ((Picked unit) is alive) Equal to True
  • (Picked unit) Not equal to EC_TargetUnit[EC_Index[3]]
  • EC_MaxLightningTargetsCounter[EC_Index[3]] Less than EC_MaxLightningTargets[EC_Index[3]]
No,no and no. Use group filters, not if/then/else.

Also you have 2 temp variables (EC_Point[] and EC_UnitGroup[]) no need for them to be arrays, remove the arrays and use them like that.

Kingz is right as always... i like the spell and its leakless
if you fix this glibberish thing in your triggering 10/10, right now 8.5/10 but
I vote for approval in each case
 
Level 19
Joined
Aug 16, 2007
Messages
881
  • ((Picked unit) is A structure) Equal to False
  • ((Picked unit) is Magic Immune) Equal to False
  • ((Picked unit) is alive) Equal to True
  • (Picked unit) Not equal to EC_TargetUnit[EC_Index[3]]
  • EC_MaxLightningTargetsCounter[EC_Index[3]] Less than EC_MaxLightningTargets[EC_Index[3]]
No,no and no. Use group filters, not if/then/else.

Also you have 2 temp variables (EC_Point[] and EC_UnitGroup[]) no need for them to be arrays, remove the arrays and use them like that.

I've fixed this now, thanks for the help, +rep!

@Itachi009, thanks :)

@DarkAngelAzazel, I've no idea of what this "EotA" is ^^ So I don't really know... Thanks :)

This spell has been updated to version 1.1a. Read the changelog if you want to know about the updates.
 
Top