Estou usando um script para o jogador 'catar' gold automaticamente, porem isso não ocorre em monstros 'novos', como lizards, souleaters, drakens.
Por favor me ajudem a consertar isso, tem muito tempo que já estou tentando arruma isso.
Alguém mais experiente poderia facilmente conserta-lo.
function getContainerItems(containeruid) local items = {} local containers = {} if type(getContainerSize(containeruid)) ~= "number" then return false end for slot = 0, getContainerSize(containeruid)-1 do local item = getContainerItem(containeruid, slot) if item.itemid == 0 then break end if isContainer(item.uid) then table.insert(containers, item.uid) end table.insert(items, item) end if #containers > 0 then for i,x in ipairs(getContainerItems(containers[1])) do table.insert(items, x) end table.remove(containers, 1) end return items end function getItemsInContainerById(container, itemid) -- Function By Kydrai local items = {} if isContainer(container) and getContainerSize(container) > 0 then for slot=0, (getContainerSize(container)-1) do local item = getContainerItem(container, slot) if isContainer(item.uid) then local itemsbag = getItemsInContainerById(item.uid, itemid) for i=0, #itemsbag do table.insert(items, itemsbag[i]) end else if itemid == item.itemid then table.insert(items, item.uid) end end end end return items end function doPlayerAddItemStacking(cid, itemid, quant) local item = getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, itemid) local piles = 0 if #item > 0 then for i,x in pairs(item) do if getThing(x).type < 100 then local it = getThing(x) doTransformItem(it.uid, itemid, it.type+quant) if it.type+quant > 100 then doPlayerAddItem(cid, itemid, it.type+quant-100) end else piles = piles+1 end end else return doPlayerAddItem(cid, itemid, quant) end if piles == #item then doPlayerAddItem(cid, itemid, quant) end end function corpseRetireItems(corpsepos, killer, itemsarray) local corpse = nil for i = 1, 254 do corpsepos.stackpos = i corpse = getThingFromPos(corpsepos) if corpse.uid > 0 and isCorpse(corpse.uid) then break end end local items = getContainerItems(corpse.uid) for i,x in pairs(items) do if isInArray(itemsarray, tonumber(x.itemid)) then if isItemStackable(x.itemid) then doPlayerAddItemStacking(killer, x.itemid, x.type) else doPlayerAddItem(killer, x.itemid) end doRemoveItem(x.uid, x.type) end end end function onKill(cid, target, lastHit) local loots = {2148, 2152, 2160} if lastHit and getPlayerStorageValue(cid, 6616) == 1 then addEvent(corpseRetireItems, 100, getCreaturePosition(target), cid, loots) end return true end
Creditos:MatheusMkalo, por postar esse script.
Link do Tópico dele:http://www.xtibia.co...tion-auto-gold/
COMO SEMPRE!!, NINGUEM AJUDA A RESOLVER NADA AQUI, A NÃO SER FAZER BAÚ DE QUEST!!!!!
RESOLVIDO: Se você tiver o mesmo problema do que eu, o erro não está no script, mas no monstro, adicione essa tag no corpse do monstro, que fica em items.xml.
<attribute key="corpseType" value="Blood" />