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

Need a system to determine if a unit takes damage from a spell

Status
Not open for further replies.
Level 12
Joined
May 20, 2009
Messages
822
Basically, I'll write a fake trigger to show you what I mean.

  • Stormbolt
    • Events
      • Game - AbilityDamageEvent becomes Equal to 0.00
    • Conditions
      • (Ability Comparison)
      • AbilityDamageEvent_AbilityType Equal to MY_ABILITY
    • Actions
      • Stuff here...
This way, I can set ability damage to 0 for all abilities, and then trigger the damage. So that way, spells don't do spell damage only but can do like, 50 normal damage and 50 magic damage, or 50 siege damage and 50 piercing damage, or just a full 100 hero or chaos damage.

What it needs to do is, when a spell causes damage, the system needs to determine what spell it was and return that to the AbilityType variable. So that way I can filter out all other sources of damage (Other spells, normal attacks) and when a spell has a projectile it'll only get damaged when the projectile hits the target.

Does something like this already exist? How many? Which ones best for what I need?

If not, would someone please kindly move this to the Requests section? =)

Would something like this even be possible?
 
It is possible to detect spell damage with a system like lookingforhelp's dds, but it is not possible to detect the source ability (that is only possible in really specific cases, which require map-specific implementations).

But if you elaborate on what it is for, then we may be able to offer a better solution. In the end, it is best to leave all your damage to triggers. That way, you have absolute control. DDS systems like lfh's or Bribe's are really powerful in that they allow you to modify the damage output. Use that to your advantage. :)
 
Level 12
Joined
May 20, 2009
Messages
822
Basically, I want to make the damage in all normal spells to be triggered, so that way they can do different types of damage.

Like, Stormbolt doing Normal Damage and then doing Magic Damage.

Or maybe...Liquid Fire doing Siege or Piercing damage, or both.

But the damage needs to be different for each spell.

I would just use buffs to do the damage, but not all spells have buffs and some buffs are important to stay on units because they do other stuff like slow or stun units...

See, what I was gonna do was set the damage of all spells to 0, so they don't actually do damage. But they do still trigger a damage event. (I tested this using Weep's system, set Storm Bolt to 0 damage but it still fires the damage event.) Then use the event to figure out what spell was cast and then do my custom damage.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Also spells that apply buff to target unit deals 0 damage.For example when a storm bolt hits target unit it deals 0 damage for buff + stormbolt's damage.
 
Level 12
Joined
May 20, 2009
Messages
822
Ah, that must be why the event fires twice then...

Anyway, anyone got any ideas? I need to do this because I want to completely remove Spell Damage and use it as a new damage type.

EDIT: I think I had an idea. If it works, I'll show my triggers. I feel confident it will.

IT WORKS!

  • Spell Detection System
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set SpellMaxIndex = (SpellMaxIndex + 1)
      • Set IndexedSpell[SpellMaxIndex] = (Ability being cast)
      • Set IndexedCaster[SpellMaxIndex] = (Triggering unit)
  • Stormbolt
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
    • Actions
      • For each (Integer StormBoltInit) from 1 to SpellMaxIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IndexedSpell[StormbBoltInit] Equal to Storm Bolt
              • GDD_DamageSource Equal to IndexedCaster[StormBoltInit]
            • Then - Actions
              • Trigger - Turn off (This trigger)
              • Unit - Cause GDD_DamageSource to damage GDD_DamagedUnit, dealing 50.00 damage of attack type Normal and damage type Normal
              • Unit - Cause GDD_DamageSource to damage GDD_DamagedUnit, dealing 50.00 damage of attack type Magic and damage type Normal
              • Trigger - Turn on (This trigger)
              • Set IndexedSpell[StormBoltInit] = IndexedSpell[SpellMaxIndex]
              • Set IndexedSpell[SpellMaxIndex] = NullAbility
              • Set IndexedCaster[StormBoltInit] = IndexedCaster[SpellMaxIndex]
              • Set IndexedCaster[SpellMaxIndex] = No unit
            • Else - Actions
