- Joined
- Dec 6, 2009
- Messages
- 173
Hello,
I have a caster that casts a channeling ability, but if the same unit starts casting the same spell again I want the old one to be interrupted. But when I try to do so it only removes the new instance of the casted spell instead of the previous one. My issue is in the loop and I don't understand why. I am checking if the ChannelSpell_Caster[Index] is the same as the ChannelSpell_Caster[Loop] and then checking so that the Loop is not the same as the Index to make sure that it is not the current cast of the spell that turns false. But it is always the current one that turns off
I removed all things that are not needed from the trigger to make it clearer.
I have a caster that casts a channeling ability, but if the same unit starts casting the same spell again I want the old one to be interrupted. But when I try to do so it only removes the new instance of the casted spell instead of the previous one. My issue is in the loop and I don't understand why. I am checking if the ChannelSpell_Caster[Index] is the same as the ChannelSpell_Caster[Loop] and then checking so that the Loop is not the same as the Index to make sure that it is not the current cast of the spell that turns false. But it is always the current one that turns off
I removed all things that are not needed from the trigger to make it clearer.
-
-------- Indexing --------
-
-------- ---------------------------------- --------
-
Set VariableSet ChannelSpell_Index = (Index + 1)
-
-------- ---------------------------------- --------
-
-------- Set casting unit --------
-
-------- ---------------------------------- --------
-
Set VariableSet ChannelSpell_Caster[Index] = (Triggering unit)
-
-------- ---------------------------------- --------
-
-------- Set the spell as active for the Channel Spell loop trigger (not shown) --------
-
-------- ---------------------------------- --------
-
Set VariableSet ChannelSpell_Active[Index] = True
-
-------- ---------------------------------- --------
-
-------- Loop to check if the caster is the caster of any of the other indexes of the same ChannelSpell --------
-
-------- This turns of the current cast of the spell instead of the old one and I don't understand why --------
-
-------- ---------------------------------- --------
-
For each (Integer Loop) from 1 to Index, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
And - All (Conditions) are true
-
Conditions
-
ChannelSpell_Caster[Index] Equal to ChannelSpell_Caster[Loop]
-
Loop Not equal to Index
-
-
-
-
Then - Actions
-
Set VariableSet ChannelSpell_Active[Loop] = False
-
-
Else - Actions
-
-
-
-
-------- ---------------------------------- --------
-
-------- Starting the ChannelSpell loop --------
-
-------- ---------------------------------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Index Equal to 1
-
-
Then - Actions
-
Trigger - Turn on Channel Spell Loop<gen>
-
-
Else - Actions
-
-
Interrupt Channel Spell
-
Events
-
Unit - A unit Is issued an order targeting a point
-
Unit - A unit Is issued an order targeting an object
-
Unit - A unit Stops casting an ability
-
Unit - A unit Finishes casting an ability
-
-
Conditions
-
((Triggering unit) is in ChannelSpell_DebugGroup.) Equal to True
-
-
Actions
-
For each (Integer Loop2) from 1 to Index, do (Actions)
-
Loop - Actions
-
Set VariableSet ChannelSpell_Active[Loop2] = False
-
-
-
-