• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Trigger Help.

Status
Not open for further replies.
Level 16
Joined
Oct 17, 2009
Messages
1,580
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