• 🏆 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!

How to? - Revive when taken dmg doesnt blow x% of maxlife

Status
Not open for further replies.
Level 10
Joined
Jul 5, 2012
Messages
230
Hey I was wondering about this passive spell for my skeleton archer. It's supposed to be a reincarnation spell, that grants you every time (maybe with cooldown) reincarnation when the enemy isnt able to deal more than 20% of your life with the last hit.

Example:
Enemy does 50-250 dmg with each attack
Your max life is 1000
Your current life is 90

(so lets say the dmg dealt by enemy must be higher than 20% of your maxlife.)

Situation A: Enemy does 100dmg (thats below value 200 (20% of max life))
You'll revive

Situation B: Enemy does 250dmg (thats above value 200 (20% of max life))
You'll be dead (i.e. you'll revive by timer)

Skill Cooldown: once every 120/100/80/60 seconds

Is somebody able to help me?

Edit: Sorry please move me to the right section
 
Last edited:
Level 5
Joined
Sep 28, 2010
Messages
75
Try out this system:
Damage

It detects damage done, manipulates damage as well as providing a very useful damage-blocking function.

> You have 10 life left
> Enemy deals 50 damage
> You block 45 damage (By calling a function)
> You have 5 life left AND you are alive.

Drawbacks: Instead of reviving, you stay alive.
 
Level 5
Joined
Sep 28, 2010
Messages
75
You can manipulate the system to suit what he wants, by:
> Detecting damage done
> Calculating the damage to determine if the unit revives or not
> If the damage calculated is less than 20%, revive the unit OR choose to nullify the damage done without killing the unit.

Here is an example (assuming you have JGNP):
JASS:
private function ReviveUnit takes nothing returns nothing
    local real dmg = GetEventDamage()
    if GetUnitTypeId(GetEventDamageSource()) == 'H000' then

        if dmg < GetWidgetLife(GetTriggerUnit()) + GetUnitState(GetTriggerUnit(), UNIT_STATE_MAX_LIFE) * 0.2 then
            //Unit doesn't die
            call Damage_BlockAll()
            //OR (for hero revival)
            call ReviveHero(GetTriggerUnit(), GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), true)
        endif

    endif
endfunction

private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call Damage_RegisterEvent(t)
    call TriggerAddAction(t, function ReviveUnit)
endfunction
 
Status
Not open for further replies.
Top