Strange bug in auto-spreading plague trigger custom spell

Level 2
Joined
May 27, 2024
Messages
13
Hello everyone,

I am working on a "Plague" system where I have several "Plague" spells that each apply their own debuff(s), and then each one has a chance to spread to nearby units every once in a while.
The spells themselves, instead of being cast directly, are casted through a triggered "Infect" dummy spell that uses a dummy to cast one of the available spells at random.

Edit: For now, the ability is not supposed to be used by multiple units at the same time. The map is restricted to only one unit of the unit type that will have access to this spell. I will make it MUI compatible at a later date, for now I want to get it working like this.

Trigger for "Infect":
  • Infect
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Infect
      • (Unit-type of (Target unit of ability being cast)) Not equal to Kel'Thuzad
    • Actions
      • Set VariableSet InfectTempInt = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • InfectTempInt Less than or equal to 12
        • Then - Actions
          • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
          • Set VariableSet InfectDummy = (Last created unit)
          • Unit - Add Plague: Black Death to InfectDummy
          • Unit - Order InfectDummy to Undead Necromancer - Unholy Frenzy (Target unit of ability being cast)
          • Unit - Remove InfectDummy from the game
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • InfectTempInt Less than or equal to 34
            • Then - Actions
              • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
              • Set VariableSet InfectDummy = (Last created unit)
              • Unit - Add Plague: Smallpox to InfectDummy
              • Unit - Order InfectDummy to Night Elf Warden - Shadow Strike (Target unit of ability being cast)
              • Unit - Remove InfectDummy from the game
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • InfectTempInt Less than or equal to 56
                • Then - Actions
                  • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
                  • Set VariableSet InfectDummy = (Last created unit)
                  • Unit - Add Plague: Typhus to InfectDummy
                  • Unit - Order InfectDummy to Neutral Fire Lord - Soul Burn (Target unit of ability being cast)
                  • Unit - Remove InfectDummy from the game
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • InfectTempInt Less than or equal to 78
                    • Then - Actions
                      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
                      • Set VariableSet InfectDummy = (Last created unit)
                      • Unit - Add Plague: Consumption to InfectDummy
                      • Unit - Order InfectDummy to Undead Necromancer - Unholy Frenzy (Target unit of ability being cast)
                      • Unit - Remove InfectDummy from the game
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • InfectTempInt Less than or equal to 100
                        • Then - Actions
                          • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
                          • Set VariableSet InfectDummy = (Last created unit)
                          • Unit - Add Plague: Bloody Flux to InfectDummy
                          • Unit - Order InfectDummy to Undead Necromancer - Unholy Frenzy (Target unit of ability being cast)
                          • Unit - Remove InfectDummy from the game
                        • Else - Actions