This WILL work IF you have a system to tell the difference between Physical, Spell, and Trigger damage, that way you can tell the difference between if a spell is doing damage and a normal attack is doing damage. THEN this system takes place to do damage based on the spell. This should NOT interfere with different abilities. I'll do a test real quick just to be sure, though.

To do something like that, use this system. http://www.hiveworkshop.com/forums/spells-569/physical-damage-detection-gui-v1-1-0-0-a-231846/

EDIT2: Other spells do NOT trigger the Stormbolt trigger.
 
Last edited:
Level 12
Joined
May 20, 2009
Messages
822
Oops. Forgot about those. Fix'd.

  • Stormbolt
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
    • Actions
      • For each (Integer StormBoltInit) from 1 to SpellMaxIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IndexedSpell[StormBoltInit] Equal to Storm Bolt
              • GDD_DamageSource Equal to IndexedCaster[StormBoltInit]
            • Then - Actions
              • Trigger - Turn off (This trigger)
              • Unit - Cause GDD_DamageSource to damage GDD_DamagedUnit, dealing 50.00 damage of attack type Normal and damage type Normal
              • Unit - Cause GDD_DamageSource to damage GDD_DamagedUnit, dealing 50.00 damage of attack type Magic and damage type Normal
              • Trigger - Turn on (This trigger)
              • Set IndexedSpell[StormBoltInit] = IndexedSpell[SpellMaxIndex]
              • Set IndexedSpell[SpellMaxIndex] = NullAbility
              • Set IndexedCaster[StormBoltInit] = IndexedCaster[SpellMaxIndex]
              • Set IndexedCaster[SpellMaxIndex] = No unit
              • Set SpellMaxIndex = (SpellMaxIndex - 1)
              • Set StormBoltInit = SpellMaxIndex
            • Else - Actions
But I mean, if I use that other system this should do exactly what I want it to do right?
 
I don't understand your question; kindly repeat. Also I forgot to note, replace CurrentIndex vars with MaxIndex, not the other way around. That should work. And you could also add damage types in the indexing, make it so the trigger does not run when you damage manually.

Add a condition checking for stormbolt buff. Remove it immediately, then have a dummy cast a stun with relative duration.
 
Level 12
Joined
May 20, 2009
Messages
822
What are you talking about? I'm doing that. And it already works pretty well.

Also, that won't work with EVERY SINGLE spell (That does damage) in the game. Not every single spell has a buff, that's why I need this system. Because it WILL work for every single spell.

What I meant is,

The only situation I can think of that this does not work is if you don't use THIS system to determine the difference between Auto-Attack damage and Spell damage, then Auto-Attacks will ALSO do the damage in this trigger. Also, to use that system properly you have to do some adjustments to it. (I will show that at the bottom)

Is there anything else that would possibly cause a problem?



This is the changes you need to make to the system in order for this to function properly.

JASS:
    // Determine the damage type
    if udg_damageType == udg_CODE and rawAmount != 0.0 then
        set udg_damageType = udg_CODE
    elseif rawAmount > 0.0 then
        set udg_damageType = udg_PHYSICAL
    elseif rawAmount < 0.0 then
        set udg_damageType = udg_SPELL
    else
        return
    endif

You need to add

JASS:
    elseif rawAmount == 0 then
        set udg_damageType = udg_ZERODAMAGE

before the "else" in the list there.

This is in the DamageEvent trigger, in the section labeled:

////////////////////////////////////////////////////////////////////////////////////
// Damage Engine
////////////////////////////////////////////////////////////////////////////////////

You also need to go into the section labeled

////////////////////////////////////////////////////////////////////////////////////
// Initialization
////////////////////////////////////////////////////////////////////////////////////

And add " set udg_ZERODAMAGE = 3" to

