- Joined
- Mar 6, 2015
- Messages
- 130
as the title indicates i want to damage units in loop trigger but just one time as you already know if i pick some units inside a loop and tell my caster to damage them every time they take damage multiply times and thats not good because you can`t predict how much damage the units would take in this spell that i made you can see my caster sends a lightning projectile that damage nearby enemies but how can i manage to damage them once?
my demo spell: download
-
Lightning Bolt Cast
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Lightining Bolt
-
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Index_Size Equal to 0
-
-
Then - Actions
-
Trigger - Turn on Lightning Bolt Loop <gen>
-
-
Else - Actions
-
-
Set Index_Size = (Index_Size + 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Index_Size Greater than IndexM
-
-
Then - Actions
-
Set Index[Index_Size] = Index_Size
-
Set IndexM = Index_Size
-
-
Else - Actions
-
-
Set TempInt = Index[Index_Size]
-
Set Caster[TempInt] = (Casting unit)
-
Set Player[TempInt] = (Owner of Caster[TempInt])
-
Set TempPoint1 = (Position of Caster[TempInt])
-
Set TempPoint2 = (Target point of ability being cast)
-
Set Damage_Amount[TempInt] = 50.00
-
Set Face[TempInt] = (Angle from TempPoint1 to TempPoint2)
-
Set Damage_Range[TempInt] = 300.00
-
Set Speed[TempInt] = 20.00
-
Set Distance[TempInt] = (Distance between TempPoint1 and TempPoint2)
-
Set Level[TempInt] = (Level of (Ability being cast) for Caster[TempInt])
-
Unit - Create 1 Dummy for Player[TempInt] at TempPoint1 facing Face[TempInt] degrees
-
Set Dummy[TempInt] = (Last created unit)
-
Custom script: call RemoveLocation(udg_TempPoint1)
-
Custom script: call RemoveLocation(udg_TempPoint2)
-
Trigger - Turn on Lightning Bolt Loop <gen>
-
-
-
Lightning Bolt Loop
-
Events
-
Time - Every 0.03 seconds of game time
-
-
Conditions
-
Actions
-
For each (Integer Loop_Int) from 1 to Index_Size, do (Actions)
-
Loop - Actions
-
Set TempInt = Index[Loop_Int]
-
Set TempPoint1 = (Position of Dummy[TempInt])
-
Set TempPoint2 = (TempPoint1 offset by Speed[TempInt] towards Face[TempInt] degrees)
-
Set Distance[TempInt] = (Distance[TempInt] - Speed[TempInt])
-
Special Effect - Create a special effect at TempPoint2 using Abilities\Weapons\FarseerMissile\FarseerMissile.mdl
-
Special Effect - Destroy (Last created special effect)
-
Custom script: set bj_wantDestroyGroup=true
-
Unit Group - Pick every unit in (Units within Damage_Range[TempInt] of TempPoint2 matching (((Matching unit) belongs to an enemy of Player[TempInt]) Equal to True)) and do (Actions)
-
Loop - Actions
-
Unit - Cause Caster[TempInt] to damage (Picked unit), dealing (Damage_Amount[TempInt] x (Real(Level[TempInt]))) damage of attack type Spells and damage type Magic
-
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Distance[TempInt] Less than or equal to (2.00 x Speed[TempInt])
-
-
Then - Actions
-
Unit - Add a 1.00 second Generic expiration timer to Dummy[TempInt]
-
Unit - Order Dummy[TempInt] to Human Mountain King - Thunder Clap
-
Set Index_Size = (Index_Size - 1)
-
Set Loop_Int = (Loop_Int - 1)
-
-
Else - Actions
-
Unit - Move Dummy[TempInt] instantly to TempPoint2, facing Face[TempInt] degrees
-
-
-
Custom script: call RemoveLocation(udg_TempPoint1)
-
Custom script: call RemoveLocation(udg_TempPoint2)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Index_Size Equal to 0
-
-
Then - Actions
-
Trigger - Turn off (This trigger)
-
-
Else - Actions
-
-
-
-
-
my demo spell: download