Plague spread trigger:
  • Infect Spread
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) has buff Plague: Black Death ) Equal to True) or ((((Matching unit) has buff Plague: Bloody Flux ) Equal to True) or ((((Matching unit) has buff Plague: Consumption ) Equal to True) or ((((Matching uni and do (Actions)
        • Loop - Actions
          • Set VariableSet InfectSpreadUnit = (Picked unit)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 500.00 of (Position of InfectSpreadUnit) matching ((((Matching unit) is alive) Equal to True) and ((((Owner of (Matching unit)) controller) Not equal to Passive) and ((((Matching unit) is A structure) Equal to False) and ((Unit-type of (Matching and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (InfectSpreadUnit has buff Plague: Black Death ) Equal to True
                  • (Random integer number between 1 and 100) Less than or equal to 30
                • Then - Actions
                  • Unit - Create 1 Dummy for (Owner of (Picked unit)) at (Position of (Picked unit)) facing Default building facing degrees
                  • Set VariableSet InfectSpreadDummy = (Last created unit)
                  • Unit - Add Plague: Black Death to InfectSpreadDummy
                  • Unit - Order InfectSpreadDummy to Undead Necromancer - Unholy Frenzy (Picked unit)
                  • Unit - Remove InfectSpreadDummy from the game
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (InfectSpreadUnit has buff Plague: Smallpox ) Equal to True
                  • (Random integer number between 1 and 100) Less than or equal to 30
                • Then - Actions
                  • Unit - Create 1 Dummy for (Owner of (Picked unit)) at (Position of (Picked unit)) facing Default building facing degrees
                  • Set VariableSet InfectSpreadDummy = (Last created unit)
                  • Unit - Add Plague: Smallpox to InfectSpreadDummy
                  • Unit - Order InfectSpreadDummy to Night Elf Warden - Shadow Strike (Picked unit)
                  • Unit - Remove InfectSpreadDummy from the game
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (InfectSpreadUnit has buff Plague: Typhus ) Equal to True
                  • (Random integer number between 1 and 100) Less than or equal to 30
                • Then - Actions
                  • Unit - Create 1 Dummy for (Owner of (Picked unit)) at (Position of (Picked unit)) facing Default building facing degrees
                  • Set VariableSet InfectSpreadDummy = (Last created unit)
                  • Unit - Add Plague: Typhus to InfectSpreadDummy
                  • Unit - Order InfectSpreadDummy to Neutral Fire Lord - Soul Burn (Picked unit)
                  • Unit - Remove InfectSpreadDummy from the game
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (InfectSpreadUnit has buff Plague: Consumption ) Equal to True
                  • (Random integer number between 1 and 100) Less than or equal to 30
                • Then - Actions
                  • Unit - Create 1 Dummy for (Owner of (Picked unit)) at (Position of (Picked unit)) facing Default building facing degrees
                  • Set VariableSet InfectSpreadDummy = (Last created unit)
                  • Unit - Add Plague: Consumption to InfectSpreadDummy
                  • Unit - Order InfectSpreadDummy to Undead Necromancer - Unholy Frenzy (Picked unit)
                  • Unit - Remove InfectSpreadDummy from the game
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (InfectSpreadUnit has buff Plague: Bloody Flux ) Equal to True
                  • (Random integer number between 1 and 100) Less than or equal to 30
                • Then - Actions
                  • Unit - Create 1 Dummy for (Owner of (Picked unit)) at (Position of (Picked unit)) facing Default building facing degrees
                  • Set VariableSet InfectSpreadDummy = (Last created unit)
                  • Unit - Add Plague: Bloody Flux to InfectSpreadDummy
                  • Unit - Order InfectSpreadDummy to Undead Necromancer - Unholy Frenzy (Picked unit)
                  • Unit - Remove InfectSpreadDummy from the game
                • Else - Actions
What I expect to happen:
  1. Unit casts "Infect", target is hit with random 1 out of 5 "Plague" spells
  2. (Optional) Unit casts "Infect" again, target is hit with another random 1 out of 5 "Plague" spells (possibly same one as before); the "Plagues" stack
  3. Every 3s until the Plague finishes, for all plagued units, there is a 30% chance per nearby unit that said nearby unit will also be hit with the same "Plague" spell(s) as the plagued unit
What happens:
  1. ✅Works at first - Unit casts "Infect", target is hit with random 1 out of 5 "Plague" spells
  2. ✅Works at first - (Optional) Unit casts "Infect" again, target is hit with another random 1 out of 5 "Plague" spells (possibly same one as before); the "Plagues" stack
  3. ✅Works at first - Every 3s until the Plague finishes, for all plagued units, there is a 30% chance per nearby unit that said nearby unit will also be hit with the same "Plague" spell(s) as the plagued unit
    • It seems the plagues spread infinitely given enough units, as expected. Tested with 50k hp ghouls, put timer and AFK'd for 5 minutes and when I came back, all ghouls still had all 5 plagues on them
  4. Some time passes (?) / One of the unit is moved away and the plagues afflicting it are allowed to expire
  5. ❌ Does not work anymore on previously infected unit - Unit casts "Infect", target is hit with random 1 out of 5 "Plague" spells
  6. ❌ Does not work anymore on previously infected unit - (Optional) Unit casts "Infect" again, target is hit with another random 1 out of 5 "Plague" spells (possibly same one as before); the "Plagues" stack
  7. ❌Does not work anymore on previously infected unit, plagues don't spread to it anymore - Every 3s until the Plague finishes, for all plagued units, there is a 30% chance per nearby unit that said nearby unit will also be hit with the same "Plague" spell(s) as the plagued unit
    • It seems like the unit has strangely become "immune" to the trigger itself. Any attempt to cast "Infect" on it will correctly go through the trigger instructions (tested by displaying debug messages, even the dummy unit is spawned and given the ability), the unit just isn't hit with the spell anymore.
    • Even more strangely, the trigger itself still works on other units; after some time, it stops working for said units as well, as if "marking" them.
    • Even more strangely, the "Plague" spells themselves, if cast directly, work. I tested this by adding them to the unit instead of the "Infect" spell and casting and sure enough the unit was hit with the spell.


More info on the spells, not sure this is relevant, but for what it's worth:
  • "Plague: Black Death" is based off of Unholy Frenzy and its buff is based off of Shadow Strike buff: It just deals damage over time
  • "Plague: Smallpox" is based off of Shadow Strike and its buffs are based off of Slow: It deals damage over time and slows movement speed
  • "Plague: Typhus" is based off of Soul Burn and its buff is based off of Soul Burn buff: It deals damage over time and prevents spellcasting
  • "Plague: Consumption" is based off of Unholy Frenzy and its buffs are based off of Drunken Haze and Cripple buffs: It deals damage over time and reduces attack damage and attack speed
  • "Plague: Bloody Flux" is based off of Unholy Frenzy and its buff is based off of Corruption buff (item): At random, it deals damage and stuns (dummy unit casts storm bolt on it)

"Plague: Black Death", "Plague: Smallpox", "Plague: Typhus" are not triggered. Here are the triggers for "Plague: Consumption" and "Plague: Bloody Flux". Note, these spells work perfectly fine, as tested either through "Infect", when spread and when cast directly.
  • Infect Consumption Extra
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Plague: Consumption
    • Actions
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
      • Set VariableSet InfectConsumptionDummy = (Last created unit)
      • Unit - Add Plague: Consumption (Extra) to InfectConsumptionDummy
      • Unit - Order InfectConsumptionDummy to Undead Necromancer - Cripple (Target unit of ability being cast)
      • Unit - Remove InfectConsumptionDummy from the game
  • Infect Bloody Flux
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Plague: Bloody Flux ) Equal to True)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Less than or equal to 50
            • Then - Actions
              • Unit - Create 1 Dummy for (Owner of (Picked unit)) at (Position of (Picked unit)) facing Default building facing degrees
              • Set VariableSet InfectBloodyFluxDummy = (Last created unit)
              • Unit - Add Plague: Bloody Flux (Stun) to InfectBloodyFluxDummy
              • Unit - Order InfectBloodyFluxDummy to Human Mountain King - Storm Bolt (Picked unit)
              • Unit - Remove InfectBloodyFluxDummy from the game
            • Else - Actions


With all that being said, what do you think? What could be the cause for this strange bug? Trigger working selectively on certain units? Is it from the UserGroup abuse or something else? I don't really understand the issue and I've tried everything to debug it.

Thank you all in advance!
 
Level 2
Joined
May 27, 2024
Messages
13
I... I think I found the issue.

I wanted to check that the dummy is definitely casting the spell. So I replaced the dummy with a Mountain King (random unit doesn't matter) and, just to be able to see it, I also added a 1s wait time after casting.

Now it works perfectly.

Sooo it seems the issue was the dummy didn't have time to cast before being removed? But only sometimes? I find it strange that it would work sometimes and sometimes not. Could the really bad inefficiency of the trigger make the game lag which in turn results in this happening more often as the game progresses or? Anyone with more experience using the editor know?

Thanks anyhow, I'll report back in this thread when I test the map at length if the issue is actually solved. I'll have to use timers now unfortunately...

Edit: Also added condition spread unit != unit being spread to. Oops 😅. But inconsequential to the main post.
 
Last edited:
Level 2
Joined
May 27, 2024
Messages
13
Nevermind, it seems the dummy successfully casts but only if the unit stands still???

I realized this because I was testing on allied units. When I tested on neutral / computer units with acquistion, they moved and I can see the dummy model just standing there with no casting anim. However if I'm immune / targeting peasants, the dummy successfully casts the spell. What the hell? 😭

Just tested with normal footman:
  • With movement speed 270 (default): does not work
  • With movement speed 0: works
SOLVED. Followed this guide: https://world-editor-tutorials.thehelper.net/cat_usersubmit.php?view=26751 The dummy unit I had was taken from another custom spell system from here (JeffQ's Chain System) and for some reason the dummy was missing a couple of things (night vision set to max, is a building and a couple more). That seems to have fixed it.
 
Last edited:
Level 24
Joined
Feb 27, 2019
Messages
833
Uncle often posts his short guide on how to construct a proper dummy unit. Its in that post.
 
Level 2
Joined
May 27, 2024
Messages
13
Yeah I guess my fault here is I went with this random dummy I found on hiveworkshop and expected it to be good.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Yeah I guess my fault here is I went with this random dummy I found on hiveworkshop and expected it to be good.
That thread you linked is still making mistakes. Careful with using old information.

If you want a Dummy to cast spells "instantly":
Copy and paste the Locust, set it's Movement Type = None, Speed Base = 0, Attacks Enabled = None, Model = None, Shadow = None.

If you want to use a Dummy unit as a Missile in your triggers (which is obsolete as of patch 1.31) you would use the above settings but modify it's Movement to allow it to move around.

Some other important things to note:

1) All of your Dummy abilities need 99999 cast range, 0 mana cost, 0 cooldown, 0 casting time, no requirements, and proper Targets Allowed. In other words, the unit must be able to cast the ability without any issues.

2) Vision can be a problem when ordering the Dummy to target something. I believe you can simply do this to get around it:
  • Unit - Grant shared vision of (Your target) for (Owner of Dummy)
  • Unit - Order Dummy to Storm Bolt (Your target)
  • Unit - Remove shared vision of (Your target) for (Owner of Dummy)
3) There's a Dummy model on Hive that has Attachment Points which will allow it to use Art effects. I recommend using that model instead of an empty path.
 
Last edited:
Top