• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Immortal?

Status
Not open for further replies.
Level 4
Joined
Jan 9, 2010
Messages
89
Ok, I don't really have an idea for how you could make it, but I suspect that it would require a custom damage detection system and the damage to be completely scripted.

That's what I think, I might have overlooked a spell or a trigger that makes it possible.
 
Level 7
Joined
Oct 14, 2008
Messages
340
Have you tried detecting damage that brings the units health below 1, then setting that units health to 1? It may fire fast enough to avoid the unit ever dying.
 
Level 6
Joined
Jan 7, 2007
Messages
247
Yeah, its pretty simple. It detects how much damage unit gets and heals him for amount of damage taken before he actually gets damage.
 
Level 7
Joined
Oct 14, 2008
Messages
340
No you don't want to heal him for the damage he takes, you just want to set his health to 1, this is what NiddHogg is looking for.
 
Have you tried detecting damage that brings the units health below 1, then setting that units health to 1? It may fire fast enough to avoid the unit ever dying.

The damage detecting event (as far as I know) kicks in before the unit takes damage, so it would set it to 1 before the damage is taken and kill the unit. D:
EDIT: Nvm, the damage detecting event does it before, and the unit attacked one fires at the actual time. =P

Perhaps you could give him some sort of divine shield. =P I haven't played DotA though, so I don't really know how the spell works.

EDIT: Tested the methods mentioned above and yeah, it works:
JASS:
function Trig_Immune_Actions takes nothing returns nothing
    local real damage = GetEventDamage()
    call SetWidgetLife(GetTriggerUnit(),(1+damage))
endfunction

But only problem is if he takes damage equal to more than his maximum health. Also, this is a specific unit event, not a generic unit event.

EDIT: @Watermelon: Thanks, fixed. =D
 
Last edited:
Level 14
Joined
Nov 18, 2007
Messages
1,084
Justify's idea along with some of the above posts works:
Make a trigger that can detect the damage the unit will take.
If the damage it takes is greater than the unit's life, add an ability that can raise the unit's max hp by some big number. Then create a timer that will expire in 0 seconds to remove the ability and set the unit's life to 1.
(BTW, you should use SetWidgetLife instead of SetUnitState)
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
If you wanted to do it with a system, I advise using an updated version: http://www.wc3c.net/showthread.php?t=107451

Edit: Here's a crummy test map of what I was talking about. It's just to show you a general idea of what I meant.
How much damage the unit can sustain before it will get damaged regardless of the trigger is limited by the amount of max life that the ability gives.
Hopefully, you will use TimerUtils or some timer recycling system if you decide to use this method.
 

Attachments

  • DamageTest.w3x
    13.1 KB · Views: 58
Level 9
Joined
Nov 28, 2008
Messages
704
Simple damage detection system. If a unit has your buff, and they receive damage, check:

Will the damage do more than their total hp? If not, ignore this damage.

If so, heal for (Damage - CurrentHP + 1) points of health.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
In additon, when you are able to cast the spell, then there is normaly no sourge of damage nearby which could onehit you:grin:
What if there is? That's really up to the map maker though.
Simple damage detection system. If a unit has your buff, and they receive damage, check:

Will the damage do more than their total hp? If not, ignore this damage.

If so, heal for (Damage - CurrentHP + 1) points of health.
Example of why something like that will not work:
Unit A has only 10 max life. Unit A takes 20 damage.
The healing will come before the damage is actually dealt, thus resulting in Unit A's death.
 
Level 9
Joined
Nov 28, 2008
Messages
704
Thats why your damage system to heal should be capable of adding a temp buiff of +9999999 hp, then removing it a split second later.

The damage system I made does that anyways. Don't know what other people use, so I can't comment.
 
Status
Not open for further replies.
Top