JASS:
    // Initialize global fixed constants
    set udg_PHYSICAL = 0
    set udg_SPELL = 1
    set udg_CODE = 2
    set udg_UNIT_MIN_LIFE = 0.406
    set udg_ATTACK_TYPE_UNIVERSAL = ConvertAttackType(7)
    set udg_totalAllocs = 0
    set udg_allocCounter = -1
    set udg_damageEventTrigger = 0.0
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
What are you talking about? I'm doing that. And it already works pretty well.

Also, that won't work with EVERY SINGLE spell (That does damage) in the game. Not every single spell has a buff, that's why I need this system. Because it WILL work for every single spell.

What I meant is,

The only situation I can think of that this does not work is if you don't use THIS system to determine the difference between Auto-Attack damage and Spell damage, then Auto-Attacks will ALSO do the damage in this trigger. Also, to use that system properly you have to do some adjustments to it. (I will show that at the bottom)

Is there anything else that would possibly cause a problem?



This is the changes you need to make to the system in order for this to function properly.

JASS:
    // Determine the damage type
    if udg_damageType == udg_CODE and rawAmount != 0.0 then
        set udg_damageType = udg_CODE
    elseif rawAmount > 0.0 then
        set udg_damageType = udg_PHYSICAL
    elseif rawAmount < 0.0 then
        set udg_damageType = udg_SPELL
    else
        return
    endif

You need to add

JASS:
    elseif rawAmount == 0 then
        set udg_damageType = udg_ZERODAMAGE

before the "else" in the list there.

This is in the DamageEvent trigger, in the section labeled:

////////////////////////////////////////////////////////////////////////////////////
// Damage Engine
////////////////////////////////////////////////////////////////////////////////////

You also need to go into the section labeled

////////////////////////////////////////////////////////////////////////////////////
// Initialization
////////////////////////////////////////////////////////////////////////////////////

And add " set udg_ZERODAMAGE = 3" to

JASS:
    // Initialize global fixed constants
    set udg_PHYSICAL = 0
    set udg_SPELL = 1
    set udg_CODE = 2
    set udg_UNIT_MIN_LIFE = 0.406
    set udg_ATTACK_TYPE_UNIVERSAL = ConvertAttackType(7)
    set udg_totalAllocs = 0
    set udg_allocCounter = -1
    set udg_damageEventTrigger = 0.0

Uhh, bad idea.

Zero damage events are filtered out for a reason by this system. First they don't cause damage and therefore shouldn't be detected, second because they are used by many things that actually don't cause damage at all. Casting "slow" on a unit will cause a zero damage event. Getting in the range of an aura can cause a zero damage event. Even getting in the accquisition range of a building sometimes causes a zero damage event. The system is only guaranteed to work in the state as it is uploaded, if you make such modifications it might break under various situations.

Also your technique is not reliable: What if your hero poisons an enemy unit and then casts stormbolt on him. Now lets say, while the storm bolt is flying, the poison damages the enemy. All your conditions will be fullfilled, therefore the poison will cause the strom bold trigger! Even buff checking won't help, because what if the unit already had the storm bolt buff before (from another hero for example)?

I know it is bad news, but in general you can't detect which native spell did the damage. The system only tells you if it was spell damage or not, nothing more. The best would be to completly trigger this single spell. Then you have total control.

However, if you can guarantee that your hero will never deal spell damage in the range of this spell, you can use a workaround. Check if the spell damage is in the range of your spell. However, it is very difficult to guarantee this, because of different armor/item reductions and so on. So best would be to trigger the spell.

Btw: you always say that you use PDDS to determine the damagetype of an attack, but all trigger examples you posted so far use another DDS (Bribes one), because in PDDS there is no "Game - GDD_Event becomes Equal to 0.00" and you also shouldn't turn on/off the damage trigger like you do in this system. So if you want us to analyse your code you should really upload the code you are actually using (which would be PDDS in this case) and not some other code that uses a completly different DDS.
 

