• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Trigger resets cooldown???

Status
Not open for further replies.
Level 14
Joined
Jul 12, 2011
Messages
1,370
Hey everyone.
I have created a spell that does nothing and all its effects are via triggers.
However, the trigger causes the spells cooldown to recover instantly!!
It's not the spell (I have disabled the trigger and cooldown works) but the trigger.
Here it is: (It's not that big. I have copied the first part three times)
  • Arcane Teleportation
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Arcane Teleportation
    • Actions
      • Set Point001 = (Position of (Casting unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of (Ability being cast) for (Casting unit)) Equal to 1
        • Then - Actions
          • Unit - Move (Casting unit) instantly to (Random point in (Region centered at Point001 with size (700.00, 700.00))), facing (Center X of (Region centered at Point001 with size (1.00, 1.00))) degrees
          • Unit - Create 1 Magical Explosion Dummy for (Owner of (Casting unit)) at (Position of (Casting unit)) facing 270.00 degrees
          • Unit - Add a 9.00 second Generic expiration timer to (Last created unit)
          • Unit Group - Pick every unit in (Units in (Region centered at (Position of (Casting unit)) with size (300.00, 300.00))) 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 (Owner of (Casting unit))) Equal to True
                • Then - Actions
                  • Unit - Cause (Casting unit) to damage (Picked unit), dealing 150.00 damage of attack type Spells and damage type Normal
                • Else - Actions
          • Wait 0.40 seconds
          • Unit - Move (Casting unit) instantly to (Random point in (Region centered at Point001 with size (700.00, 700.00))), facing (Center X of (Region centered at Point001 with size (1.00, 1.00))) degrees
          • Unit - Create 1 Magical Explosion Dummy for (Owner of (Casting unit)) at (Position of (Casting unit)) facing 270.00 degrees
          • Unit - Add a 9.00 second Generic expiration timer to (Last created unit)
          • Unit Group - Pick every unit in (Units in (Region centered at (Position of (Casting unit)) with size (300.00, 300.00))) 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 (Owner of (Casting unit))) Equal to True
                • Then - Actions
                  • Unit - Cause (Casting unit) to damage (Picked unit), dealing 150.00 damage of attack type Spells and damage type Normal
                • Else - Actions
          • Wait 0.40 seconds
          • Unit - Move (Casting unit) instantly to (Random point in (Region centered at Point001 with size (700.00, 700.00))), facing (Center X of (Region centered at Point001 with size (1.00, 1.00))) degrees
          • Unit - Create 1 Magical Explosion Dummy for (Owner of (Casting unit)) at (Position of (Casting unit)) facing 270.00 degrees
          • Unit - Add a 9.00 second Generic expiration timer to (Last created unit)
          • Unit Group - Pick every unit in (Units in (Region centered at (Position of (Casting unit)) with size (300.00, 300.00))) 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 (Owner of (Casting unit))) Equal to True
                • Then - Actions
                  • Unit - Cause (Casting unit) to damage (Picked unit), dealing 150.00 damage of attack type Spells and damage type Normal
                • Else - Actions
          • Wait 0.40 seconds
          • Unit - Move (Casting unit) instantly to (Random point in (Region centered at Point001 with size (700.00, 700.00))), facing (Center X of (Region centered at Point001 with size (1.00, 1.00))) degrees
          • Unit - Create 1 Magical Explosion Dummy for (Owner of (Casting unit)) at (Position of (Casting unit)) facing 270.00 degrees
          • Unit - Add a 9.00 second Generic expiration timer to (Last created unit)
          • Unit Group - Pick every unit in (Units in (Region centered at (Position of (Casting unit)) with size (300.00, 300.00))) 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 (Owner of (Casting unit))) Equal to True
                • Then - Actions
                  • Unit - Cause (Casting unit) to damage (Picked unit), dealing 150.00 damage of attack type Spells and damage type Normal
                  • Custom script: call RemoveLocation (udg_Point001)
                • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of (Ability being cast) for (Casting unit)) Equal to 2
            • Then - Actions
              • Unit - Move (Casting unit) instantly to (Random point in (Region centered at Point001 with size (700.00, 700.00))), facing (Center X of (Region centered at Point001 with size (1.00, 1.00))) degrees
              • Unit - Create 1 Magical Explosion Dummy for (Owner of (Casting unit)) at (Position of (Casting unit)) facing 270.00 degrees
              • Unit - Add a 9.00 second Generic expiration timer to (Last created unit)
              • Unit Group - Pick every unit in (Units in (Region centered at (Position of (Casting unit)) with size (300.00, 300.00))) 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 (Owner of (Casting unit))) Equal to True
                    • Then - Actions
                      • Unit - Cause (Casting unit) to damage (Picked unit), dealing 250.00 damage of attack type Spells and damage type Normal
                    • Else - Actions
              • Wait 0.40 seconds
              • Unit - Move (Casting unit) instantly to (Random point in (Region centered at Point001 with size (700.00, 700.00))), facing (Center X of (Region centered at Point001 with size (1.00, 1.00))) degrees
              • Unit - Create 1 Magical Explosion Dummy for (Owner of (Casting unit)) at (Position of (Casting unit)) facing 270.00 degrees
              • Unit - Add a 9.00 second Generic expiration timer to (Last created unit)
              • Unit Group - Pick every unit in (Units in (Region centered at (Position of (Casting unit)) with size (300.00, 300.00))) 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 (Owner of (Casting unit))) Equal to True
                    • Then - Actions
                      • Unit - Cause (Casting unit) to damage (Picked unit), dealing 250.00 damage of attack type Spells and damage type Normal
                    • Else - Actions
              • Wait 0.40 seconds
              • Unit - Move (Casting unit) instantly to (Random point in (Region centered at Point001 with size (700.00, 700.00))), facing (Center X of (Region centered at Point001 with size (1.00, 1.00))) degrees
              • Unit - Create 1 Magical Explosion Dummy for (Owner of (Casting unit)) at (Position of (Casting unit)) facing 270.00 degrees
              • Unit - Add a 9.00 second Generic expiration timer to (Last created unit)
              • Unit Group - Pick every unit in (Units in (Region centered at (Position of (Casting unit)) with size (300.00, 300.00))) 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 (Owner of (Casting unit))) Equal to True
                    • Then - Actions
                      • Unit - Cause (Casting unit) to damage (Picked unit), dealing 250.00 damage of attack type Spells and damage type Normal
                    • Else - Actions
              • Wait 0.40 seconds
              • Unit - Move (Casting unit) instantly to (Random point in (Region centered at Point001 with size (700.00, 700.00))), facing (Center X of (Region centered at Point001 with size (1.00, 1.00))) degrees
              • Unit - Create 1 Magical Explosion Dummy for (Owner of (Casting unit)) at (Position of (Casting unit)) facing 270.00 degrees
              • Unit - Add a 9.00 second Generic expiration timer to (Last created unit)
              • Unit Group - Pick every unit in (Units in (Region centered at (Position of (Casting unit)) with size (300.00, 300.00))) 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 (Owner of (Casting unit))) Equal to True
                    • Then - Actions
                      • Unit - Cause (Casting unit) to damage (Picked unit), dealing 250.00 damage of attack type Spells and damage type Normal
                      • Custom script: call RemoveLocation (udg_Point001)
                    • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of (Ability being cast) for (Casting unit)) Equal to 3
                • Then - Actions
                  • Unit - Move (Casting unit) instantly to (Random point in (Region centered at Point001 with size (700.00, 700.00))), facing (Center X of (Region centered at Point001 with size (1.00, 1.00))) degrees
                  • Unit - Create 1 Magical Explosion Dummy for (Owner of (Casting unit)) at (Position of (Casting unit)) facing 270.00 degrees
                  • Unit - Add a 9.00 second Generic expiration timer to (Last created unit)
                  • Unit Group - Pick every unit in (Units in (Region centered at (Position of (Casting unit)) with size (300.00, 300.00))) 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 (Owner of (Casting unit))) Equal to True
                        • Then - Actions
                          • Unit - Cause (Casting unit) to damage (Picked unit), dealing 350.00 damage of attack type Spells and damage type Normal
                        • Else - Actions
                  • Wait 0.40 seconds
                  • Unit - Move (Casting unit) instantly to (Random point in (Region centered at Point001 with size (700.00, 700.00))), facing (Center X of (Region centered at Point001 with size (1.00, 1.00))) degrees
                  • Unit - Create 1 Magical Explosion Dummy for (Owner of (Casting unit)) at (Position of (Casting unit)) facing 270.00 degrees
                  • Unit - Add a 9.00 second Generic expiration timer to (Last created unit)
                  • Unit Group - Pick every unit in (Units in (Region centered at (Position of (Casting unit)) with size (300.00, 300.00))) 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 (Owner of (Casting unit))) Equal to True
                        • Then - Actions
                          • Unit - Cause (Casting unit) to damage (Picked unit), dealing 350.00 damage of attack type Spells and damage type Normal
                        • Else - Actions
                  • Wait 0.40 seconds
                  • Unit - Move (Casting unit) instantly to (Random point in (Region centered at Point001 with size (700.00, 700.00))), facing (Center X of (Region centered at Point001 with size (1.00, 1.00))) degrees
                  • Unit - Create 1 Magical Explosion Dummy for (Owner of (Casting unit)) at (Position of (Casting unit)) facing 270.00 degrees
                  • Unit - Add a 9.00 second Generic expiration timer to (Last created unit)
                  • Unit Group - Pick every unit in (Units in (Region centered at (Position of (Casting unit)) with size (300.00, 300.00))) 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 (Owner of (Casting unit))) Equal to True
                        • Then - Actions
                          • Unit - Cause (Casting unit) to damage (Picked unit), dealing 350.00 damage of attack type Spells and damage type Normal
                        • Else - Actions
                  • Wait 0.40 seconds
                  • Unit - Move (Casting unit) instantly to (Random point in (Region centered at Point001 with size (700.00, 700.00))), facing (Center X of (Region centered at Point001 with size (1.00, 1.00))) degrees
                  • Unit - Create 1 Magical Explosion Dummy for (Owner of (Casting unit)) at (Position of (Casting unit)) facing 270.00 degrees
                  • Unit - Add a 9.00 second Generic expiration timer to (Last created unit)
                  • Unit Group - Pick every unit in (Units in (Region centered at (Position of (Casting unit)) with size (300.00, 300.00))) 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 (Owner of (Casting unit))) Equal to True
                        • Then - Actions
                          • Unit - Cause (Casting unit) to damage (Picked unit), dealing 350.00 damage of attack type Spells and damage type Normal
                          • Custom script: call RemoveLocation (udg_Point001)
                        • Else - Actions
                • Else - Actions
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
That's because the unit moves before the cooldown can be applied.
In case your ability is based on "Channel", set "Data - Disable Other Abilities" to false.
If not, you can add a 0.00-second wait at the start of the trigger (note that the wait-time is actually little over 0.20 seconds).

Also: do not use "Casting Unit"! Use "Triggering Unit" instead (always).
Edit: "Casting Unit" doesn't always work with waits, that's why.
 
Status
Not open for further replies.
Top