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":
More info on the spells, not sure this is relevant, but for what it's worth:
"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.
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!
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
-
-
-
-
-
-
-
-
-
-
-
-
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
-
-
-
-
-
-
-
- Unit casts "Infect", target is hit with random 1 out of 5 "Plague" spells
- (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
- 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
Works at first - Unit casts "Infect", target is hit with random 1 out of 5 "Plague" spells
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
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
- Some time passes (?) / One of the unit is moved away and the plagues afflicting it are allowed to expire
Does not work anymore on previously infected unit - Unit casts "Infect", target is hit with random 1 out of 5 "Plague" spells
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
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!