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

Line Damage Debuff Ability

Status
Not open for further replies.
Level 8
Joined
Jul 8, 2013
Messages
249
So I've been trying to make a cone or line damage ability (like shockwave or carrion swarm) apply an armor debuff.

I based it on Breath of Frost since that applies a buff (Breath of Ruin Dummy) I could check for to apply the real debuff (Anathema).

My triggers currently are as follows:

  • Breath of Ruin Turn On
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Breath of Ruin (Q)
          • (Ability being cast) Equal to Breath of Ruin (E)
          • (Ability being cast) Equal to Breath of Ruin (W)
    • Actions
      • Trigger - Turn on Anathemizer <gen>
      • Wait (3.00 + (3.00 x (Real((Level of (Ability being cast) for (Triggering unit)))))) game-time seconds
      • Trigger - Run De Anathemizer <gen> (ignoring conditions)
  • Anathemizer
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set TempUnitGroup = (Units in (Playable map area) matching ((((Matching unit) has buff Breath of Ruin (Dummy)) Equal to True) and (((Matching unit) has buff Anathema ) Equal to False)))
      • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
        • Loop - Actions
          • Set TempPoint = (Position of (Picked unit))
          • Unit - Create 1 Dummy Caster (Main) for Neutral Hostile at TempPoint facing Default building facing degrees
          • Unit - Add Breath of Ruin (Debuffer) to (Last created unit)
          • Unit - Set level of Breath of Ruin (Debuffer) for (Last created unit) to (Intelligence of Reinherarch (Include bonuses))
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Order (Last created unit) to Human Priest - Inner Fire (Picked unit)
          • Custom script: call RemoveLocation (udg_TempPoint)
      • Custom script: call DestroyGroup (udg_TempUnitGroup)
      • Set TempUnitGroup = (Units in (Playable map area) matching ((((Matching unit) has buff Breath of Ruin (Dummy)) Equal to False) and (((Matching unit) has buff Anathema ) Equal to True)))
      • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
        • Loop - Actions
          • Unit - Remove Anathema buff from (Picked unit)
      • Custom script: call DestroyGroup (udg_TempUnitGroup)
  • De Anathemizer
    • Events
    • Conditions
    • Actions
      • Set TempUnitGroup = (Units in (Playable map area) matching ((((Matching unit) has buff Breath of Ruin (Dummy)) Equal to True) or (((Matching unit) has buff Anathema ) Equal to True)))
      • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
        • Loop - Actions
          • Unit - Remove Anathema buff from (Picked unit)
          • Unit - Remove Breath of Ruin (Dummy) buff from (Picked unit)
      • Custom script: call DestroyGroup (udg_TempUnitGroup)
      • Trigger - Turn off Anathemizer <gen>
So basically Breath of Ruin turn on just activates Anathemizer, which will actually apply the real debuff, and then in a number of seconds equal to the duration will turn De Anathemizer which will remove the debuffs

Anathemizer is initially off. When activated it periodically checks for units that were hit by the spell (and thus have the dummy buff Breath of Ruin) but weren't yet hit by the real debuff (Anathema) and then hits them with that debuff.
Anathemizer also removes the real debuff (Anathema) from anyone who somehow has it but does not have the dummy buff (Breath of Ruin).

De Anathemizer is mostly there just in case of a mess up somehow and to turn Anathemizer back off, it just purges both of those debuffs.


The reason for the complexity of this trigger is really just that not every unit gets hit by the breath at once and I want them to be debuffed as they're hit (or close to it) rather than all at once. That's the reason for Anathemizer being a periodic event rather than something run once.

However, this version is inelegant and also not quite going to work as intended because units hit later will have the debuff purged from them 12 seconds after the cast which might be, say, only 11 seconds after they were hit. In that case they wouldn't have been debuffed for the full time.

Can anyone think of a better way to do this?
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
I would suggest a complete damage detection system :D
It is not that hard and it is smooth precise and so far I use it not much cpu consuming

