#How do i make lifesteal?

1 messages · Page 1 of 1 (latest)

crystal mango
#

I looked in the api but i didn't find any modifier functions for lifesteal. I only found some for lifesteal amp.

hollow path
#

Check the modifier_imba_morbid_mask_unique modifier.

#

Actually, no, sorry. This is not a good example. Custom implementation.

#

Let me find a better one.

crystal mango
#

thank you

storm palm
#

tl;dr
lifesteal isn't a real stat
its something you calculate when you do damage, so you can't just add a 'lifesteal' property

I know this is redundant to say at this point here, but I figured I'd clarify in case anyone else goes looking

slim craterBOT
#

Found 1 function for healwithparam

🇸 CDOTA_BaseNPC:HealWithParams(amount: float, inflictor: handle, lifesteal: bool, amplify: bool, source: handle, spellLifesteal: bool): nil
Heal this unit (with more parameters).

small locust
#

Old examples usually use Heal instead of this^. Third argument set to true marks it as lifesteal. 4th arg set to true allows it to be amped with lifesteal amp.

hollow path
#

Huh, neat

#

Does it also handles the particles?

small locust
hollow path
#

Sad.

viscid garden
celest kiln
#

The example linked above is mechanically accurate for Open Wounds, but not for ordinary lifesteal (like Morbid Mask).
For an almost accurate lifesteal implementation you could try this:

#

Place the modifier on the target in OnAttackLanded and it will heal the attacker if applicable

#

Alternatively, you could just borrow the vanilla modifier_special_bonus_lifesteal and it will proc lifesteal based on the KV named value from your ability values, but this might be too hacky for some people

storm palm
#

do you need to account for barriers when calculating damage?

#

I didn't think you did

#

or rather, not calculating damage, but using the damage on the attack landed

celest kiln
#

This is post-barriers just like using the damage in OnAttacked; I didn't use the damage in OnAttackLanded

#

Lifesteal buff places this modifier on the target during OnAttackLanded, modifier does some calculations and removes itself after OnAttacked

small locust
#

You are overcomplicating. Using OnAttackLanded is enough. Not 4 different modifier properties and events ...

celest kiln
#

I wouldn't be doing that if the simple solutions were satisfactory, and it happens that lifesteal is pretty important in my custom game so I went the length

#

Using OnAttackLanded would be very off, entirely ignoring armor and damage block. It's what Jugg's level 20 talent did for some time, until 7.34 fixed it

#

Using OnAttacked is almost decent except you will heal extreme amounts from illusions

cosmic snow
celest kiln
#

Yeah it was much simpler pre 7.33, when lifesteal was calculated at INCOMING_DAMAGE_PERCENTAGE, plus a hardcoded check to stop lifesteal if target is phys immune (Omni ult, etc)

#

The new sequence with the barriers is pretty convoluted and required this ugly solution

cosmic snow
celest kiln
#

I didn't know OnDamageCalculated was exposed to the API