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:
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