• 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!

Vampiric spell for TFS 1.2 timed

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:
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?
 
What I would do is start small, I would only print the values if the attacker was a player.. and then go from there.

You are trying to run before you even have learned how to crawl... this is why you keep falling down :p
 
What I would do is start small, I would only print the values if the attacker was a player.. and then go from there.

You are trying to run before you even have learned how to crawl... this is why you keep falling down :p
If I do that script does not work, mobs ofc dont recive HP but players too, thats why I deleted line
if attacker:IsPlayer()
 
You don't get what I am saying to you...
did I get it now?
Monster attacked me i had this:
19:53 Attacker: Rotworm
19:53 Victim: Berserker

I attacked monster - nothing
Code:
creature:sendTextMessage(MESSAGE_EVENT_ORANGE, "Attacker: " .. attacker:getName() .. "\n")
            creature:sendTextMessage(MESSAGE_EVENT_ORANGE, "Victim: " .. creature:getName() .. "\n")
when I changed creature: to attacker: I had nil values in console
 
Back
Top