Verrine
Member
- Joined
- Mar 2, 2016
- Messages
- 117
- Reaction score
- 7
Hi.
As I wrote thread with request here :
https://otland.net/threads/tfs-1-2-timed-spell-with-life-drain.242563/
I decided to try it myself but I have problem with that.
I mean It only work for monsters who attacking me. When I attack monster nothing happen ;/
Here is Code:
Can anybody tell me what the hell is going on? Im wtrying to to id like @StreamSide told me but in here it works for player not in my code ;/ What is going on?
As I wrote thread with request here :
https://otland.net/threads/tfs-1-2-timed-spell-with-life-drain.242563/
I decided to try it myself but I have problem with that.
I mean It only work for monsters who attacking me. When I attack monster nothing happen ;/
Here is Code:
PHP:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
--if attacker:getExhaustion(config.timeStorage) > 0 then
--if origin == ORIGIN_MELEE then
--attacker:addHealth((primaryDamage * (config.lifeStealPercent / 100)))
attacker:addHealth(50)
doSendMagicEffect(getPlayerPosition(creature), CONST_ME_MAGIC_RED)
doSendMagicEffect(getPlayerPosition(attacker), CONST_ME_MAGIC_RED)
attacker:say("+" .. (primaryDamage * (config.lifeStealPercent / 100)) .. " HP", TALKTYPE_MONSTER_SAY)
--DoPlayerSendTextMessage(attacker, MESSAGE_STATUS_DEFAULT, "You stole " .. math.ceil(value * (config.lifeStealPercent / 100)) .. " health from " .. getPlayerName(cid) .. "\n" .. config.spellName .. " will last for " .. exhaustion.get(attacker, config.timeStorage) .. " seconds more.")
--end
--else
--return primaryDamage, primaryType, secondaryDamage, secondaryType
--end
end
Can anybody tell me what the hell is going on? Im wtrying to to id like @StreamSide told me but in here it works for player not in my code ;/ What is going on?