• 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.

Question about triggers and splash damage for my dragon boys

Luu

Luu

Level 6
Joined
Feb 11, 2021
Messages
45
My Red Dragon and Green Dragon respectively have the abilities Fire Breath (based on Flame Strike) and Corrosion Breath (based on Acid Bomb). Both have Weapon Type Missile Splash for Attack 1 (ground units) and Missile for Attack 2 (air units).

Initially, I wanted these abilities to be based on Burning Oil for Fire Breath and Envenomed Weapons or Corrosion Breath (from Chimaeras) for the custom Corrosion Breath. For Burning Oil, I wanted a trigger that would give it a chance to activate. However, Envenomed Weapons did not work with the Green Dragon's Missile Splash weapon type, as it seems incompatible. The Chimaeras' Corrosion Breath also doesn't work on units other than Structures, even when I change the Targets Allowed. A trigger might be needed to force the Chimaeras' Corrosion Breath to work on other units.

As an alternative, I created a trigger that gives a chance for a Dummy to cast Fire Breath or Corrosion Breath on the primary unit hit by the dragons' attack. However, the trigger produced an undesired behavior: the Dummy casts Flame Strike, for instance, randomly on different locations and units around the primary target when there are many units nearby, instead of focusing solely on the primary target.

I've already adjusted the Cast Range fields to see if anything changes, but it hasn't helped. I really want to use the dragons with Missile Splash, but I suspect this might be causing some sort of conflict.

I am a beginner with triggers, so there are things I will definitely need help with.

  • Fire Breath
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Unit-type of (Damage source)) Equal to Red Dragon
      • ((Triggering unit) belongs to an enemy of (Owner of (Damage source)).) Equal to True
      • (Random integer number between 1 and 100) Less than or equal to 15
    • Actions
      • Set VariableSet FireBreathPoint = (Position of (Triggering unit))
      • Unit - Create 1 Dummy (New) for (Owner of (Damage source)) at FireBreathPoint facing Default building facing degrees
      • Unit - Add Burn (Dummy) to (Last created unit)
      • Unit - Order (Last created unit) to Human Blood Mage - Flame Strike FireBreathPoint
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation(udg_FireBreathPoint)
  • Corrosive Breath
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Unit-type of (Damage source)) Equal to Green Dragon
      • ((Triggering unit) belongs to an enemy of (Owner of (Damage source)).) Equal to True
    • Actions
      • Set VariableSet CorrosionBreathPoint = (Position of (Triggering unit))
      • Unit - Create 1 Dummy (New) for (Owner of (Damage source)) at CorrosionBreathPoint facing Default building facing degrees
      • Unit - Add Corrosion to (Last created unit)
      • Unit - Order (Last created unit) to Neutral Alchemist - Acid Bomb (Triggering unit)
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation(udg_CorrosionBreathPoint)
I’m open to suggestions and eager to understand how I can achieve my goal. After all, it’s the only thing left for me to release my map now. :thumbs_up:
 
Level 29
Joined
Sep 26, 2009
Messages
2,596
If your dragon deals splash damage, then those conditions will be true for all units that got hit by the splash damage, not just the primary target.
You may want to trigger the splash damage as well, I think.
For fire breath you could have something like:
  1. Unit takes damage
  2. Damage source is dragon
  3. Damage target is enemy of dragon
  4. Turn the trigger off
  5. In actions, roll random number
  6. Check if rolled number is <= 15
    1. If yes:
      1. Create dummy, give it Burn, cast it on location of Damage Target
    2. If not:
      1. Pick all nearby units, except for the target, and deal damage to them via trigger
  7. Turn the trigger back on
 
Level 3
Joined
Nov 16, 2024
Messages
7
You're detecting damage here from the dragons directly sir and you have also set their projectile type to be Missile (Splash)
This means every unit that you're splashing damaging onto is going to trigger the event here. Hence why it appears it's hitting random units around the target.

If it were up to me, I would change the your dragons Missile type back to normal and trigger the Splash effect damage through another dummy unit. That way, you won't trigger the event.

Might be a better way to set conditions, but I identified what might be your problem
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
  • Unit - A unit Takes damage
