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

Help w/ Custom Chain Lightning Spell

Status
Not open for further replies.
Level 2
Joined
Apr 24, 2008
Messages
29
Hello, I am trying to make a chain lightning spell exactly like Blizzard's, only it is affected by a player's spell damage. Therefore I had to be able to make the spell with triggers in order to insert a damage bonus based on this.
Here is the script, completely in GUI:

  • Energy Chain Spell Enhanced
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to 080Energy Chain Level 2 (Neutral Hostile)
    • Actions
      • Set Caster = (Casting unit)
      • Set Target = (Target unit of ability being cast)
      • Set PlayerNumberInt = (Player number of (Owner of Caster))
      • Set PointArray[PlayerNumberInt] = (Position of Target)
      • Set TempGroupMUI[PlayerNumberInt] = (Units within 700.00 of PointArray[PlayerNumberInt] matching ((((Matching unit) belongs to an ally of (Owner of Caster)) Equal to False) and ((Matching unit) Not equal to Target)))
      • Set Target = (Target unit of ability being cast)
      • Unit - Cause Caster to damage Target, dealing (120.00 + (((SpellPower[PlayerNumberInt] / 75.00) x 80.00) x 1.00)) damage of attack type Spells and damage type Normal
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Custom script: call RemoveLocation (udg_PointArray[udg_PlayerNumberInt])
          • Set PointArray[PlayerNumberInt] = (Position of Target)
          • Unit - Create 1 DummyCaster for (Owner of Caster) at PointArray[PlayerNumberInt] facing Default building facing degrees
          • Set DummyCaster[PlayerNumberInt] = (Last created unit)
          • Unit - Add a 10.00 second Generic expiration timer to DummyCaster[PlayerNumberInt]
          • Unit - Add Energy Chain SFX to DummyCaster[PlayerNumberInt]
          • Set TempGroupMUI[PlayerNumberInt] = (Units within 500.00 of PointArray[PlayerNumberInt] matching (((Matching unit) belongs to an enemy of (Owner of Caster)) Equal to True))
          • Unit Group - Remove DummyCaster[PlayerNumberInt] from TempGroupMUI[PlayerNumberInt]
          • Unit Group - Remove Caster from TempGroupMUI[PlayerNumberInt]
          • Set Target = (Random unit from TempGroupMUI[PlayerNumberInt])
          • Unit - Order (Last created unit) to Orc Shadow Hunter - Healing Wave Target
          • Unit - Cause Caster to damage Target, dealing (120.00 + (((SpellPower[PlayerNumberInt] / 75.00) x 80.00) x 1.00)) damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation (udg_PointArray[udg_PlayerNumberInt])
      • Custom script: call DestroyGroup (udg_TempGroupMUI[udg_PlayerNumberInt])
I based the Energy Chain SFX spell on Healing Wave and just changed the art to look like chain lightning.

The initial spell works, and it damages the correct number of units for the correct amount, the problem is that the actual Chain Lightning effect does not show for all units. It will usually show the effect to the first target, and sometimes the second target, but often there are gaps in the chain between the units.

Any help on this matter would be appreciated. I apologize if I left out any necessary information. Thank you in advance for any attempt on helping the matter.

Edit: Found a small error in the code and updated it.
 
Last edited:
Level 13
Joined
Jul 26, 2008
Messages
1,009
The way the effect is done on a tutorial here on the Hive is that there is a dummy unit that casts the spell on another unit. That spell has the lightning effect, and it uses them in a line.

It looks like yours does the same. I can't see any reason for it not to do it's effect, and can't explain why it would do it sometimes but not always when nothing really changes in the loop. Perhaps I'll try my own to see if that happens to me. The problem may lie with something outside of your code, though.
 
Status
Not open for further replies.
Top