• 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] DOTs not working

Status
Not open for further replies.
Level 4
Joined
Aug 18, 2013
Messages
71
Hey guys, I'm working on some DOTS (1 AOE, 1 Single target stackable) and was hoping if anyone could proofread my code and tell me what is wrong.


  • SufferingPriest Catch
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Affliction
          • (Ability being cast) Equal to Agonize
    • Actions
      • Custom script: local unit u
      • Set Gen_MIndex = (Gen_MIndex + 1)
      • Set Gen_Caster[Gen_MIndex] = (Casting unit)
      • Set Gen_AbilLevel[Gen_MIndex] = (Level of (Ability being cast) for (Casting unit))
      • Set Gen_Player[Gen_MIndex] = (Owner of (Casting unit))
      • Set Gen_Abil[Gen_MIndex] = (Ability being cast)
      • -------- Code --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Affliction
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Gen_TargetU[Gen_MIndex] has buff Affliction ) Equal to False
            • Then - Actions
              • Unit - Create 1 Dummy for Gen_Player[Gen_MIndex] at (Position of (Casting unit)) facing Default building facing degrees
              • Custom script: set u = GetLastCreatedUnit()
              • Unit - Add ApplyAfflictionBuff to (Last created unit)
              • Unit - Order (Last created unit) to Undead Necromancer - Cripple Gen_TargetU[Gen_MIndex]
              • Wait 0.50 seconds
              • Custom script: set udg_TempUnit = u
              • Unit - Remove TempUnit from the game
              • Custom script: set udg_TempUnit = null
              • Custom script: set u = null
              • Game - Display to (All players) the text: -debug EOF Afflicti...
            • Else - Actions
          • Set Gen_TargetG[Gen_MIndex] = (Units within 500.00 of (Target point of ability being cast) matching (((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True))
          • Set Gen_Damage[Gen_MIndex] = ((15.00 + (15.00 x (Real((Level of (Ability being cast) for (Casting unit)))))) + (Real((Intelligence of (Casting unit) (Include bonuses)))))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
            • Then - Actions
              • Custom script: set udg_Gen_Damage[udg_Gen_MIndex] = udg_Gen_Damage[udg_Gen_MIndex] + I2R(GetHeroInt(udg_Gen_Caster[udg_Gen_MIndex],true))
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Agonize
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Gen_TargetU[Gen_MIndex] has buff Agonize Stack # 1 ) Equal to True
            • Then - Actions
              • Unit - Remove Agonize Stack # 1 buff from Gen_TargetU[Gen_MIndex]
              • Unit - Create 1 Dummy for Gen_Player[Gen_MIndex] at (Position of (Casting unit)) facing Default building facing degrees
              • Custom script: set u = GetLastCreatedUnit()
              • Unit - Add ApplyAgonizeBuff2 to (Last created unit)
              • Unit - Order (Last created unit) to Undead Necromancer - Cripple Gen_TargetU[Gen_MIndex]
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Gen_TargetU[Gen_MIndex] has buff Agonize Stack # 2 ) Equal to True
                • Then - Actions
                  • Unit - Remove Agonize Stack # 2 buff from Gen_TargetU[Gen_MIndex]
                  • Unit - Create 1 Dummy for Gen_Player[Gen_MIndex] at (Position of (Casting unit)) facing Default building facing degrees
                  • Custom script: set u = GetLastCreatedUnit()
                  • Unit - Add ApplyAgonizeBuff3 to (Last created unit)
                  • Unit - Order (Last created unit) to Undead Necromancer - Cripple Gen_TargetU[Gen_MIndex]
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Gen_TargetU[Gen_MIndex] has buff Agonize Stack # 3 ) Equal to True
                    • Then - Actions
                      • Unit - Create 1 Dummy for Gen_Player[Gen_MIndex] at (Position of (Casting unit)) facing Default building facing degrees
                      • Custom script: set u = GetLastCreatedUnit()
                      • Unit - Add ApplyAgonizeBuff3 to (Last created unit)
                      • Unit - Order (Last created unit) to Undead Necromancer - Cripple Gen_TargetU[Gen_MIndex]
                    • Else - Actions
                      • Unit - Create 1 Dummy for Gen_Player[Gen_MIndex] at (Position of (Casting unit)) facing Default building facing degrees
                      • Custom script: set u = GetLastCreatedUnit()
                      • Unit - Add ApplyAgonizeBuff1 to (Last created unit)
                      • Unit - Order (Last created unit) to Undead Necromancer - Cripple Gen_TargetU[Gen_MIndex]
                  • Unit - Create 1 Dummy for Gen_Player[Gen_MIndex] at (Position of (Casting unit)) facing Default building facing degrees
                  • Custom script: set u = GetLastCreatedUnit()
                  • Unit - Add ApplyAgonizeBuff1 to (Last created unit)
                  • Unit - Order (Last created unit) to Undead Necromancer - Cripple Gen_TargetU[Gen_MIndex]
          • Wait 0.50 seconds
          • Custom script: set udg_TempUnit = u
          • Unit - Remove TempUnit from the game
          • Custom script: set udg_TempUnit = null
          • Custom script: set u = null
          • Set Gen_TargetU[Gen_MIndex] = (Target unit of ability being cast)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Gen_AbilLevel[Gen_MIndex] Equal to 1
            • Then - Actions
              • Set Gen_Damage[Gen_MIndex] = (30.00 + ((Real((Intelligence of Gen_Caster[Gen_MIndex] (Include bonuses)))) x 0.30))
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Gen_AbilLevel[Gen_MIndex] Equal to 2
                • Then - Actions
                  • Set Gen_Damage[Gen_MIndex] = (40.00 + ((Real((Intelligence of Gen_Caster[Gen_MIndex] (Include bonuses)))) x 0.45))
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Gen_AbilLevel[Gen_MIndex] Equal to 3
                    • Then - Actions
                      • Set Gen_Damage[Gen_MIndex] = (55.00 + ((Real((Intelligence of Gen_Caster[Gen_MIndex] (Include bonuses)))) x 0.60))
                    • Else - Actions
                      • Set Gen_Damage[Gen_MIndex] = (67.50 + ((Real((Intelligence of Gen_Caster[Gen_MIndex] (Include bonuses)))) x 0.70))
          • Wait 0.50 seconds
          • Custom script: set udg_TempUnit = GetLastCreatedUnit()
          • Unit - Remove TempUnit from the game
          • Custom script: set udg_TempUnit = null
          • Custom script: set u = null
          • Game - Display to (All players) the text: -debug EOF Agonize ...
        • Else - Actions
      • -------- END --------
      • Game - Display to (All players) the text: -Suffering Priest d...
      • Set Gen_Counter[Gen_MIndex] = 0
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Gen_MIndex Equal to 1
        • Then - Actions
          • -------- Hero-SP-Affliction --------
          • Trigger - Turn on SufferingPriest Loop <gen>
        • Else - Actions
-----------------------------------------------------------------
  • SufferingPriest Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Gen_CIndex) from 1 to Gen_MIndex, do (Actions)
        • Loop - Actions
          • Set Gen_Counter[Gen_CIndex] = (Gen_Counter[Gen_CIndex] + 1)
          • Game - Display to (All players) the text: (-debug counter = + (String(Gen_Counter[Gen_CIndex])))
          • Unit - Create 1 Dummy for Gen_Player[Gen_CIndex] at (Position of Gen_Caster[Gen_CIndex]) facing Default building facing degrees
          • Set Gen_Dummy[Gen_CIndex] = (Last created unit)
          • -------- Affliction --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Gen_Abil[Gen_CIndex] Equal to Affliction
              • Gen_Counter[Gen_CIndex] Less than 6
            • Then - Actions
              • Game - Display to (All players) the text: -Affliction Debug
              • Unit Group - Pick every unit in Gen_TargetG[Gen_CIndex] and do (Actions)
                • Loop - Actions
                  • Unit - Cause Gen_Dummy[Gen_CIndex] to damage (Picked unit), dealing Gen_Damage[Gen_CIndex] damage of attack type Spells and damage type Normal
            • Else - Actions
              • Unit Group - Pick every unit in Gen_TargetG[Gen_CIndex] and do (Actions)
                • Loop - Actions
                  • Unit - Remove Affliction buff from Gen_TargetU[Gen_CIndex]
              • -------- Cleanup below --------
              • Unit - Remove Gen_Dummy[Gen_CIndex] from the game
              • Custom script: set udg_Gen_Abil[udg_Gen_CIndex] = 0
              • Custom script: set udg_Gen_Dummy[udg_Gen_CIndex] = null
              • Set Gen_Caster[Gen_CIndex] = Gen_Caster[Gen_MIndex]
              • Set Gen_Counter[Gen_CIndex] = Gen_Counter[Gen_MIndex]
              • Set Gen_MIndex = (Gen_MIndex - 1)
              • Set Gen_CIndex = (Gen_CIndex - 1)
          • -------- Agonize --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Gen_Abil[Gen_CIndex] Equal to Agonize
              • Gen_Counter[Gen_CIndex] Less than 9
            • Then - Actions
              • Game - Display to (All players) the text: -agonize Debug
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Gen_TargetU[Gen_CIndex] has buff Agonize Stack # 1 ) Equal to True
                • Then - Actions
                  • Unit - Cause Gen_Dummy[Gen_CIndex] to damage Gen_TargetU[Gen_CIndex], dealing Gen_Damage[Gen_CIndex] damage of attack type Spells and damage type Normal
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Gen_TargetU[Gen_CIndex] has buff Agonize Stack # 2 ) Equal to True
                    • Then - Actions
                      • Unit - Cause Gen_Dummy[Gen_CIndex] to damage Gen_TargetU[Gen_CIndex], dealing Gen_Damage[Gen_CIndex] damage of attack type Spells and damage type Normal
                      • Unit - Cause Gen_Dummy[Gen_CIndex] to damage Gen_TargetU[Gen_CIndex], dealing Gen_Damage[Gen_CIndex] damage of attack type Spells and damage type Normal
                    • Else - Actions
                      • Unit - Cause Gen_Dummy[Gen_CIndex] to damage Gen_TargetU[Gen_CIndex], dealing Gen_Damage[Gen_CIndex] damage of attack type Spells and damage type Normal
                      • Unit - Cause Gen_Dummy[Gen_CIndex] to damage Gen_TargetU[Gen_CIndex], dealing Gen_Damage[Gen_CIndex] damage of attack type Spells and damage type Normal
                      • Unit - Cause Gen_Dummy[Gen_CIndex] to damage Gen_TargetU[Gen_CIndex], dealing Gen_Damage[Gen_CIndex] damage of attack type Spells and damage type Normal
            • Else - Actions
              • Unit - Remove Agonize Stack # 1 buff from Gen_TargetU[Gen_CIndex]
              • Unit - Remove Agonize Stack # 2 buff from Gen_TargetU[Gen_CIndex]
              • Unit - Remove Agonize Stack # 3 buff from Gen_TargetU[Gen_CIndex]
              • -------- Cleanup below --------
              • Unit - Remove Gen_Dummy[Gen_CIndex] from the game
              • Custom script: set udg_Gen_Abil[udg_Gen_CIndex] = 0
              • Custom script: set udg_Gen_Dummy[udg_Gen_CIndex] = null
              • Set Gen_Caster[Gen_CIndex] = Gen_Caster[Gen_MIndex]
              • Set Gen_Counter[Gen_CIndex] = Gen_Counter[Gen_MIndex]
              • Set Gen_MIndex = (Gen_MIndex - 1)
              • Set Gen_CIndex = (Gen_CIndex - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Gen_MIndex Equal to 0
            • Then - Actions
              • Trigger - Turn off (This trigger)
            • Else - Actions
 
Level 9
Joined
Dec 12, 2007
Messages
489
which part is not working? since you have placed some debug messages, which one shows wrong messages?

1. use Unit starts the effect of an ability event rather than begin casting an ability.

2. avoid using wait to remove your dummy unit, you can use expiration timer for it.

3. I suggest you to divide those 2 spells into 2 set of triggers rather than combining it into one trigger, this way, you can debug it easier and of course more readable.

4. Your trigger has a lot of location leaks.

5.
  • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Gen_TargetU[Gen_MIndex] has buff Agonize Stack # 2 ) Equal to True
      • Then - Actions
        • Unit - Remove Agonize Stack # 2 buff from Gen_TargetU[Gen_MIndex]
        • Unit - Create 1 Dummy for Gen_Player[Gen_MIndex] at (Position of (Casting unit)) facing Default building facing degrees
        • Custom script: set u = GetLastCreatedUnit()
        • Unit - Add ApplyAgonizeBuff3 to (Last created unit)
        • Unit - Order (Last created unit) to Undead Necromancer - Cripple Gen_TargetU[Gen_MIndex]
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Gen_TargetU[Gen_MIndex] has buff Agonize Stack # 3 ) Equal to True
          • Then - Actions
            • Unit - Create 1 Dummy for Gen_Player[Gen_MIndex] at (Position of (Casting unit)) facing Default building facing degrees
            • Custom script: set u = GetLastCreatedUnit()
            • Unit - Add ApplyAgonizeBuff3 to (Last created unit)
            • Unit - Order (Last created unit) to Undead Necromancer - Cripple Gen_TargetU[Gen_MIndex]
          • Else - Actions
            • Unit - Create 1 Dummy for Gen_Player[Gen_MIndex] at (Position of (Casting unit)) facing Default building facing degrees
            • Custom script: set u = GetLastCreatedUnit()
            • Unit - Add ApplyAgonizeBuff1 to (Last created unit)
            • Unit - Order (Last created unit) to Undead Necromancer - Cripple Gen_TargetU[Gen_MIndex]
          • Unit - Create 1 Dummy for Gen_Player[Gen_MIndex] at (Position of (Casting unit)) facing Default building facing degrees
          • Custom script: set u = GetLastCreatedUnit()
          • Unit - Add ApplyAgonizeBuff1 to (Last created unit)
          • Unit - Order (Last created unit) to Undead Necromancer - Cripple Gen_TargetU[Gen_MIndex]
          • Wait 0.50 seconds
looks like you add too much there.

6. you should set all handle related variable before waits, lots of handle event response lost its reference even after the smallest wait, like this one:
  • Wait 0.50 seconds
  • Custom script: set udg_TempUnit = u
  • Unit - Remove TempUnit from the game
  • Custom script: set udg_TempUnit = null
  • Custom script: set u = null
  • Set Gen_TargetU[Gen_MIndex] = (Target unit of ability being cast)
7.
  • Custom script: local unit u
  • Set Gen_MIndex = (Gen_MIndex + 1)
  • Set Gen_Caster[Gen_MIndex] = (Casting unit)
  • Set Gen_AbilLevel[Gen_MIndex] = (Level of (Ability being cast) for (Casting unit))
  • Set Gen_Player[Gen_MIndex] = (Owner of (Casting unit))
  • Set Gen_Abil[Gen_MIndex] = (Ability being cast)
  • -------- Code --------
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Ability being cast) Equal to Affliction
    • Then - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Gen_TargetU[Gen_MIndex] has buff Affliction ) Equal to False
        • Then - Actions
you haven't set the Gen_TargetU[Gen_MIndex].

honestly, your spells are badly coded, mainly because you combine two spell into one trigger, which will cause confusion and lots of mistake here and there. I really suggest you to split the trigger and recode both spells from beginning, that way, you might spot what's wrong and fix it. If you decided to recode it, I suggest you to remove those location leaks while on it.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Not related to location leaks, but I just noticed you are double checking the condition Ability cast equal to Affliction:

  • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • (Ability being cast) Equal to Affliction
        • (Ability being cast) Equal to Agonize
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Ability being cast) Equal to Affliction
 
Status
Not open for further replies.
Top