Damage reduction issue

Ashcat

Hellooo
Reaction score
68
Hi everyone, I'm creating a spell that absorbs all the damage you take for a short duration, then unleashes it all on your next attack. I have everything down, except one small issue I've noticed.

What I'm doing, is I am detecting when a unit with the spell activated is damaged, then increasing the life of the damaged unit by the amount of damage taken.

The problem is that if the damage taken is greater than the amount of health that the damaged unit has at the moment, then it will die before the triggers can increase its health.

And I can't use item spells or anything like Hardened Skin, or Spiked Carpace, because I need to be able to store the amount of damage taken in a variable.
 

Slapshot136

Divide et impera
Reaction score
471
w8, are you using "unit takes damage" and then setting the life to the life + the damage taken? im pretty sure that the triggers for "unit takes damage" work before the damage is actually dealt, post the triggers plz, and what about a spell like elune's grace that reduces the damage taken by lets say 99%, and then with your triggers you just do the damage taken x 100 to get the actual damage that the unit would of taken
 

Ashcat

Hellooo
Reaction score
68
I havn't actually made the trigger itself yet, but I've played around with a few triggers like this to experiement.

Basically this is what I'm doing

Code:
Shield of Blood
    Events
        Unit - A unit Takes damage
    Conditions
        ((Triggering unit) has buff Shield of Blood) Equal to True
    Actions
        Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (Damage taken))
 

Ashcat

Hellooo
Reaction score
68
No, its not : (

I place two footmen in a test map to fight each other, give one the shield of blood ability, and set its health to 1, with no regeneration.

On the first attack it dies, but when I have the footman start with full health instead of 1, the ability works as intended.
 

Sooda

Diversity enchants
Reaction score
318
Unbelievable, all other methods fail to correctly prevent damage except one-shot timer with 0.00 duration.
Code:
Deny Damage
    Events
    Conditions
    Actions
        Set doneDmg = (Damage taken)
        Set curHp = (Life of (Triggering unit))
        Set newLife = (curHp + doneDmg)
        Set victim = (Triggering unit)
        Countdown Timer - Start timer as a One-shot timer that will expire in 0.00 seconds
Code:
Add life
    Events
        Time - timer expires
    Conditions
    Actions
        Unit - Set life of victim to newLife
 

Ashcat

Hellooo
Reaction score
68
Well that continues to reduce damage to 0 like it did before, but still doesn't solve my problem of reducing the damage for a unit with 1 health left.

I guess I could use Slapshots idea of creating an Elune's Grace with 99% damage reduction. That way only a unit with 100 or more damage could break through the shield at 1 health.
 

Sooda

Diversity enchants
Reaction score
318
Didn' t knew 'Takes Damage' event damage is so hard to prevent. If timer with 0.00 duration dosn' t do, nothing does it. Your only option would be to use damage reduction ability like Night elf unit Hardened Skin (Allies checked additionally) or similar.
 
Reaction score
107
Cohadar was talking about this in another thread, but I forget which one...
But basically what he was saying, was to add 10000 hp to the unit (or something huge number) so that the unit wouldn't die, take the damage, calculate or whatever, and afterwards just remove the 10000hp buff.

Apparently thats what he does with one of the spells in his map "pyramidal defense" or "naga team survival" whether he changed the name or not :p
 

The Undaddy

Creating with the power of rage
Reaction score
55
Correct me if I'm wrong but I think when damage is dealt to a unit,as low as it may be,the target unit takes at least 1 damage.So even with the 99% damage reduction,the unit will take 1 damage no matter what unit attacks him.
 

Ashcat

Hellooo
Reaction score
68
I'm pretty sure you're right about that, but isnt health a real value? meaning a unit could have, say, 0.50 health, even though it would display as 1?

And even if I'm wrong, the a unit won't usually have 1 health remaining as often as 20 or some other low amount. I don't know, I'd love to find a fix, but if I can't I will just try to cover it up as best as I can.
 

Slapshot136

Divide et impera
Reaction score
471
how about using mana shield, and then healing the mana? and can i ask for a map with this, since im still having a hard time believeing it lol

p.s. it's possible to deal damage that does less then 1 damage
 

Ashcat

Hellooo
Reaction score
68
Mana Shield wouldn't work, but I think what I have now is okay.

And as for what kind of map... I'm still debating between a Hero Arena and an AoS, though they are almost the same thing. lol
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top