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

[Spell] Avoiding a killing blow.

Status
Not open for further replies.
Level 12
Joined
Nov 5, 2007
Messages
730
Hi. I'm an old Hive member, but have been inactive for quite a while. Anyways, I've decided to work on my old map again, and try to actually finish it this time, but I've forgotten a lot of stuff in the past two years or so.

Basically, I need a way for a unit to avoid/block only the spells and attacks that would otherwise kill it.

I need a system that will detect which attack would kill it, so that it can cast a spell when the attack/spell is blocked.

Any ideas? Help would be much appreciated. Hell, I'll +rep you weekly for six months if you help me figure this out.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
well if the spell is triggered you can simply check hp is greater than damage done by the spell

example
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to X
      • damage_done_by_Spell Greater than (Integer((Life of (Target unit of ability being cast))))
    • Actions
      • -------- actions --------
 
Level 12
Joined
Nov 5, 2007
Messages
730
well if the spell is triggered you can simply check hp is greater than damage done by the spell

example
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to X
      • damage_done_by_Spell Greater than (Integer((Life of (Target unit of ability being cast))))
    • Actions
      • -------- actions --------

That's very impractical for me, as I'd have to make a custom trigger for every different spell in my map... And there's hundreds of them...
 
Level 11
Joined
Nov 15, 2007
Messages
800
Note that this will run *before* damage is dealt, thats why spells like Backtrack (dota) work

This is actually false. DotA uses a suboptimal damage engine that heals the unit rather than Bribe's engine that adds 50,000 max health to the unit. Thus if an attack does more than the unit's max health in DotA it will be killed regardless of backtrack, shallow grave, borrowed time, etc., because you cannot detect damage before damage is dealt.
 

sentrywiz

S

sentrywiz

Few solutions:

1) Database of variables with abilities that you consider "deadly" dealing damage or doing some method of damage. And one global trigger to check Health of that unit and if the caster uses any of the variable spells.

2) A dumb check if the unit's health is lower than X%, add evasion/spell immunity. Then another dumb trigger to check if the unit's health has been increased, to remove both those abilities.

3) A trigger that would check the unit's health each second and store it in a player variable. The same trigger would check if the health is lower than X, add evasion/spell immunity. If the health isn't lower than X, remove both abilities.



I'd say that #3 is a good choice for you, but you'd have an infinite check loop that could make your map lag if you use many of them constantly.

You need to clear up with yourself, do you want a lag-less map or a good map that can lag sometimes or lag heavily. Then you can decide if you have the time and the energy to make a database of triggers and do everything with ease later on or use loops and lot of checks for instant solution.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Download the damage detection system and you can run a simple thing like this every time a unit is damaged

if damageAmount greater than or equal to targetHP
then:

Note that this will run *before* damage is dealt, thats why spells like Backtrack (dota) work

This is the best possible solution for your problem.
I recommend that you use a damage detection engine.
http://www.hiveworkshop.com/forums/spells-569/gui-damage-engine-201016/

Bribe said:
To change damage before it's dealt: use the event "DamageModifierEvent Equal to 1.00"
Simply check if the damage kills the unit. If it does, lower the damage to an amount that doesn't kill it.
You can set up conditions to check which damage source should be extinct.
 
Level 4
Joined
Feb 22, 2012
Messages
74
This is actually false. DotA uses a suboptimal damage engine that heals the unit rather than Bribe's engine that adds 50,000 max health to the unit. Thus if an attack does more than the unit's max health in DotA it will be killed regardless of backtrack, shallow grave, borrowed time, etc., because you cannot detect damage before damage is dealt.

oh yeah thats true if you can ever deal damage greater than the max HP, it will not be blocked. In dota, this usually only ever happens with Axe's ultimate which does 1 million damage and is intended to instantly kill.

However, to block damage that is dealt when the unit has full hp, you increase the units max HP briefly and heal it for the damage dealt before removing the max hp. This will appear as if the unit was not damaged.
 
