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

Nullify special attack (reforged)

Level 29
Joined
Sep 26, 2009
Messages
2,596
Do I understand it correctly that you want a custom evasion system where you null damage from for example Envenomed spears (the poison debuff) if the targeted unit evaded the attack via triggers?

As for the events:
  • Attacked = unit is initiating an attack (that is, a melee unit begins swinging its sword; an archer begins drawing its arrow from quiver). No attack happened at this point.
  • Damaging = damage will be applied to a unit. At this point this is the pure damage taken, before armor and other reductions are taken into account
  • Damaged = same as Damaging, but after reductions have been applied to the damage.
 
Level 29
Joined
Sep 26, 2009
Messages
2,596
I think you will have a very hard time achieving that.
When using envenomed spears (and my guess is that this behaviour applies to all orb effects) the targeted unit takes damage twice from the normal attack in the following order:
  • first, it takes 0.00 damage. This relates to poison debuff being applied to the unit.
  • second, it takes damage from the actual ranged attack.

The issues are:
  • when unit takes the first damage (0.00) you don't know from what it is. You know the unit, but you don't know if it is from normal attack or something else. For example, your unit throws the envenomed spear on an enemy (normal attack), but before the spear lands, you make your unit cast Cripple on that target as well (this again deals 0.00 damage). Cripple is instant, so its 0.00 damage would be dealt first. There could potentially be different attack/damage type for envenomed spears and other debuff spells, but that could still clash in some situations.
  • the landing spear would overwrite existing poison debuff on the unit. This is an issue if the envenomed spears ability has levels where each level deals different damage. Or two different spells apply same debuff (i.e. Envenomed Spears and Poison Sting spells apply same Poison debuff).
  • you don't know remaining time of the debuff. So an attack that misses (has nulled damage via triggers) would still refresh the duration of the debuff on the unit. You would need to have an entire system over buff managed that would track their duration separately so that you can prematurely remove the debuff.

I don't know a good solution to this. Perhaps someone else will.
 

Remixer

Map Reviewer
Level 33
Joined
Feb 19, 2011
Messages
2,112
In order to handle such behavior is indeed quite difficult as Nichilus pointed out.

If you do not want to use the actual Evasion ability, but instead nullify damage, then you need to mimic the behavior of all other on-hit abilities artificially. All on-hit effects still apply, even if the damage dealt is 0, which means you need to essentially make them do nothing, unless the attack was not evaded.

Perhaps it's necessary to point out that mimicking all behaviors of all on-hit effects is more complicated than simply mimicking the effects of evasion alone.

Can I ask why you wish to nullify damage on attacks instead of using evasion by default?
 
Evasion is based on defender only. My evasion can take into account who is the attacker.
Ie what is you chance vs what attacker. May be distance may be weapon. May be how strong is it.

I thought may be i could set evasion to 100% when attacking event is firing. but i'm certain it will not work
 
Last edited:
Level 24
Joined
Feb 27, 2019
Messages
833
Heres a concept

A unit is attacked
if miss = true then
For Attacking unit
Set Combat - Attack 1 - Area of Effect (Full damage) = -1
Set Combat Attack 1 - Weapon Type = Artillery
elseif
For Attacking unit
Set Combat - Attack 1 - Area of Effect (Full damage) = Default
Set Combat Attack 1 - Weapon Type = Default
endif


Didnt work as intended
 
Last edited:
Heres a concept

A unit is attacked
if miss = true then
For Attacking unit
Set Combat - Attack 1 - Area of Effect (Full damage) = -1
Set Combat Attack 1 - Weapon Type = Artillery
elseif
For Attacking unit
Set Combat - Attack 1 - Area of Effect (Full damage) = Default
Set Combat Attack 1 - Weapon Type = Default
endif
which event is it?

Damaging or?...
looks interresting

Can you explain idea a little more?
 

Remixer

Map Reviewer
Level 33
Joined
Feb 19, 2011
Messages
2,112
which event is it?

Damaging or?...
looks interresting

Can you explain idea a little more?
The logic would work intercepting the attack before it actually lands, which would require the About to Take Damage event. The game however seems to crash if you change the damage area range upon that event.

The follow-up question would anyway be, how would you change the Damage Area Range back to the original value, since the unit could no longer deal any damage, so it would never trigger the same event again - which means you would have to run background timers to reset any changes you've made once the attack has actually landed.

The easiest way to implement what you want is probably to use a premade system, like Bribe's damage engine.
 

Remixer

Map Reviewer
Level 33
Joined
Feb 19, 2011
Messages
2,112
Do you think i can achieve that with this library?
I think that will largely depend on how complex the interactions are on your map. It's very hard to tell how much workarounds you'll need without knowing the exacts of the project you are working on.

Of course, even with Bribe's engine the solution is not simply importing it and things work. No. You'll need to iterate over every single case where a unit might apply a debuff/buff on-hit and nullify the effects before the attack ever even takes place, and then return those on-hit ability functions the instant later when the attack is complete. Creating a map-wide system with GUI that would function in this logic for each unit is very heavy to run.

If your map is relatively simple and we are talking about a couple dozen of units at maximum, it is probably easier to just make it unit-specific and apply debuffs instead on the attacking unit (for example casting curse with the appropriate miss chance on any attack) depending on the circumstances.

It really is impossible to tell without you opening more on what you are working on.
 
Level 24
Joined
Feb 27, 2019
Messages
833
which event is it?

Damaging or?...
looks interresting

Can you explain idea a little more?
Didnt work I thought I saw change Weapon Type but it was Attack Type and changing the Area of Effect (Full damage) didnt seem to work well with 0.00 or -1 either, even crashing if the Weapon Type wasnt Artillery or similar.

Edit: Changing Area of Effect (Full damage) with the native also changes Base attack speed for no reason, lul. So any value under 0.00 results in the unit being unable to attack. Changing Base attack speed after this fact seemed to have no effect.
 
Last edited:
Level 24
Joined
Feb 27, 2019
Messages
833
There are different ways to tackle this problem. You could switch it up. Instead of nullifying the poison, dont apply the poison.

How to know when to apply poison?
When a poison attack lands and the target takes damage a Fake buff is instantly applied to the target. Detect that the target has the Fake buff on the damage event, remove the Fake buff and apply a new Real buff.

How to apply a new Real buff?
The Real Poison can be applied with a dummy unit attacking the target or by casting an ability that appears as poison on the target. (F.e. Acid Bomb)

In essence: Use a Fake poison buff to detect that poison should be applied. Remove the Fake poison buff and apply a Real poison buff.

Pseudocode
JASS:
if DamageTarget has buff Fake poision
then -    Remove Fake poison
    if Attack = Missed
         then -
        else - Apply Real poison
    endif
else -
endif
 
Top