Understand that this Event won't make any assumptions and will do precisely what it says it does. So currently what's happening is that you're creating multiple Dummy units, one per unit caught in the splash damage of the attack, all casting their own unique instance of the spell. It's your job to prevent this by adding more Conditions.

For instance, you'll likely want to distinguish between Attacks and Spells:
  • (Damage From Normal Attack) Equal to True
Unfortunately, there is no Condition for a "primary target". I think Bribe's Damage Engine has a solution to this, but the first thing that comes to my mind would be to use the "A unit is attacked" Event and cache the "Attacked unit" in a variable that is linked to the Dragon which can then be referenced in the Conditions of your Damage triggers.

You may have also failed to setup your Dummy unit properly as well as failed to allow enough time for the Dummy unit to finish casting it's spell (Flame Strike comes to mind). The demo map below has a properly setup Dummy unit you can copy and paste if you'd like.

Your triggers aside, I went ahead and made a triggered DoT effect that you can use for your original envenomed weapons idea:
  • Chimera Poison Damage
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Damage From Normal Attack) Equal to True
      • (Unit-type of (Damage source)) Equal to Chimaera
    • Actions
      • -------- Track the caster and the target: --------
      • Set VariableSet Chim_Target = (Damage Target)
      • Set VariableSet Chim_Id = (Custom value of Chim_Target)
      • Set VariableSet Chim_Caster[Chim_Id] = (Damage source)
      • -------- --------
      • -------- Set the poison buff duration and poison damage per second: --------
      • Set VariableSet Chim_Poison_Duration[Chim_Id] = 5.00
      • Set VariableSet Chim_Poison_Damage[Chim_Id] = 10.00
      • -------- --------
      • -------- Reset the damage interval only if it's a completely fresh application of the buff: --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Chim_Poison_Interval[Chim_Id] Equal to 0.00
        • Then - Actions
          • Set VariableSet Chim_Poison_Interval[Chim_Id] = 1.00
        • Else - Actions
      • -------- --------
      • -------- Only bother adding it to the Damage Loop if it's not already added (it'll have this ability if it's already in): --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Chimera Poison for Chim_Target) Equal to 0
        • Then - Actions
          • Unit - Add Chimera Poison to Chim_Target
          • Unit Group - Add Chim_Target to Chim_Target_Group
          • Trigger - Turn on Chimera Poison Damage Loop <gen>
        • Else - Actions
  • Chimera Poison Damage Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Chim_Target_Group and do (Actions)
        • Loop - Actions
          • Set VariableSet Chim_Target = (Picked unit)
          • Set VariableSet Chim_Id = (Custom value of Chim_Target)
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Chim_Target is alive) Equal to True
            • Then - Actions
              • -------- Reduce poison timers: --------
              • Set VariableSet Chim_Poison_Interval[Chim_Id] = (Chim_Poison_Interval[Chim_Id] - 0.10)
              • Set VariableSet Chim_Poison_Duration[Chim_Id] = (Chim_Poison_Duration[Chim_Id] - 0.10)
              • -------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Chim_Poison_Interval[Chim_Id] Less than or equal to 0.01
                • Then - Actions
                  • -------- Reset interval for next tick: --------
                  • Set VariableSet Chim_Poison_Interval[Chim_Id] = 1.00
                  • -------- --------
                  • -------- Deal tick damage: --------
                  • Unit - Cause Chim_Caster[Chim_Id] to damage Chim_Target, dealing Chim_Poison_Damage[Chim_Id] damage of attack type Spells and damage type Normal
                • Else - Actions
            • Else - Actions
              • -------- If it died then end the spell early: --------
              • Set VariableSet Chim_Poison_Duration[Chim_Id] = 0.00
          • -------- --------
          • -------- Check if we should end the spell: --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Chim_Poison_Duration[Chim_Id] Less than or equal to 0.01
            • Then - Actions
              • Set VariableSet Chim_Poison_Interval[Chim_Id] = 0.00
              • Unit - Remove Chimera Poison buff from Chim_Target
              • Unit - Remove Chimera Poison from Chim_Target
              • Unit Group - Remove Chim_Target from Chim_Target_Group.
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in Chim_Target_Group) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
Edit: Fixed a very minor error in loop trigger.
 