EdgeOfChaos

E

EdgeOfChaos

In my opinion:

Replace all your abilities with dummy abilities. Storm bolt, firebolt, hurl boulder for projectile etc.
Remove the stats on all of these abilities
Give them custom buffs
Check for these buffs and use an indexer to determine who cast (if its a stat-based damage type thing. If not, use different buffs for different levels)
Cause damage
Remove buffs.

You don't even need damage detection, just a 0.01 timer. or something
 

EdgeOfChaos

E

EdgeOfChaos

Using a unit indexer isn't hard. It is literally just copy-paste and use custom value as index, whereas DDS requires you to set events and know what each variable does, how to filter, etc..

Timer is to check for and remove buffs. I'm not sure if buff removal would work with DDS, as the Takes Damage event actually fires an instant before the user is dealt the damage, and maybe he wouldn't have the buff. But if I'm wrong, it would be even easier.
 
Level 12
Joined
May 20, 2009
Messages
822
In my opinion:

Replace all your abilities with dummy abilities. Storm bolt, firebolt, hurl boulder for projectile etc.
Remove the stats on all of these abilities
Give them custom buffs
Check for these buffs and use an indexer to determine who cast (if its a stat-based damage type thing. If not, use different buffs for different levels)
Cause damage
Remove buffs.

You don't even need damage detection, just a 0.01 timer. or something

Sorry to bump this thread but:

I have said this MANY, MANY times in this thread.

THIS WILL NOT WORK IF THE SPELL THAT DOES DAMAGE DOES NOT HAVE A BUFF!

Such as Shockwave, Carrion Swarm, Chain Lightning, Critical Strike, Holy Light (Against Undead), and Death Coil (Against Alive).

And this can GREATLY break some spells, such as Earthquake, Warstomp, Stasis Traps, Unholy Frenzy, Breath of Fire, and Immolation.

The way I have it set up causes NONE of these problems.

I don't know if it has the problems looking_for_help said, though. I will look into that.

My goal with this was to keep the Standard Abilities as unchanged as possible, using as little triggers as possible, but make them do multiple types of damage instead of just Spell Damage. What I have set up allows you to make a spell do say, Normal and Magic damage in one spell. Although it technically counts as two attacks so armor reductions are calculated twice. That's the only backdraw I know of.

I'm not actually going to release this until I ask for permission. (You can't freakin' stop me from doing it personally, without releasing anything, unless you wanna hack my freakin' Computer.)

EDIT:

@looking_for_help

I dunno why the Event Variables say that, I'm pretty sure I was using the ones from your system. xD

EDIT2: Oh wait, I remember now. I wasn't actually using your system for that trigger. That Trigger was using Bribe's system, I think. The reason why it wasn't using yours but I said to use yours was because I was GOING to use your for that spell later.

Basically, that spell on Weep's or Bribe's still works, BUT their systems only detect damage and not SPELL damage. That is needed because if you use what I made, casting Storm Bolt, the casting unit's auto attacks will run the trigger too. Your system DOES NOT cause that to happen.

So I was saying that, if you use YOUR system with the modifications I specified, you can detect if a dummy, 0-Damage Storm Bolt hits it's target and then do damage, but if the unit happens to do an Auto Attack in that time it won't cause the damage in the trigger to run unlike in Bribe's or Weep's system.

However, you said that there might be some problems with things such as poison damage. So I'll do a test to see if an Auto-Attack with an Orb of Venom will cause the trigger to do the damage and if it does I'll once again have to find another way or make more modifications because I THINK I can still work around that.

In the mean time until I do these tests, I'll migrate all my triggers back to Weep's system and not use these custom-damage triggers until I figure out something.

And also: "First they don't cause damage and therefore shouldn't be detected"
That is an extremely bad excuse. Zero-Damage events are EXTREMELY useful, especially for situations like this.
 
Last edited:
Status
Not open for further replies.
Top