- Joined
- Oct 16, 2011
- Messages
- 297
I'm trying to make a triggered version of the Shockwave ability. Unfortunately, I have problems with the loop I made. Can anyone fix it for me? Thanks in advance.
-
Shockwave
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Shockwave (Cairne)
-
Actions
- Set SW_Max = (SW_Max + 1)
- Set SW_Caster[SW_Max] = (Triggering unit)
- Set SW_Point[1] = (Position of SW_Caster[SW_Max])
- Set SW_Point[2] = (Target point of ability being cast)
- Set SW_Ability = (Ability being cast)
- Set SW_Lvl[SW_Max] = (Level of (Ability being cast) for SW_Caster[SW_Max])
- Set SW_Distance[SW_Max] = 1500.00
- Set SW_Speed = 12.50
- Set SW_Damage[1] = 75.00
- Set SW_Damage[2] = 150.00
- Set SW_Damage[3] = 300.00
- Set SW_Area[1] = 125.00
- Set SW_Area[2] = 125.00
- Set SW_Area[3] = 125.00
- Unit - Create 1 Shockwave for (Owner of SW_Caster[SW_Max]) at SW_Point[1] facing SW_Point[2]
- Set SW_Shockwave[SW_Max] = (Last created unit)
- Unit - Turn collision for SW_Shockwave[SW_Max] Off
- Set SW_Angle[SW_Max] = (Facing of SW_Shockwave[SW_Max])
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- SW_Max Equal to 1
-
Then - Actions
- Trigger - Turn on Shockwave Loop <gen>
- Else - Actions
-
If - Conditions
- Custom script: call RemoveLocation(udg_SW_Point[1])
- Custom script: call RemoveLocation(udg_SW_Point[2])
-
Events
-
Shockwave Loop
-
Events
- Time - Every 0.03 seconds of game time
- Conditions
-
Actions
-
For each (Integer SW_Loop) from 1 to SW_Max, do (Actions)
-
Loop - Actions
- Set SW_Distance[SW_Loop] = (SW_Distance[SW_Loop] - SW_Speed)
- Set SW_Point[1] = (Position of SW_Shockwave[SW_Loop])
- Set SW_Point[2] = (SW_Point[1] offset by SW_Speed towards SW_Angle[SW_Loop] degrees)
- Unit - Move SW_Shockwave[SW_Loop] instantly to SW_Point[2], facing SW_Angle[SW_Loop] degrees
- Set SW_GroupInitial[SW_Loop] = (Units within SW_Area[SW_Lvl[SW_Loop]] of SW_Point[2] matching ((((Matching unit) belongs to an enemy of (Owner of SW_Caster[SW_Loop])) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) is in SW_GroupDamaged[SW_Loop]) Equal
-
Unit Group - Pick every unit in SW_GroupInitial[SW_Loop] and do (Actions)
-
Loop - Actions
- Unit - Cause SW_Caster[SW_Loop] to damage (Picked unit), dealing SW_Damage[SW_Lvl[SW_Loop]] damage of attack type Spells and damage type Normal
- Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
- Special Effect - Destroy (Last created special effect)
- Unit Group - Add (Picked unit) to SW_GroupDamaged[SW_Loop]
-
Loop - Actions
- Custom script: call RemoveLocation(udg_SW_Point[1])
- Custom script: call RemoveLocation(udg_SW_Point[2])
- Custom script: call DestroyGroup( udg_SW_GroupInitial[udg_SW_Loop] )
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- SW_Distance[SW_Loop] Less than or equal to 0.00
-
Then - Actions
- Custom script: call DestroyGroup( udg_SW_GroupDamaged[udg_SW_Loop] )
- Unit - Kill SW_Shockwave[SW_Loop]
- Set SW_GroupInitial[SW_Loop] = SW_GroupInitial[SW_Max]
- Set SW_GroupDamaged[SW_Loop] = SW_GroupDamaged[SW_Max]
- Set SW_Shockwave[SW_Loop] = SW_Shockwave[SW_Max]
- Set SW_Shockwave[SW_Max] = No unit
- Set SW_Caster[SW_Loop] = SW_Caster[SW_Max]
- Set SW_Caster[SW_Max] = No unit
- Set SW_Distance[SW_Loop] = SW_Distance[SW_Max]
- Set SW_Angle[SW_Loop] = SW_Angle[SW_Max]
- Set SW_Lvl[SW_Loop] = SW_Lvl[SW_Max]
- Set SW_Max = (SW_Max - 1)
- Set SW_Loop = (SW_Loop - 1)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- SW_Max Equal to 0
-
Then - Actions
- Trigger - Turn off (This trigger)
- Else - Actions
-
If - Conditions
-
Loop - Actions
-
For each (Integer SW_Loop) from 1 to SW_Max, do (Actions)
-
Events