Hey team, first post here so sorry if an image isn't the best way to post this. If there is a better way to post it please let me know and I'll edit the post.
I'm having trouble with a custom chain lightning spell which is intended to work the following way:
Ability 1: Deal damage to an enemy and apply "Static Charge" debuff to them.
Ability 2: Shot a bolt of lightning at the target and deal damage to them, the lightning will then bounce to all nearby enemies afflicted by Static Charge [Electric_Group].
The problem i'm having is that when there are two or more targets in [Electrocute_Group], it will strike one less target than intended. It works perfectly fine when [Electrocute_Group] contains one unit, but any number above 1 will result in n-1 targets hit.
Is there something that i'm missing here?
edit: thanks for the guide, have reuploaded trigger
I'm having trouble with a custom chain lightning spell which is intended to work the following way:
Ability 1: Deal damage to an enemy and apply "Static Charge" debuff to them.
Ability 2: Shot a bolt of lightning at the target and deal damage to them, the lightning will then bounce to all nearby enemies afflicted by Static Charge [Electric_Group].
The problem i'm having is that when there are two or more targets in [Electrocute_Group], it will strike one less target than intended. It works perfectly fine when [Electrocute_Group] contains one unit, but any number above 1 will result in n-1 targets hit.
Is there something that i'm missing here?
edit: thanks for the guide, have reuploaded trigger
-
Electrocute Copy
-
Events
-
Unit - A unit Begins casting an ability
-
-
Conditions
-
(Ability being cast) Equal to Electrocute [E]
-
-
Actions
-
-------- Local Setup --------
-
Set VariableSet Electrocute_Caster = (Triggering unit)
-
Set VariableSet Spell_Power = (Real((Intelligence of Electrocute_Caster (Include bonuses))))
-
Set VariableSet Electrocute_Damage = (8 + (Integer((Spell_Power x 1.80))))
-
Set VariableSet Electrocute_Target[1] = (Target unit of ability being cast)
-
-------- Spell Effect --------
-
Wait 0.30 seconds
-
Set VariableSet Electrocute_Point[1] = (Position of Electrocute_Caster)
-
Set VariableSet Electrocute_Point[2] = (Position of Electrocute_Target[1])
-
Custom script: set udg_Electrocute_Lightning = AddLightningEx("FORK", true , GetLocationX(udg_Electrocute_Point[1]), GetLocationY(udg_Electrocute_Point[1]), 70, GetLocationX(udg_Electrocute_Point[2]), GetLocationY(udg_Electrocute_Point[2]), 70)
-
Special Effect - Create a special effect attached to the origin of Electrocute_Target[1] using Abilities\Weapons\Bolt\BoltImpact.mdl
-
Special Effect - Destroy (Last created special effect)
-
Set VariableSet Electrocute_Lightning = (Last created lightning effect)
-
Set VariableSet Electrocute_Health = (Life of Electrocute_Target[1])
-
-------- -------------------- --------
-
Unit - Set life of Electrocute_Target[1] to (Electrocute_Health - (Real((Electrocute_Damage x 2))))
-
Unit - Remove Static Charge (Custom) buff from Electrocute_Target[1]
-
Set VariableSet Electrocute_Group = (Units in (Playable map area) matching (((Matching unit) has buff Static Charge (Custom)) Equal to True))
-
For each (Integer Electrocute_Loop) from 1 to (Number of units in Electrocute_Group), do (Actions)
-
Loop - Actions
-
Wait 0.15 seconds
-
Set VariableSet Electrocute_Distance = 9999.00
-
Set VariableSet Electrocute_Target[2] = Electrocute_Target[1]
-
Set VariableSet Electrocute_Point[2] = (Position of Electrocute_Target[2])
-
Unit Group - Pick every unit in Electrocute_Group and do (Actions)
-
Loop - Actions
-
Set VariableSet Electrocute_Point[1] = (Position of (Picked unit))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Electrocute_Distance Greater than (Distance between Electrocute_Point[1] and Electrocute_Point[2])
-
-
Then - Actions
-
Set VariableSet Electrocute_Target[1] = (Picked unit)
-
Set VariableSet Electrocute_Distance = (Distance between Electrocute_Point[1] and Electrocute_Point[2])
-
-
Else - Actions
-
-
-
-
Lightning - Destroy Electrocute_Lightning
-
Custom script: set udg_Electrocute_Lightning = AddLightningEx("FORK", true , GetLocationX(udg_Electrocute_Point[2]), GetLocationY(udg_Electrocute_Point[2]), 70, GetLocationX(udg_Electrocute_Point[1]), GetLocationY(udg_Electrocute_Point[1]), 70)
-
Special Effect - Create a special effect attached to the origin of Electrocute_Target[1] using Abilities\Weapons\Bolt\BoltImpact.mdl
-
Special Effect - Destroy (Last created special effect)
-
Set VariableSet Electrocute_Lightning = (Last created lightning effect)
-
Set VariableSet Electrocute_Health = (Life of Electrocute_Target[1])
-
Unit - Set life of Electrocute_Target[1] to (Electrocute_Health - (Real((Electrocute_Damage x 2))))
-
Unit Group - Remove Electrocute_Target[1] from Electrocute_Group.
-
Unit - Remove Static Charge (Custom) buff from Electrocute_Target[1]
-
-
-
Custom script: call RemoveLocation(udg_Electrocute_Point[1])
-
Custom script: call RemoveLocation(udg_Electrocute_Point[2])
-
-
Last edited: