• 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 1.X+ when player kill the monster and looted rare item

massinha

New Member
Joined
Mar 13, 2019
Messages
31
Reaction score
0
I try to use this script:
Owner: Delusion
But doesn't work, i put this script at login.lua and creaturescript xml corret ?


Code:
local rareItems = {1111, 2222, 3333}

local function scanRareItems(name, pos)
    local corpse = Tile(pos):getTopDownItem()
    for i = corpse:getSize()-1, 0, -1 do
        local item = corpse:getItem(i)
        if isInArray(rareItems, item:getId()) then
            Game.broadcastMessage(("%s has looted a %d %s!"):format(name, item:getCount(), item:getCount() > 1 and ItemType(item:getId()):getPluralName() or item:getName()))
            return
        end
    end
end

function onKill(creature, target)
    if creature:isPlayer() and target:isMonster() then
        addEvent(scanRareItems, 0, creature:getName(), target:getPosition())
    end
    return true
end
 
Last edited:
I try to use this script:
Owner: Delusion
But doesn't work, i put this script at login.lua and creaturescript xml corret ?

local rareItems = {1111, 2222, 3333}

local function scanRareItems(name, pos)
local corpse = Tile(pos):getTopDownItem()
for i = corpse:getSize()-1, 0, -1 do
local item = corpse:getItem(i)
if isInArray(rareItems, item:getId()) then
Game.broadcastMessage(("%s has looted a %d %s!"):format(name, item:getCount(), item:getCount() > 1 and ItemType(item:getId()):getPluralName() or item:getName()))
return
end
end
end

function onKill(creature, target)
if creature:isPlayer() and target:isMonster() then
addEvent(scanRareItems, 0, creature:getName(), target:getPosition())
end
return true
end
How do you have it added to login.lua, and what is the error it gives you? @massinha
 
Back
Top