#How do i make lifesteal?
1 messages · Page 1 of 1 (latest)
Re-implementation of Morbid Mask, which gives you lifesteal.
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.
thank you
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
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).
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.
Unfortunately no.
Sad.
makes adding custom effects easier at least
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

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
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
You are overcomplicating. Using OnAttackLanded is enough. Not 4 different modifier properties and events ...
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
I wrote this a long time ago, while checking the lifesteal mechanic. Should have use OnTakeDamage instead
the new barrier probably changed it tho.
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
this is the order for post-7.33 events, do what you will.
https://github.com/Elfansoer/dota-2-lua-abilities/blob/master/scripts/vscripts/lua_abilities/_test/test_attack_new.lua
I didn't know OnDamageCalculated was exposed to the API