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

TFS 0.X Life Steal in monster!

boxxer321

Well-Known Member
Joined
Nov 5, 2011
Messages
118
Reaction score
59
Hi, guys!
i have a script here of Life Steal ON PLAYER, but, i want to him affect monsters too... how can i do this? im not good with scripts

local config = {
weapons = {
-- [ID] = LIFE STEAL %,
[8602] = 10,
},
-- Vocations number
-- 1, 5 = Druid, Elder Druid
-- 2, 6 = Sorcerer, Master Sorcerer
-- 3, 7 = Paladin, Royal Paladin
-- 4, 8 = Knight, Elite Knight
-- others
vocations = {4, 8},
}


function onLogin(cid)
registerCreatureEvent(cid, "LifeSteal")
return true
end

function onStatsChange(cid, attacker, type, combat, value)
if not isPlayer(attacker) then
return true
end

if not isInArray(config.vocations, getPlayerVocation(attacker)) then
return true
end

for slot = 0, 9 do
for id, perc in pairs(config.weapons) do
if (getPlayerSlotItem(attacker, slot).id == id) then
return doCreatureAddHealth(attacker, math.ceil(value / perc))
end
end
end

return true
end

tfs 0.4
 
Hi, guys!
i have a script here of Life Steal ON PLAYER, but, i want to him affect monsters too... how can i do this? im not good with scripts



tfs 0.4
Not too good with old tfs but hope this works.

Lua:
local config = {
    weapons = {
    [8602] = 10,
    },
    vocations = {4, 8},
}

function onLogin(cid)
    registerCreatureEvent(cid, "LifeSteal")
    registerCreatureEvent(cid, "monster_LifeSteal")
    return true
end

--monster_LifeSteal
function onAttack(cid, target)
    if isMonster(target) then
        registerCreatureEvent(target, "LifeSteal")
    end
    return true
end

--LifeSteal
function onStatsChange(cid, attacker, type, combat, value)
    if isPlayer(attacker) then
        if not isInArray(config.vocations, getPlayerVocation(attacker)) then
            return true
        end

        for slot = 0, 9 do
            for id, perc in pairs(config.weapons) do
                if (getPlayerSlotItem(attacker, slot).id == id) then
                    return doCreatureAddHealth(attacker, math.ceil(value / perc))
                end
            end
        end
    end
    return true
end
 
Last edited:
Not too good with old tfs but hope this works.

Lua:
local config = {
    weapons = {
    [8602] = 10,
    },
    vocations = {4, 8},
}

function onLogin(cid)
    registerCreatureEvent(cid, "LifeSteal")
    registerCreatureEvent(cid, "monster_LifeSteal")
    return true
end

--monster_LifeSteal
function onAttack(cid, target)
    if isMonster(target) then
        registerCreatureEvent(target, "LifeSteal")
    end
    return true
end

--LifeSteal
function onStatsChange(cid, attacker, type, combat, value)
    if isPlayer(attacker) then
        if not isInArray(config.vocations, getPlayerVocation(attacker)) then
            return true
        end

        for slot = 0, 9 do
            for id, perc in pairs(config.weapons) do
                if (getPlayerSlotItem(attacker, slot).id == id) then
                    return doCreatureAddHealth(attacker, math.ceil(value / perc))
                end
            end
        end
    end
    return true
end
didnt work
 
Back
Top