Monday, April 16, 2012

Help w/ Custom Chain Lightning

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:


Code:
Energy Chain Spell
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 500.00 of PointArray[PlayerNumberInt] matching (((Matching unit) belongs to an ally of (Owner of Caster)) Equal to False))
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
Set PointArray[PlayerNumberInt] = (Position of Target)
Unit - Create 1 DummyCaster for (Owner of Caster) at PointArray[PlayerNumberInt] facing Default building facing degrees
Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
Unit - Add Energy Chain SFX to (Last created unit)
Set TempGroupMUI[PlayerNumberInt] = (Units within 500.00 of PointArray[PlayerNumberInt] matching (((Matching unit) belongs to an ally of (Owner of Caster)) Equal to False))
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.|||If this doesn't work, tell me, but try this:

Replace


Code:
Set TempGroupMUI[PlayerNumberInt] = (Units within 500.00 of PointArray[PlayerNumberInt] matching (((Matching unit) belongs to an ally of (Owner of Caster)) Equal to False))

with


Code:
Set TempGroupMUI[PlayerNumberInt] = (Units within 500.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))

EDIT: Actually, that probably won't fix it, but it's a check you might want to add anyway. I don't see why that's not working... is the 'targets' setting for Energy Chain SFX set correctly? That's all that really comes to mind.

Oh, and just so you know, while you've tried to clear up leaks, that will still leak. You can fix that by adding


Code:
Custom script:   call RemoveLocation (udg_PointArray[udg_PlayerNumberInt])

to the loop, before


Code:
Set PointArray[PlayerNumberInt] = (Position of Target)
|||Quote:






View Post

If this doesn't work, tell me, but try this:

Replace


Code:
Set TempGroupMUI[PlayerNumberInt] = (Units within 500.00 of PointArray[PlayerNumberInt] matching (((Matching unit) belongs to an ally of (Owner of Caster)) Equal to False))

with


Code:
Set TempGroupMUI[PlayerNumberInt] = (Units within 500.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))

EDIT: Actually, that probably won't fix it, but it's a check you might want to add anyway. I don't see why that's not working... is the 'targets' setting for Energy Chain SFX set correctly? That's all that really comes to mind.

Oh, and just so you know, while you've tried to clear up leaks, that will still leak. You can fix that by adding


Code:
Custom script:   call RemoveLocation (udg_PointArray[udg_PlayerNumberInt])

to the loop, before


Code:
Set PointArray[PlayerNumberInt] = (Position of Target)






Thank you for clearing up the leak, though the ability still does not work correctly. Any further assistance would be appreciated.

EDIT: Yes, the targets setting is identical to the initial chain lightning ability.

No comments:

Post a Comment