• 🏆 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] What is wrong with this?

Status
Not open for further replies.
Level 9
Joined
Jan 17, 2009
Messages
372
Hi,
I recently made a trigger for an ability attack and for some reason nothing is working, i have a feeling a messed up somewhere, or multiple places and was hoping that someone could point out my mistakes.
Sidenote: How do i get the angle for a knockback?
  • Ability Attack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Attack
    • Actions
      • Unit - Order (Triggering unit) to Stop
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • A_Index[1] Equal to 0
        • Then - Actions
          • Trigger - Turn on Attack Loop <gen>
        • Else - Actions
      • Set A_Index[1] = (A_Index[1] + 1)
      • Set A_Index[2] = (A_Index[2] + 1)
      • Set A_LoopIsOn[A_Index[2]] = True
      • Set Unit[A_Index[2]] = (Triggering unit)
      • Custom script: call SetUnitAnimationByIndex(udg_Unit[udg_A_Index[2]], GetRandomInt(5, 6))
  • Attack Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A_Index[A_Index[3]]) from 1 to A_Index[2], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of Unit[A_Index[3]]) Less than 0.01
            • Then - Actions
              • Set A_Index[1] = (A_Index[1] - 1)
              • Set TimingInt[A_Index[3]] = 0
              • Set A_LoopIsOn[A_Index[3]] = False
              • Animation - Reset Unit[A_Index[3]]'s animation
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • A_Index[1] Equal to 0
                • Then - Actions
                  • Set A_Index[2] = 0
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • A_LoopIsOn[A_Index[3]] Equal to True
            • Then - Actions
              • Set TimingInt[A_Index[3]] = (TimingInt[A_Index[3]] + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TimingInt[A_Index[3]] Greater than 17
                  • TimingInt[A_Index[3]] Less than 25
                • Then - Actions
                  • Set TempLoc = (Position of Unit[A_Index[3]])
                  • Set TempLoc2 = (TempLoc offset by 10.00 towards (Facing of Unit[A_Index[3]]) degrees)
                  • Set TempPoint = (TempLoc offset by 75.00 towards (Facing of Unit[A_Index[3]]) degrees)
                  • Set A_Region[A_Index[3]] = (Region centered at TempPoint with size (128.00, 128.00))
                  • Set A_UnitGroup[A_Index[3]] = (Units in A_Region[A_Index[3]])
                  • Unit Group - Pick every unit in A_UnitGroup[A_Index[3]] and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Picked unit) is alive) Equal to True
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • K_Index[1] Equal to 0
                            • Then - Actions
                              • Trigger - Turn on Knockback <gen>
                            • Else - Actions
                          • Set K_Index[1] = (K_Index[1] + 1)
                          • Set K_Index[2] = (K_Index[2] + 1)
                          • Set K_LoopIsOn[K_Index[2]] = True
                          • Set K_Unit[K_Index[2]] = (Picked unit)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • TimingInt[A_Index[3]] Equal to 25
                            • Then - Actions
                              • Unit - Cause Unit[A_Index[3]] to damage (Picked unit), dealing 50.00 damage of attack type Normal and damage type Normal
                            • Else - Actions
                        • Else - Actions
                  • Unit - Move Unit[A_Index[3]] instantly to TempLoc2
                  • Custom script: call RemoveLocation(udg_TempLoc)
                  • Custom script: call RemoveLocation(udg_TempLoc2)
                  • Custom script: call RemoveLocation(udg_TempPoint)
                  • Custom script: call RemoveRect(udg_A_Region[udg_A_Index[3]])
                  • Custom script: call DestroyGroup(udg_A_UnitGroup[udg_A_Index[3]])
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TimingInt[A_Index[3]] Equal to 35
                • Then - Actions
                  • Set A_Index[1] = (A_Index[1] - 1)
                  • Set TimingInt[A_Index[3]] = 0
                  • Set A_LoopIsOn[A_Index[3]] = False
                  • Animation - Reset Unit[A_Index[3]]'s animation
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • A_Index[1] Equal to 0
                    • Then - Actions
                      • Set A_Index[2] = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
            • Else - Actions
 
Level 6
Joined
Mar 27, 2009
Messages
195
  • If - Conditions
    • (Life of Unit[A_Index[3]]) Less than 0.01
i am not sure, but i think this condition would not work, cause a unit always has at least 1 hp, not 0.01 or something like that. you could replace it with

  • If - Conditions
    • Unit[A_Index[3]] is alive = true
Sidenote: How do i get the angle for a knockback?

i do not know if there is an action that calculates that, but you may do it manually:

angle = atan ( (y2 - y1) / (x2 - x1) )

should work; if not tell me :D
 
Status
Not open for further replies.
Top