Attachments

  • Chimera Poison 1.w3m
    22 KB · Views: 2
Last edited:

Luu

Luu

Level 6
Joined
Feb 11, 2021
Messages
45
I’m appreciating your suggestions. I believe this thread will be helpful for other people’s questions in the future. So, whenever you can answer any of these questions, I’d be very grateful.

1 - From your experience, is there any way to use the missile splash attack type, with a chance to activate Fire Breath (based on Flame Strike), so that the Dummy recognizes only the primary target hit by the missile’s splash damage? I was thinking of making Fire Breath a chance-based effect triggered through a trigger.

2 - Another option for Fire Breath is to use Burning Oil, with a chance to activate the effect instead of triggering it on every attack. Burning Oil seems to work well with splash damage.

3 - Regarding Corrosive Breath (based on the Chimaera’s ability), is there any way to make my custom ability target something other than just structures, even when my dragon uses splash damage?

4 - I tested Envenomed Weapons with missile splash, but this ability doesn’t work with that weapon type. Is there a way, through triggers, to make Envenomed Weapons work exclusively on the primary target when the unit uses missile splash?

5 - If I use the normal missile weapon type instead, is there a way to simulate splash damage for the dragon’s basic attacks without it conflicting with Fire Breath or Corrosive Breath?

Feel free to respond at your own pace; these are honest doubts I’d like to clear up.
 
Level 3
Joined
Nov 16, 2024
Messages
7
1 - No. Nichilus answered this above, trigger the splash damage. Just ensure the damage source unit ID isn't the dragon itself for the splash damage. Have the dragon deal Missile damage so that the game only detects the dragon's primary target.

2 - Yes, it works, but you won't be able to set this on a chance basis.

3 - I can't quite remember well enough, but Corrosive Breath is the Upgrade effect to enable ladder Chimaera's Siege attack on structures right? What are you looking to achieve with this ability? I'm going to assume DoT, but I don't think this ability even applies DoT. Could be wrong.

4 - No. Missile (Splash) and Envenomed Weapons are both attack-modifying effects that will attempt to supersede each other. You need a workaround solution since you can't break this rule. You can take Uncle's solution and trigger the DoT after you...

5 - ...trigger the Splash damage. Yes. and it is the answer to all your problems
Something like

Event
Unit Takes Damage

Condition
Damage Target
is an enemy of Damage Source
Damage Source
ID = Dragon

Action

Unit Group - Select all units within X radius of Position of Damage Target matching conditions
(
Create Dummy (or have a universal spell damage dummy in map assign to each player)
Cause Dummy to damage Picked Unit for Damage Taken * (Decimal)
)
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
I don't think you HAVE to trigger the splash damage yourself, a Chimera uses a Lightning attack which is Instant, meaning you should be able to reliably detect the primary target like so:
  • Events
    • Unit - A unit Is Attacked
  • Conditions
    • (Unit-Type of (Attacking unit)) Equal to Chimera
  • Actions
    • Set Variable Chim_Attack_Target[(Custom value of (Attacking unit))] = (Attacked unit)
Now returning to the trigger I posted earlier, you can use this new Unit variable as a Condition:
  • Chimera Poison Damage
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Damage From Normal Attack) Equal to True
      • (Unit-type of (Damage source)) Equal to Chimaera
      • Chim_Attack_Target[(Custom value of (Damage source))] Equal to (Damage Target)
    • Actions
Now your trigger will only run it's Actions against the primary target, which is the unit that the Chimera attacked last.

I don't see why this wouldn't work to filter out non-primary targets. However, for Ranged units that use Missiles which have a flight time and thus an impact delay this would NOT be reliable since Attack targets can change during that time. It should only work for Melee/Instant attacks.

Note that this relies on your map having a Unit Indexer system in it, which my demo map already has. It's worth having and taking advantage of, it's probably the most useful tool you have available as a GUI'er. It's also braindead easy to use compared to something like a Hashtable.
 
Last edited:
Top