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!
In the actions function of a damage detection trigger, just use:
JASS:
// This example is for 50% damage returned to caster.
local real damage = GetEventDamage()
local unit target = GetTriggerUnit()
local unit owner = <Owner of summoned unit>
local real target_life = GetUnitState(target, UNIT_STATE_LIFE)
local real owner_life = GetUnitState(owner, UNIT_STATE_LIFE)
set target_life = target_life + (damage * 0.5)
set owner_life = owner_life - (damage * 0.5)
call SetUnitState(target, UNIT_STATE_LIFE, target_life)
call SetUnitState(owner, UNIT_STATE_LIFE, owner_life)
Now, for getting the owner of the unit, you can use several methods, I don't really wanna get into them at the moment. You'd also have to have an if or a condition in there somewhere to check if it's a summoned unit.
Remember that Damage Taken needs a unit to be selected on the map and in my case the summoned unit that cannot be selected on the map for triggers,must transfer the life it loses to the caster.
Sry Lord BoNes but somehow it doesn't wrk. If you do it for me I'll rep you. The ability is DL ulti- Infernal and the summoned unit is also infernal. Elselike I may need to see it as GUI to make it myself.
Sorry for the long reply time... I've been away on work.
Now, a couple of questions... Does the infernal take reduced damage, get half of it's health back? Does the caster of the infernal get anything?
Just a debug option here:
JASS:
call DisplayTextToPlayer(GetLocalPlayer(),0,0,R2S(damage))
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"|"+GetUnitName(target)+"|")
call DisplayTextToPlayer(GetLocalPlayer(),0,0,"|"+GetUnitName(owner)+"|")
// The reason for the "|" is incase of a null unit... it prints "||" instead of nothing.
You know, thank you for your time but I made it with vampiric aura of the infernal with selected targets in the data so that only the caster can gain life when the infernal steals life. It's not gonna be the life lost of the infernal to go to the caster, it is the life stolen by infernal is gained only by the caster. Just changed the nature of the ability I wanted to have, no triggers, no trouble.
I would use periodic trigger and check the difference between the max life and the actuall life of the unit. Then set the life of the hero to max life - this difference
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.