• 🏆 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!

What's wrong with this trigger?

Status
Not open for further replies.
Level 4
Joined
Jan 6, 2023
Messages
33
It doesn't damage the enemy after Sleep goes off
  • Damnation
    • Events
      • Unit - A unit starts the effect of an Ability
    • Conditions
      • (Ability being cast) Equal to Damnation
    • Actions
      • Set Temppoint = (Position of (Target unit of ability being cast))
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Temppoint2 facing default building facing degrees
      • Custom script: call RemoveLocation(udg_Temppoint)
      • Unit - Add Damnation dummy sen to (Last created unit)
      • Unit - Order (Last created unit) to Undead - Dreadlord: Sleep (Target unit of ability being cast)
      • Unit - Add a 2.00 second generic expiration timer to (Last created unit)
      • Unit - Remove Damnation dummy sen from (Last created unit)
      • Unit Group - Add (Target unit of ability being cast) to NW_Group
  • Sleep damage
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in NW_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Sleep) Equal to False
            • Then - Actions
              • Set Temppoint = (Position of (Target unit of ability being cast))
              • Unit - Create 1 Dummy for Neutral - Hostile at Temppoint2 facing default building facing degrees
              • Custom script: call RemoveLocation(udg_Temppoint)
              • Unit - Add a 2.00 second generic expiration timer to (Last created unit)
              • Unit - Cause (Last created unit) to damage (Picked unit), dealing 175.00 damage of attack type Normal and damage type Normal
              • Special Effect - Create a special effect attached to the origin of (Picked unit) using war3mapImported\Damnation Orange.mdx
              • Special Effect - Destroy (Last created special effect)
              • Unit Group - Remove (Picked unit) from NW_Group
            • Else - Actions
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,542
First rule, stop removing abilities from your Dummy units. That doesn't make any sense.

Second, it can help to use a variable to track the Dummy unit instead of referencing (Last created unit) multiple times. Also, make sure your variables are correct, you're using Temppoint2 when you meant to use Temppoint. Referencing an unset Point variable will fail to create the unit.

Third, make sure your Dummy unit is setup properly. It should be based on the Locust unit with the following IMPORTANT changes:
Movement Type = None, Speed Base = 0, Attacks Enabled = None, Model = None, Shadow = None, Abilities = Locust.

Fourth, don't use a Dummy unit to damage the (Picked unit). Simply have the (Casting unit) damage the (Picked unit) using one of the many methods available. My personal preference is the Unit Indexer. Import this system into your map (make sure you don't have one already) and you can now take advantage of Custom Value to store data to units. You'll probably need an older version that is compatible with your version of Warcraft 3.

Here's how simple your spell becomes using the Unit Indexer method:
  • Damnation
    • Events
      • Unit - A unit starts the effect of an Ability
    • Conditions
      • (Ability being cast) Equal to Damnation
    • Actions
      • Set DamnationCaster[Custom value of (Target unit of ability being cast)] = (Triggering unit)
      • Unit Group - Add (Target unit of ability being cast) to NW_Group
      • Set TempPoint = (Position of (Target unit of ability being cast))
      • Unit - Create 1 Dummy for (Triggering player) at TempPoint facing default building facing degrees
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Set TempDummy = (Last created unit)
      • Unit - Add Damnation dummy sen to TempDummy
      • Unit - Add a 0.20 second generic expiration timer to TempDummy
      • Unit - Order TempDummy to Undead - Dreadlord: Sleep (Target unit of ability being cast)
      • Trigger - Turn on Sleep damage
  • Sleep damage
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in NW_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Sleep) Equal to False
            • Then - Actions
              • Special Effect - Create a special effect attached to the origin of (Picked unit) using war3mapImported\Damnation Orange.mdx
              • Special Effect - Destroy (Last created special effect)
              • Unit Group - Remove (Picked unit) from NW_Group
              • Unit - Cause DamnationCaster[Custom value of (Picked unit)] to damage (Picked unit), dealing 175.00 damage of attack type Normal and damage type Normal
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in NW_Group) Equal to 0
        • Then - Actions
          • Trigger - Turn off (this trigger)
        • Else - Actions
I'm not too sure why your Hero isn't the one casting Sleep but I'll assume you have your reasons.

Notes:
  • My Dummy unit's expiration timer is much shorter since it will cast Sleep almost instantaneously.
  • My Sleep damage trigger runs far more often which will make it feel so much better. You don't have to worry about performance issues here.
  • I'm turning off the Sleep damage trigger while no units have the Sleep buff and turning it On while at least one unit has the buff.
  • Further usage of variables can help make the triggers more efficient and possibly avoid rare issues. For instance, storing the (Target unit of ability being cast) and the (Picked unit) in Unit variables would be nice.
  • Your naming conventions are asking for confusion in the future. I would make all of these triggers/variables/buffs named after Damnation instead of having them all differ.
  • If you were already using the Custom Value action in your triggers then you'll need to change that to take advantage of the Unit Indexer instead.
  • Attack type Normal and damage type Normal is NOT equal to Spell damage (maybe intentional).
 
Last edited:
Level 4
Joined
Jan 6, 2023
Messages
33
could you give me more context on what you want to happen with these triggers in plain words?
Strikes for some damage (damnation spell) > puts to sleep > strikes again after sleep buff is over

Thank you Uncle for such a comprehensive response. I implemented Unit indexer to my map and I think I'll use it more often, because it's useful (didn't know about it before)
Everything works now!!
 
Status
Not open for further replies.
Top