E
Evil Puncker
Guest
I've found a script by @Delusion that broadcasts the loot if found on table, is there a way to change it to broadcast loot based on the drop percentage instead? lets say, if loot has chance = 100, broadcast it instead of using table? Using tfs 1.3
LUA:
local rareItems = {1111, 2222, 3333}
local WORLD_CHAT = 00000 -- channel id here
local function scanRareItems(cid, pos)
local player = Player(cid)
local name = player:getName()
local corpse = Tile(pos):getTopDownItem()
for i = corpse:getSize()-1, 0, -1 do
local item = corpse:getItem(i)
if isInArray(rareItems, item:getId()) then
local count = item:getCount()
local string = ("%s has looted %s %s!"):format(name, count > 1 and count or item:getArticle(), count > 1 and item:getPluralName() or item:getName())
Game.broadcastMessage(string)
player:sendChannelMessage(nil, string, TALKTYPE_CHANNEL_R1, WORLD_CHAT)
end
end
end
function onKill(creature, target)
if creature:isPlayer() and target:isMonster() then
addEvent(scanRareItems, 0, creature:getId(), target:getPosition())
end
return true
end