• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Issues with Anti-magic shield

Status
Not open for further replies.
Level 12
Joined
Nov 5, 2007
Messages
730
I want to make a spell that makes a shield around a target friendly unit,that absorbs 300 damage.When the shield receives 300 damage,i want it to dissapear.


Anti-magic shield has a fiels named "shield life" however,it lasts forever,no matter how damage the unit absorbs.

Help please!
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
There were probably close to a million threads about this.
After a lot of arguing, we agreed that blizzard spells are no use for this (I don't remember why and I'm not going to search it).

So, either use Jass for a easy going thing (it will never be perfect, because the unit takes the hit and then regens, and thus if the hit kills him... he is dead), or create a crappy version in GUI.
There's also an ability that adds armor reduction, no ? Because you can use the above solution + 99% (100% if possible) damage reduction. Now that will be the perfect shield :p
 
Level 5
Joined
Aug 27, 2007
Messages
138
Shield life is for how much magic damage the shield can absorb. However, the event "takes damage" fires before the actual damage is taken, so it can a damage-absorbing shield is actually quite easy. Create a trigger that detects damage done to the target, heals it to max IMMEDIATELY, then sets the unit's HP back to its original. Store the damage done, and when the damage done exceeds the shield life, destroy the shield. I can make it for you if you want.
 
Level 5
Joined
Aug 27, 2007
Messages
138
There are two versions of anti-magic shield, one don't disappear even if take damage, and the other does.

I use that in my map and works fine. BUT THE DAMAGE IS ONLY FROM SPELLS.

Anti-magic shield can absorb spell/magic damage or grant immunity. There is no possible way to make it absorb non-magical damage.

However, this means one-hit kills are still one-hit kills.

Not necessarily. Since the damage taken event fires before the unit actually takes the damage, we would do something like this immediately after the unit is damaged:

JASS:
local real r = GetWidgetLife(unit)
call SetWidgetLife(unit, GetUnitState(unit, ConvertUnitState(1))
call SetWidgetLife(unit, r)

This would, theoretically, keep the unit at one constant level of health (not counting regeneration, of course).

Edit: Ignore that script. The proper method is to start a timer for .00 seconds that will set the unit's HP to R instead of just setting it via a function call. This ensures that the unit will take damage before its HP is set back to its normal, which could cause a kill. Here's a link to another thread about this topic, ironically on DotA. http://forums.dota-allstars.com/index.php?showtopic=171328&hl=
 
Status
Not open for further replies.
Top