HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Make unit unattackable

01-22-2010, 01:55 AM#1
Ammorth
Yes, how to make a unit unattackable, but still take damage from any effects on him (poisons, etc), without coding the poison, and being able to return the unit to normal.

Im hoping for some simple ability or unit setting.

If not, I guess I must resort to scripting the poison damage.
01-22-2010, 07:42 AM#2
Fluff
I don't have any experience trying anything like this, but would it be possible to set the poison spell to allow damage to Invulnerable in the Target Allowed field?
01-22-2010, 08:18 AM#3
Anachron
Event: a unit is being attacked
Condition: Attacked unit is in safeGroup equal to true
Action:
Order attacking unit to stop
01-22-2010, 09:15 AM#4
Anitarf
You could try giving the unit the ancient or the suicidal classification and then make all attacks unable to target units with that classification.
01-22-2010, 09:35 AM#5
Anachron
Or he could change the target type, which results in the same thing.
01-22-2010, 10:42 AM#6
moyack
Evasion 100% ??
01-22-2010, 11:26 AM#7
DioD
make it invisible.
01-22-2010, 12:22 PM#8
Anachron
Quote:
Originally Posted by DioD
make it invisible.
You are not serious, are you?
01-22-2010, 01:47 PM#9
DioD
why not?

nobody will attack invisible units but all affects will be at place.
01-22-2010, 02:09 PM#10
HyperActive
Actually the Berserk ability that the Troll Berserkers have, can be modified so that the field with "damage multiplier" value has a negative value, and the unit that has it won't take any damage from attacks for it's duration.

It's not important what's the value of the field as long as it is negative (maybe it can even be 0, I don't remember correctly).

Not sure how this affects poison and suck, but, it's worth trying.
01-22-2010, 02:10 PM#11
Anachron
You would just make the unit invisible for not being able to be attacked?
Well, that's just ridiculous.
01-22-2010, 02:19 PM#12
Archmage Owenalacaster
In the field Combat - Targeted As, you can use a designation like Decoration to make a unit unattackable, since nothing in the game (in my experience) can target decoration. It's the designation used by non-targetable destructables.

Unfortunately, that unit field cannot be changed on-the-fly, so it's only useful in conjunction with Chaos for your purposes.

EDIT: Quite an inelegant solution.
01-22-2010, 07:03 PM#13
Ammorth
Quote:
Originally Posted by Anitarf
You could try giving the unit the ancient or the suicidal classification and then make all attacks unable to target units with that classification.

See, I knew I was forgetting something. Simple yet effective.

The problem I was having with abilities to reduce physical damage / avoid it, etc was that the unit would still be a "valid target" in the game engine and the attacks would be "wasted" on it, instead of attacking a target that isn't flagged.
01-25-2010, 08:10 AM#14
Anachron
You can trigger an attacktarget changer, if target is in group you check for other units around which are attackable and force him to attack another one?^^
01-25-2010, 08:25 AM#15
Ammorth
Would rather not have an unit is attacked event for a TD.... plus, the ancient was super easy to implement...

Collapse JASS:
    function canBeAttacked takes Waypoint w, unit u returns nothing
        call UnitRemoveType(u, UNIT_TYPE_ANCIENT)
    endfunction
    
    function cannotBeAttacked takes Waypoint w, unit u returns nothing
        call UnitAddType(u, UNIT_TYPE_ANCIENT)
    endfunction
...
    call waypoint[n].addOnEnter(canBeAttacked)
    call waypoint[n2].addOnEnter(cannotBeAttacked)
...