I have made a trigger that can be used as Knockback, knockback area, propulsor or waveform depending on the data used, the effect works great, but I'm having problems with damaging the units in the waveform. The trigger damage the units no just one time, but several, because the folowing line is not working:
The problem is in the second trigger:
First Trigger (the calling trigger):
The problem is in the second trigger:
- -------- PROBLEM HERE --------
- Unit Group - Add (Picked unit) to KB_DamagedUnits[IntegerTemp]
- -------- -------------- --------
First Trigger (the calling trigger):
-
Knockback Waveform
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Waveform
-
Actions
- Set TempPoint1 = (Position of (Triggering unit))
- Set TempPoint2 = (Target point of ability being cast)
- Set KnockBackedUnits = (KnockBackedUnits + 1)
- Set KB_Cont[KnockBackedUnits] = 0.00
- Set KB_Speed[KnockBackedUnits] = 50.00
- Set KB_Distancia[KnockBackedUnits] = (Distance between TempPoint1 and TempPoint2)
- Set KB_Target[KnockBackedUnits] = (Triggering unit)
- Set KB_Collision[KnockBackedUnits] = True
- Unit Group - Remove all units from KB_DamagedUnits[KnockBackedUnits]
- Set KB_Angle[KnockBackedUnits] = (Angle from TempPoint1 to TempPoint2)
- Set KB_FX[KnockBackedUnits] = Objects\Spawnmodels\Naga\NagaDeath\NagaDeath.mdl
- Custom script: call RemoveLocation (udg_TempPoint1)
- Custom script: call RemoveLocation (udg_TempPoint2)
- Trigger - Turn on Knockback effect <gen>
-
Events
-
Knockback effect
-
Events
- Time - Every 0.02 seconds of game time
- Conditions
-
Actions
-
For each (Integer IntegerTemp) from 1 to KnockBackedUnits, do (Actions)
-
Loop - Actions
- -------- Move target unit and do special effect --------
- If (KB_Collision[IntegerTemp] Equal to True) then do (Unit - Turn collision for KB_Target[IntegerTemp] Off) else do (Do nothing)
- Set KB_Cont[IntegerTemp] = (KB_Cont[IntegerTemp] + KB_Speed[IntegerTemp])
- Set TempPoint1 = (Position of KB_Target[IntegerTemp])
- Set TempPoint2 = (TempPoint1 offset by KB_Speed[IntegerTemp] towards KB_Angle[IntegerTemp] degrees)
- Special Effect - Create a special effect at TempPoint1 using KB_FX[IntegerTemp]
- Special Effect - Destroy (Last created special effect)
- Unit - Move KB_Target[IntegerTemp] instantly to TempPoint2
- -------- Damaging Units --------
- Set TempUnitGroup = (Units within 350.00 of TempPoint2 matching (((Matching unit) is in KB_DamagedUnits[IntegerTemp]) Equal to False))
-
Unit Group - Pick every unit in TempUnitGroup and do (Actions)
-
Loop - Actions
- -------- PROBLEM HERE --------
- Unit Group - Add (Picked unit) to KB_DamagedUnits[IntegerTemp]
- -------- -------------- --------
- Game - Display to (All players) for 2.00 seconds the text: (Name of (Random unit from TempUnitGroup))
- Unit - Cause KB_Target[IntegerTemp] to damage (Picked unit), dealing 300.00 damage of attack type Spells and damage type Normal
-
Loop - Actions
- Custom script: call DestroyGroup(udg_TempUnitGroup)
- -------- Take the unit out of the Knockback effect if conditions are true --------
- Custom script: call RemoveLocation (udg_TempPoint2)
- Custom script: call RemoveLocation (udg_TempPoint1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- KB_Cont[IntegerTemp] Greater than or equal to KB_Distancia[IntegerTemp]
-
Then - Actions
- Unit - Turn collision for KB_Target[IntegerTemp] On
- Custom script: call DestroyGroup(udg_KB_DamagedUnits[udg_IntegerTemp])
- Set KB_Cont[IntegerTemp] = KB_Cont[KnockBackedUnits]
- Set KB_Speed[IntegerTemp] = KB_Speed[KnockBackedUnits]
- Set KB_Distancia[IntegerTemp] = KB_Distancia[KnockBackedUnits]
- Set KB_Collision[IntegerTemp] = KB_Collision[KnockBackedUnits]
- Set KB_Target[IntegerTemp] = KB_Target[KnockBackedUnits]
- Set KB_Angle[IntegerTemp] = KB_Angle[KnockBackedUnits]
- Set KB_FX[IntegerTemp] = KB_FX[KnockBackedUnits]
- Set KnockBackedUnits = (KnockBackedUnits - 1)
- If (IntegerTemp Greater than 1) then do (Set IntegerTemp = (IntegerTemp - 1)) else do (Do nothing)
- If (KnockBackedUnits Equal to 0) then do (Trigger - Turn off (This trigger)) else do (Do nothing)
- Else - Actions
-
If - Conditions
-
Loop - Actions
-
For each (Integer IntegerTemp) from 1 to KnockBackedUnits, do (Actions)
-
Events