• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lifesteal on attack onHealthChange

lcsmoraes

New Member
Joined
Feb 24, 2011
Messages
4
Reaction score
0
I'm trying to create a script that when I attack with a monster or player part of the damage heals me, for example, if I take 100 life, I heal 50% back, I knew how to do that with onStatsChange in tfs 0.4 but in 1.0 I don't I'm getting it, in this version it uses onHealthChange, and also the "cure" is coming as damage, because the primaryAttack comes negative

It only works when it's player against player, in monster it doesn't work
And it works more or less because it takes my life instead of giving me life

sorry my english, i'm using translator
my code:

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
local item5 = attacker:getSlotItem(CONST_SLOT_HEAD)
if item5 then
if item5.itemid == 18403 then
damage = primaryDamage + secondaryDamage
damage = damage / 2
doCreatureAddHealth(attacker, damage)

end
end
end
 
Back
Top