- Joined
- Jun 10, 2019
- Messages
- 69
Hello again everyone,
Today I'm working on an ability that's mostly working, but there's a key error I'm having difficulty correcting.
Here's the goal: the caster activates the ability, Lightning Lure, which is based on Chain Lightning, on a target enemy unit. The Chain Lightning special effects play, and then 10 orbs of lightning spawn between the caster and the target. The target is dragged towards the caster, and the orbs move continuously, showing the tether between them.
Here are my triggers:
I think the problem has something to do with how I'm assigning variables to the orbs of lightning.
Any help would be appreciated.
P.S. As a clarification, LightningLure_Units is the size-10 array of the lightning orbs, LightningLure_UnitInteger is a size-12 array I used to distinguish between the LightningLure_Units. LightningLure_Instances is the number of ongoing instances of the spell, and LightningLure_Loop is the integer I used for my attempt at dynamic indexing.
Thanks!
Today I'm working on an ability that's mostly working, but there's a key error I'm having difficulty correcting.
Here's the goal: the caster activates the ability, Lightning Lure, which is based on Chain Lightning, on a target enemy unit. The Chain Lightning special effects play, and then 10 orbs of lightning spawn between the caster and the target. The target is dragged towards the caster, and the orbs move continuously, showing the tether between them.
Here are my triggers:
-
Lightning Lure Cast
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Lightning Lure
-
-
Actions
-
Set VariableSet LightningLure_Instances = (LightningLure_Instances + 1)
-
Unit - Turn collision for (Target unit of ability being cast) Off.
-
Set VariableSet LightningLure_Caster[LightningLure_Instances] = (Triggering unit)
-
Set VariableSet LightningLure_Victim[LightningLure_Instances] = (Target unit of ability being cast)
-
Set VariableSet LightningLure_Damage[LightningLure_Instances] = (((20.00 x (Real((Level of Lightning Lure for (Triggering unit))))) + 20.00) + (2.00 x (Real((Intelligence of (Triggering unit) (Include bonuses))))))
-
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing LightningLure_Damage[LightningLure_Instances] damage of attack type Spells and damage type Normal
-
For each (Integer LightningLure_UnitInteger[LightningLure_Instances]) from 1 to 10, do (Actions)
-
Loop - Actions
-
Unit - Create 1 Lightning Lure Dummy for (Triggering player) at ((Position of (Triggering unit)) offset by ((Distance between (Position of (Triggering unit)) and (Position of (Target unit of ability being cast))) x ((Real(LightningLure_UnitInteger[LightningLure_Instances])) / 11.00)) towards (Angle from (Position of (Trig facing (Position of (Target unit of ability being cast))
-
Set VariableSet LightningLure_Units[LightningLure_UnitInteger[LightningLure_Instances]] = (Last created unit)
-
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
LightningLure_Instances Equal to 1
-
-
Then - Actions
-
Trigger - Turn on Lightning Lure Loop <gen>
-
-
Else - Actions
-
-
-
-
Lightning Lure Loop
-
Events
-
Time - Every 0.02 seconds of game time
-
-
Conditions
-
Actions
-
For each (Integer LightningLure_Loop) from 1 to LightningLure_Instances, do (Actions)
-
Loop - Actions
-
For each (Integer LightningLure_UnitInteger[LightningLure_Loop]) from 1 to 10, do (Actions)
-
Loop - Actions
-
Unit - Move LightningLure_Units[LightningLure_UnitInteger[LightningLure_Loop]] instantly to ((Position of LightningLure_Caster[LightningLure_Loop]) offset by ((Distance between (Position of LightningLure_Caster[LightningLure_Loop]) and (Position of LightningLure_Victim[LightningLure_Loop])) x ((Real(LightningLure_UnitInteger[LightningLure_Loop])) / , facing (Position of LightningLure_Victim[LightningLure_Loop])
-
-
-
Unit - Move LightningLure_Victim[LightningLure_Loop] instantly to ((Position of LightningLure_Victim[LightningLure_Loop]) offset by 4.00 towards (Angle from (Position of LightningLure_Victim[LightningLure_Loop]) to (Position of LightningLure_Caster[LightningLure_Loop])) degrees.), facing (Position of LightningLure_Caster[LightningLure_Loop])
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Distance between (Position of LightningLure_Caster[LightningLure_Loop]) and (Position of LightningLure_Victim[LightningLure_Loop])) Less than or equal to 100.00
-
-
Then - Actions
-
Unit - Turn collision for LightningLure_Victim[LightningLure_Loop] On.
-
For each (Integer LightningLure_UnitInteger[LightningLure_Loop]) from 1 to 10, do (Actions)
-
Loop - Actions
-
Unit - Kill LightningLure_Units[LightningLure_UnitInteger[LightningLure_Loop]]
-
-
-
Set VariableSet LightningLure_Caster[LightningLure_Loop] = LightningLure_Caster[LightningLure_Instances]
-
Set VariableSet LightningLure_Victim[LightningLure_Loop] = LightningLure_Victim[LightningLure_Instances]
-
Set VariableSet LightningLure_Damage[LightningLure_Loop] = LightningLure_Damage[LightningLure_Instances]
-
Set VariableSet LightningLure_Loop = (LightningLure_Loop - 1)
-
Set VariableSet LightningLure_Instances = (LightningLure_Instances - 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
LightningLure_Instances Equal to 0
-
-
Then - Actions
-
Trigger - Turn off (This trigger)
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
-
-
I think the problem has something to do with how I'm assigning variables to the orbs of lightning.
Any help would be appreciated.
P.S. As a clarification, LightningLure_Units is the size-10 array of the lightning orbs, LightningLure_UnitInteger is a size-12 array I used to distinguish between the LightningLure_Units. LightningLure_Instances is the number of ongoing instances of the spell, and LightningLure_Loop is the integer I used for my attempt at dynamic indexing.
Thanks!