• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Trigger Help.

Status
Not open for further replies.
Level 16
Joined
Oct 17, 2009
Messages
1,579
Can someone check these two triggers?
  • 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)
  • 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
            • Else - Actions
              • Unit - Remove Unit_Array[Int3] from the game
              • Set Real2[Int3] = 0.00
              • Trigger - Turn off (This trigger)
So what happens here is that when a unit casts "Throw Dagger", it would create a unit and order it to move to the location and periodically checks those near the dagger so that if there's one enemy within range of the dagger, the enemy would get damaged and the dagger would be removed. If the dagger reaches its maximum range without "hitting" any unit, it would be removed. The spell functions similarly to that of Mirana's arrow in Dota, only without the stun.
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?
 
Status
Not open for further replies.
Top