Level 8
Joined
Dec 9, 2005
Messages
523
Thus if an attack does more than the unit's max health in DotA it will be killed regardless of backtrack, shallow grave, borrowed time, etc., because you cannot detect damage before damage is dealt.

If this is true, Shallow Grave won't work but it does work... also, your because line is WRONG, the event "Unit - Unit gets Damaged" fires before the damage is actually dealt... DDSs utilizes that event you know, but adds optimization and such...

but yeah, get Bribe's DDS...
 
Level 6
Joined
Oct 4, 2011
Messages
226
This is why when I come to this topic I will still be lost. There is no way to detect damage globally and prevent it before it happens then? Only methods of replacing the harm done? Also Shallowgrave doesn't bug out in how you said according to my DotA experience.
 
You can prevent damage from happening since the Unit Gets Damaged event runs before the damage is dealt so you can actually make him invulnerable (via item ability with a .01 duration) at that moment to prevent damage but even a split-second invulnerability can cause units getting damaged by that unit to flee or prevent not just one damage... You can just use Bribe's method...

The best way to control damage? Get Bribe's DDS + make your own damaging system, meaning all damages should be dealt via triggers...
 
Level 11
Joined
Nov 15, 2007
Messages
800
If this is true, Shallow Grave won't work but it does work... also, your because line is WRONG, the event "Unit - Unit gets Damaged" fires before the damage is actually dealt... DDSs utilizes that event you know, but adds optimization and such...

but yeah, get Bribe's DDS...

Sorry, I meant "the damage cannot be prevented before it happens". Which is pretty obvious with a heal-based system, you can't heal a unit that's at full health and expect it not to die when it takes damage.

You can test this yourself. Get a hero to 1 HP with shallow grave on him, have Pugna banish him, and a Necrolyte with Scepter ult him. He'll die through shallow grave because he takes more damage than his max HP. DotA's damage prevention uses healing rather than increasing max health.

I was only made aware of this myself because of posts in the Dota2 forum talking about the fact that shallow grave truly prevents death from everything but Cull now. Apparently Necrolyte with Ethereal Blade is a popular build against Dazzle? IDK.

Edit: Here's a more in-depth review of how DotA does damage prevention and why it's prone to fail at times. http://www.playdota.com/forums/showthread.php?t=3555
 
Well, Culling goes through anything... I wonder what happens when Axe uses culling with someone using blade mail... XD...

I see... I forgot something... XD...

that is why I saw someone before which used an if-then-else for damage blocking... If the damage < maxhp, heal... if not, make the unit invulnerable for 0.0 seconds via triggers...
 
Level 11
Joined
Nov 15, 2007
Messages
800
Well, Culling goes through anything... I wonder what happens when Axe uses culling with someone using blade mail... XD...

Culling Blade removes all buffs from the target, including invulnerability, banish, and the "ethereal" ability, and then deals 100,000,000 physical damage.

Blademail is triggered to only return damage less than 10,000 or something so that it won't return killing blows. It also doesn't return damage dealt by another blademail for obvious reasons.

It's also interesting to note that although Ancient Apparition's ultimate is also an instant kill that removes buffs and then deals 100,000,000 physical damage, it's triggered specifically to not kill a unit with shallow grave, but instead reduce their HP to 1 - but the frozen debuff remains so they'll die as soon as the shallow grave wears off if they still have the frozen debuff.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Import Unit indexer and Damage engine systems by Bribe. Then use this trigger:
  • Untitled Trigger 003
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DamageEventAmount - (Life of DamageEventTarget)) Greater than or equal to 0.41
        • Then - Actions
          • Set DamageEventAmount = 0.00
          • Unit - Set life of DamageEventTarget to 0.41
        • Else - Actions
Add a condition that checks whether the unit should have this effect.
 
Status
Not open for further replies.
Top