- Joined
- Oct 17, 2009
- Messages
- 1,579
Can someone check these two triggers?
Now my problem is that when I cast the spell for the first time, it will work as planned. It would damage an enemy unit and disappear or it would reach its destination and be removed. Now if i cast it for the second and following times, it will go through any unit it passes and not damage the enemy and move to its destination, stopping when it reaches the end and not disappear.
Can someone tell me what's wrong with it?
-
Throw Dagger
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Throw Dagger
-
Actions
- Set Int = (Int + 1)
- Set Point2 = (Position of (Triggering unit))
- Set Point3 = (Target point of ability being cast)
- Set Point = ((Position of (Triggering unit)) offset by 850.00 towards (Angle from Point2 to Point3) degrees)
- Unit - Create 1 Dagger for Player 1 (Red) at Point2 facing (Facing of (Triggering unit)) degrees
- Set Unit_Array[Int] = (Last created unit)
- Set Real2[Int] = 2.35
- Unit - Order (Last created unit) to Move To Point
- Trigger - Turn on Dagger Hit <gen>
- Custom script: call RemoveLocation(udg_Point)
- Custom script: call RemoveLocation(udg_Point2)
- Custom script: call RemoveLocation(udg_Point3)
-
Events
-
Dagger Hit
-
Events
- Time - Every 0.02 seconds of game time
- Conditions
-
Actions
-
For each (Integer Int3) from 1 to Int, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Real2[Int3] Greater than 0.00
-
Then - Actions
- Set Real2[Int3] = (Real2[Int3] - 0.02)
-
Unit Group - Pick every unit in (Units within 70.00 of (Position of Unit_Array[Int3])) and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Picked unit) belongs to an enemy of Player 1 (Red)) Equal to True
-
Then - Actions
- Unit - Cause Unit_Array[Int3] to damage (Picked unit), dealing (Random real number between 50.00 and 70.00) damage of attack type Hero and damage type Normal
- Unit Group - Remove (Picked unit) from (Last created unit group)
- Unit - Remove Unit_Array[Int3] from the game
- Set Real2[Int3] = 0.00
- Trigger - Turn off (This trigger)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
Else - Actions
- Unit - Remove Unit_Array[Int3] from the game
- Set Real2[Int3] = 0.00
- Trigger - Turn off (This trigger)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
For each (Integer Int3) from 1 to Int, do (Actions)
-
Events
Now my problem is that when I cast the spell for the first time, it will work as planned. It would damage an enemy unit and disappear or it would reach its destination and be removed. Now if i cast it for the second and following times, it will go through any unit it passes and not damage the enemy and move to its destination, stopping when it reaches the end and not disappear.
Can someone tell me what's wrong with it?