luccagomes
New Member
- Joined
- Jul 30, 2015
- Messages
- 153
- Reaction score
- 1
I tried to adept this: https://otland.net/threads/mod-loot-ring.99748/ mod loot ring to make a amulet to set loot rates to 2x
Its work, but sometimes it show big erros on console like this:
What is it?
Why?
Could you help me to fix?
Its work, but sometimes it show big erros on console like this:
Code:
[2:10:35.754] [Error - CreatureScript Interface]
[2:10:35.754] In a timer event called from:
[2:10:35.754] local t = {
[2:10:35.754] item = 11393,
[2:10:35.754] slot = CONST_SLOT_NECKLACE,
[2:10:35.754] newRate = 2
[2:10:35.754] }
[2:10:35.754] local rate = getConfigInfo('rateLoot')
[2:10:35.754] function getContentDescription(uid, comma)
[2:10:35.755] local ret, i, containers = '', 0, {}
[2:10:35.755] while i < getContainerSize(uid) do
[2:10:35.755] local v, s = getContainerItem(uid, i), ''
[2:10:35.755] local k = getItemInfo(v.itemid)
[2:10:35.756] if k.name ~= '' then
[2:10:35.757] if v.type > 1 and k.stackable and k.showCount then
[2:10:35.757] s = v.type .. ' ' .. getItemInfo(v.itemid).plural
[2:10:35.757] else
[2:10:35.757] local article = k.article
[2:10:35.757] s = (article == '' and '' or article .. ' ') .. k.name
[2:10:35.757] end
[2:10:35.757] ret = ret .. (i == 0 and not comma and '' or ', ') .. s
[2:10:35.757] if isContainer(v.uid) and getContainerSize(v.uid) > 0 then
[2:10:35.757] table.insert(containers, v.uid)
[2:10:35.757] end
[2:10:35.757] else
[2:10:35.757] ret = ret .. (i == 0 and not comma and '' or ', ') .. 'an item of type ' .. v.itemid .. ', please report it to gamemaster'
[2:10:35.766] end
[2:10:35.766] i = i + 1
[2:10:35.766] end
[2:10:35.766] for i = 1, #containers do
[2:10:35.766] ret = ret .. getContentDescription(containers[i], true)
[2:10:35.766] end
[2:10:35.766] return ret
[2:10:35.766] end
[2:10:35.766] local function send(cid, pos, corpseid, monster, party)
[2:10:35.766] local corpse = getTileItemById(pos, corpseid).uid
[2:10:35.766] local ret = isContainer(corpse) and getContentDescription(corpse)
[2:10:35.766] doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing'))
[2:10:35.766] if party then
[2:10:35.766] for _, pid in ipairs(getPartyMembers(party)) do
[2:10:35.766] doPlayerSendChannelMessage(pid, '', 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing'), TALKTYPE_CHANNEL_W, CHANNEL_PARTY)
[2:10:35.766] end
[2:10:35.766] end
[2:10:35.766] end
[2:10:35.766] local function createLoot(i, ext)
[2:10:35.766] local item = type(i.id) == 'table' and i.id[math.random(#i.id)] or i.id
[2:10:35.767] local random = math.ceil(math.random(100000) / (ext and t.newRate or rate))
[2:10:35.767] local tmpItem = false
[2:10:35.767] if random < i.chance then
[2:10:35.767] tmpItem = doCreateItemEx(item, getItemInfo(item).stackable and random % i.count + 1 or 1)
[2:10:35.768] end
[2:10:35.768] if not tmpItem then
[2:10:35.768] return false
[2:10:35.768] end
[2:10:35.768] if i.subType ~= -1 then
[2:10:35.768] doItemSetAttribute(tmpItem, 'subType', i.subType)
[2:10:35.768] end
[2:10:35.769] if i.actionId ~= -1 then
[2:10:35.770] doItemSetAttribute(tmpItem, 'aid', i.actionId)
[2:10:35.770] end
[2:10:35.772] if i.uniqueId ~= -1 then
[2:10:35.772] doItemSetAttribute(tmpItem, 'uid', i.uniqueId)
[2:10:35.772] end
[2:10:35.772] if i.text ~= '' then
[2:10:35.772] doItemSetAttribute(tmpItem, 'text', i.text)
[2:10:35.772] end
[2:10:35.772] return tmpItem
[2:10:35.772] end
[2:10:35.772] local function createChildLoot(parent, i, ext)
[2:10:35.772] if #i == 0 then
[2:10:35.773] return true
[2:10:35.773] end
[2:10:35.773] local size, cap = 0, getContainerCap(parent)
[2:10:35.773] for k = 1, #i do
[2:10:35.773] if size == cap then
[2:10:35.773] break
[2:10:35.777] end
[2:10:35.777] local tmp = createLoot(i[k], ext)
[2:10:35.778] if tmp then
[2:10:35.778] if isContainer(tmp) then
[2:10:35.778] if createChildLoot(tmp, i[k].child, ext) then
[2:10:35.778] doAddContainerItemEx(parent, tmp)
[2:10:35.778] size = size + 1
[2:10:35.778] else
[2:10:35.778] doRemoveItem(tmp)
[2:10:35.778] end
[2:10:35.778] else
[2:10:35.778] doAddContainerItemEx(parent, tmp)
[2:10:35.778] size = size + 1
[2:10:35.778] end
[2:10:35.778] end
[2:10:35.778] end
[2:10:35.779] return size > 0
[2:10:35.779] end
[2:10:35.779] local function dropLoot(pos, v, ext)
[2:10:35.779] local corpse = getTileItemById(pos, v.lookCorpse).uid
[2:10:35.779] if isContainer(corpse) then
[2:10:35.779] for i = 1, getContainerSize(corpse) do
[2:10:35.779] doRemoveItem(getContainerItem(corpse, 0).uid)
[2:10:35.779] end
[2:10:35.779] local size, cap = 0, getContainerCap(corpse)
[2:10:35.779] for i = 1, #v.loot do
[2:10:35.779] if size == cap then
[2:10:35.779] break
[2:10:35.779] end
[2:10:35.780] local tmp = createLoot(v.loot[i], ext)
[2:10:35.780] if tmp then
[2:10:35.780] if isContainer(tmp) then
[2:10:35.780] if createChildLoot(tmp, v.loot[i].child, ext) then
[2:10:35.780] doAddContainerItemEx(corpse, tmp)
[2:10:35.780] size = size + 1
[2:10:35.780] else
[2:10:35.780] doRemoveItem(tmp)
[2:10:35.780] end
[2:10:35.780] else
[2:10:35.780] doAddContainerItemEx(corpse, tmp)
[2:10:35.780] size = size + 1
[2:10:35.780] end
[2:10:35.780] end
[2:10:35.780] end
[2:10:35.780] end
[2:10:35.780] end
[2:10:35.780] function onKill(cid, target, lastHit)
[2:10:35.780] if lastHit and isMonster(target) then
[2:10:35.780] local v = getMonsterInfo(getCreatureName(target))
[2:10:35.780] if v.lookCorpse > 0 then
[2:10:35.780] local master = getCreatureMaster(target)
[2:10:35.780] if not master or master == target then
[2:10:35.780] addEvent(dropLoot, 0, getThingPos(target), v, getPlayerSlotItem(cid, t.slot).itemid == t.item)
[2:10:35.780] end
[2:10:35.780] addEvent(send, 100, cid, getThingPos(target), v.lookCorpse, v.description)
[2:10:35.780] end
[2:10:35.780] end
[2:10:35.780] return true
[2:10:35.780] end
[2:10:35.780] :onKill
[2:10:35.780] Description:
[2:10:35.780] [string "LuaInterface::loadBuffer"]:58: attempt to index a boolean value
[2:10:35.783] stack traceback:
[2:10:35.785] [string "LuaInterface::loadBuffer"]:58: in function 'createLoot'
[2:10:35.785] [string "LuaInterface::loadBuffer"]:130: in function <[string "LuaInterface::loadBuffer"]:119>
What is it?
Why?
Could you help me to fix?