You need a trigger that is called whenever a unit takes damage.
That trigger creates a dummy unit and tells it to cast ability Stun to the target.
Also remove the temporary buff from Breath of Frost.
You can add your own stuff in this to fit for your abilities.
  • Damage System
    • Events
    • Conditions
    • Actions
      • -------- AttackedUnit is the unit that takes damage --------
      • -------- DamageSource is the unit that dealt the damage --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Attacked unit) has buff Breath of Frost (Tempbuff) ) Equal to True
        • Then - Actions
          • Unit - Remove Breath of Frost (Tempbuff) buff from (Attacked unit)
          • Unit - Create 1 Dummy Caster for (Owner of (Damage source)) at (Position of (Attacked unit)) facing Default building facing degrees
          • Unit - Order (Last created unit) to Neutral - Firebolt (Attacked unit)
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
        • Else - Actions
          • Do nothing
That trigger is not called automatically and you need 2 lines of code to complete it.

In any Map Initialization trigger, add all units to the first trigger.
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Trigger - Add to Damage System <gen> the event (Unit - (Picked unit) Takes damage)
And make a trigger that does the same for every unit that enters the playable map area:
  • New Units
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Trigger - Add to Damage System <gen> the event (Unit - (Entering unit) Takes damage)
Now you are done.



One thing to make it look even better:
In the Object Editor
At the Dummy Caster, set the Art - Animation - Cast Point to 0.000 or 0.001
That value is a second casting time added to every ability cast by that unit.
You dont want that so set it to 0.000 or 0.001

In the Damage System Trigger
I would suggest making a wait and then Remove the dummy instead of adding expiration timer because that would kill the unit instead of removing it.
If you want to keep it MUI, you will have to convert it into jass.
 
Level 8
Joined
Jul 8, 2013
Messages
249
Wait, is THAT all people mean by a damage detection system? I figured it was something much more complicated all these years, but I've been using one all along.

Your suggestion is a pretty good one and I'll consider it alongside an idea I had an hour or two ago, though it doesn't solve the problem of getting duration right- the main problem I had- without some modification. (Just to clarify, the reason I don't just level the buff to determine the duration is that I'm currently leveling the buff to modify the damage over time).

My dummy casters do, of course, have 0 cast point already. And they're flying units so killing them doesn't leave a corpse or cause any problems like that. Is there actually a reason to remove them instead of give them an expiration timer given that? I used to remove dummy casters, but then I noticed that quite a few expert map makers use expiration timers instead so I figured that was better.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
1. No THAT is not what all people are talking about.
This is just one of many ways of a damage detection system.
This one is just easy to use.

2. I dont know what kind of buff you want and I added a stun cause I use Breath of Frost and a freezing effect would be nice.
Poison Debuff is easy to make and doesnt even require a dummy unit or ability.
All you have to do is make a debuff for the UI (Icons and tooltips)

You just replace the stun ability by a Human - Units - Slow ability and set the effects to 0. Just make the duration and set the right level.
Then you add this instead:
  • Damage System
    • Events
    • Conditions
    • Actions
      • -------- AttackedUnit is the unit that takes damage --------
      • -------- DamageSource is the unit that dealt the damage --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Attacked unit) has buff Breath of Frost (Tempbuff) ) Equal to True
        • Then - Actions
          • Unit - Remove Breath of Frost (Tempbuff) buff from (Attacked unit)
          • Unit - Create 1 Dummy Caster for (Owner of (Damage source)) at (Position of (Attacked unit)) facing Default building facing degrees
          • Unit - Order (Last created unit) to Human Sorceress - Slow (Attacked unit)
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • -------- From 1 to "Duration in seconds" --------
          • For each (Integer A) from 1 to 10, do (Actions)
            • Loop - Actions
              • -------- Wait is the interval and the damage is the damage per interval --------
              • Unit - Cause (Damage source) to damage (Attacked unit), dealing 10.00 damage of attack type Spells and damage type Normal
              • Wait 1.00 game-time seconds
        • Else - Actions
          • Do nothing
3. With the timer, you kill the unit. Ofc there is no killer so exp etc is not given but I for example run very much triggers that run on unit death. So I would kinda have a lot of work in handling with that.
 
Status
Not open for further replies.
Top