Postado Fevereiro 26, 2015 10 anos olá amigos estou com um mod que dropa itens de monstros com atributos, problema e que o script da alguns erros ao decorrer do tempo alguém pode me ajudar ? MoD Mostrar conteúdo oculto <?xml version="1.0" encoding="UTF-8"?> <mod name="Random Item Stats" enabled="yes"> <config name="itemstats_conf"><![CDATA[ -- // extra_loot_key = 12312454 --: optional storage for higher loot rate vocation_base_attackspeed = getVocationInfo(1).attackSpeed --: used for attackSpeed stat -- // tiers, attr = {}, {} tiers['rare'] = { color = 66, -- color of 'RARE' text extra = {0, 0}, attrNames = true, -- show attribute names instead of rare chance = { [1] = 5000, [2] = 5000 -- chance for 2nd stat } } tiers['epic'] = { color = 35, extra = {1, 2}, -- additional percent bonus chance = { [1] = 2000, [2] = 25000 } } tiers['legendary'] = { color = 149, extra = {2, 4}, chance = { [1] = 500, [2] = 100000 -- 2 bonuses always } } MELEE = 0 DISTANCE = 1 ARMOR = 2 SHIELD = 3 WAND = 0 DURATION_RING = 5 CHARGES = 6 --! attributes attr['quick'] = { attr = 'attackSpeed', name = 'Attack Speed', percent = {4, 8}, types = {MELEE, DISTANCE} } attr['fortified'] = { attr = 'extraDefense', base = 'defense', name = 'Defense', percent = {1, 5}, types = {MELEE, SHIELD} } attr['deadly'] = { attr = 'extraAttack', base = 'attack', name = 'Attack', types = {MELEE}, percent = {1, 5} } attr['strong'] = { attr = 'armor', name = 'Armor', percent = {1, 6}, types = {ARMOR} } attr['hawkeye\'s'] = { attr = 'hitChance', name = 'Hit Chance', percent = {5, 20}, types = {DISTANCE} } --[[ // not available without source edit attr['farsight'] = { attr = 'shootRange', name = 'Shoot Range', percent = {10, 20}, types = {DISTANCE} } ]] attr['charged'] = { attr = 'charges', name = 'Charges', percent = {30, 45}, types = {CHARGES} } attr['divine'] = { attr = 'duration', name = 'Duration', percent = {35, 50}, types = {DURATION_RING} } --/ attributes rate = getConfigInfo('rateLoot') if( getConfigInfo('monsterLootMessage') ~= 0 )then print('[Notice] Set monsterLootMessage = 0 to prevent duplicate loot messages') end ]]></config> <event type="kill" name="itemstats" event="script"><![CDATA[ domodlib('itemstats_conf') function round(n, s) return tonumber(('%.' .. (s or 0) .. 'f'):format(n)) end function getContentDescription(uid, sep) local ret, i, containers = '', 0, {} while( i < getContainerSize(uid) )do local v, s = getContainerItem(uid, i), '' local k = getItemInfo(v.itemid) k.name = getItemAttribute(v.uid, 'name') or k.name if( k.name ~= '' )then if( v.type > 1 and k.stackable and k.showCount )then s = v.type .. ' ' .. k.plural else local article = getItemAttribute(v.uid, 'article') or k.article s = (article == '' and '' or article .. ' ') .. k.name end ret = ret .. (i == 0 and not sep and '' or ', ') .. s if( isContainer(v.uid) and getContainerSize(v.uid) ~= 0 )then table.insert(containers, v.uid) end else ret = ret .. (i == 0 and not sep and '' or ', ') .. 'an item of type ' .. v.itemid .. ', please report it to gamemaster' end i = i + 1 end for i = 1, #containers do ret = ret .. getContentDescription(containers, true) end return ret end local function send(cid, corpse, monster) if( isPlayer(cid) )then local ret = corpse and isContainer(corpse) and getContentDescription(corpse) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing')) local party = getPlayerParty(cid) if( party )then for _, pid in ipairs(getPartyMembers(party)) do doPlayerSendChannelMessage(pid, '', 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing'), TALKTYPE_CHANNEL_W, CHANNEL_PARTY) end end end end local function createLoot(i, ext) local item = type(i.id) == 'table' and i.id[math.random(#i.id)] or i.id local random = math.ceil(math.random(100000) / ext) local tmpItem, f if( random < i.chance )then if i.subType == -1 then f = getItemInfo(item) end tmpItem = doCreateItemEx(item, i.subType ~= -1 and i.subType or f.stackable and random % i.count + 1 or f.charges ~= 0 and f.charges or 1 ) end if( not tmpItem )then return end if( i.actionId ~= -1 )then doItemSetAttribute(tmpItem, 'aid', i.actionId) end if( i.uniqueId ~= -1 )then doItemSetAttribute(tmpItem, 'uid', i.uniqueId) end if( i.text ~= '' )then doItemSetAttribute(tmpItem, 'text', i.text) end local ret, done for k, v in pairs(tiers) do local cur, used = {}, {} for i = 1, #v.chance do if( math.random(100000) <= v.chance )then if( f )then f = getItemInfo(item) end if( not f.stackable )then for m, n in pairs(attr) do if( not table.find(used, m) and ( ( table.find(n.types, MELEE) and table.find({WEAPON_SWORD, WEAPON_CLUB, WEAPON_AXE}, f.weaponType) ) or ( table.find(n.types, DISTANCE) and f.weaponType == WEAPON_DIST and f.ammoType ~= 0 ) or ( table.find(n.types, ARMOR) and f.armor ~= 0 and f.wieldPosition ~= CONST_SLOT_NECKLACE ) or ( table.find(n.types, SHIELD) and f.defense ~= 0 and f.weaponType == WEAPON_SHIELD ) or ( table.find(n.types, WAND) and f.weaponType == WEAPON_WAND ) or ( table.find(n.types, DURATION_RING) and f.wieldPosition == CONST_SLOT_RING and f.transformEquipTo ~= 0 ) or ( table.find(n.types, CHARGES) and table.find({CONST_SLOT_RING, CONST_SLOT_NECKLACE}, f.wieldPosition) and f.charges ~= 0 ) ) )then table.insert(cur, m) end end if( #cur ~= 0 )then local n = cur[math.random(#cur)] table.insert(used, n) n = attr[n] local percent, new, tmp = math.random(n.percent[1] + (v.extra[1] or 0), n.percent[2] + (v.extra[2] or 0)) -- hacks if( n.attr == 'duration' )then tmp = getItemInfo(f.transformEquipTo) if tmp.transformDeEquipTo ~= item then break end new = round( tmp.decayTime * (1 + percent / 100) * 1000 ) elseif( n.attr == 'attackSpeed' )then new = round( vocation_base_attackspeed / (1 + percent / 100) ) elseif( n.attr == 'hitChance' ) then new = round( f.hitChance == -1 and percent or f.hitChance * (1 + percent / 100) ) else new = round( n.base and f[n['attr']] + f[n['base']] * (percent / 100) or f[n['attr']] * (1 + percent / 100) ) if( new == f[n[n.base and 'base' or 'attr']] )then -- no improvement break end end doItemSetAttribute(tmpItem, n.attr:lower(), new) local name = getItemAttribute(tmpItem, 'name') if( v.attrNames or not name )then local name = (v.attrNames and used[#used] or k) .. ' ' .. (name or f.name) doItemSetAttribute(tmpItem, 'name', name) if( f.article ~= '' )then local article = getArticle(name) if( article ~= f.article )then doItemSetAttribute(tmpItem, 'article', article) end end end local desc = getItemAttribute(tmpItem, 'description') or f.description doItemSetAttribute(tmpItem, 'description', '[' .. n.name .. ': +' .. percent .. '%]' .. (desc == '' and '' or '\n' .. desc)) ret = k end cur = {} if( #v.chance == i )then done = true end end else done = i ~= 1 break end end if( done )then break end end return tmpItem, ret end local function createChildLoot(parent, i, ext, pos) if( not i or #i == 0 )then return true end local size, cap = 0, getContainerCap(parent) for k = 1, #i do if( size == cap )then break end local tmp, ret = createLoot(i[k], ext) if( tmp )then if( isContainer(tmp) )then if( createChildLoot(tmp, i[k].child, ext, pos) )then doAddContainerItemEx(parent, tmp) size = size + 1 else doRemoveItem(tmp) end else if( ret )then doSendMagicEffect(pos, CONST_ME_MAGIC_GREEN) doSendAnimatedText(pos, ret:upper(), tiers[ret].color) end doAddContainerItemEx(parent, tmp) size = size + 1 end end end return size > 0 end local function dropLoot(pos, v, ext, master, cid, target) local corpse if( not master or master == target )then -- 0.3/4 corpse = getTileItemById(pos, v.lookCorpse).uid if( isContainer(corpse) )then for i = 1, getContainerSize(corpse) do doRemoveItem(getContainerItem(corpse, 0).uid) end local size, cap = 0, getContainerCap(corpse) for i = 1, #v.loot do if( size == cap )then break end local tmp, ret = createLoot(v.loot, ext) if( tmp )then if( isContainer(tmp) )then if( createChildLoot(tmp, v.loot.child, ext, pos) )then doAddContainerItemEx(corpse, tmp) size = size + 1 else doRemoveItem(tmp) end else if( ret )then doSendMagicEffect(pos, CONST_ME_MAGIC_GREEN) doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Item raro!") --doSendAnimatedText(pos, ret:upper(), tiers[ret].color) end doAddContainerItemEx(corpse, tmp) size = size + 1 end end end end end send(cid, corpse, v.description) end function onKill(cid, target, damage, flags) if( (damage == true or bit.band(flags, 1) == 1) and isMonster(target) )then -- 0.3/4 local creature = getCreatureName(target) if(creature ~= nil and creature ~= '') then local v = getMonsterInfo(creature) if( v and v.lookCorpse ~= 0 )then local s = getCreatureStorage(cid, extra_loot_key) addEvent(dropLoot, 0, getThingPos(target), v, s == -1 and rate or s, getCreatureMaster(target), cid, target) end end end return true end ]]></event> <event type="login" name="itemstats_login" event="buffer"><![CDATA[ registerCreatureEvent(cid, 'itemstats') ]]></event> </mod> I like
Postado Fevereiro 26, 2015 10 anos por favor seje mais especifico em quais problemas ta aparecendo. (18) 98134-9991 miillerdomingues@hotmail.com
Postado Abril 8, 2015 10 anos Autor erro e seguinte [8/4/2015 0:42:55] [Error - CreatureScript Interface] [8/4/2015 0:42:55] In a timer event called from: [8/4/2015 0:42:55] domodlib('itemstats_conf') [8/4/2015 0:42:55] [8/4/2015 0:42:55] function round(n, s) [8/4/2015 0:42:55] return tonumber(('%.' .. (s or 0) .. 'f'):format(n)) [8/4/2015 0:42:55] end [8/4/2015 0:42:55] [8/4/2015 0:42:55] function getContentDescription(uid, sep) [8/4/2015 0:42:55] local ret, i, containers = '', 0, {} [8/4/2015 0:42:55] while( i < getContainerSize(uid) )do [8/4/2015 0:42:55] local v, s = getContainerItem(uid, i), '' [8/4/2015 0:42:55] local k = getItemInfo(v.itemid) [8/4/2015 0:42:55] k.name = getItemAttribute(v.uid, 'name') or k.name [8/4/2015 0:42:55] if( k.name ~= '' )then [8/4/2015 0:42:55] if( v.type > 1 and k.stackable and k.showCount )then [8/4/2015 0:42:55] s = v.type .. ' ' .. k.plural [8/4/2015 0:42:55] else [8/4/2015 0:42:55] local article = getItemAttribute(v.uid, 'article') or k.article [8/4/2015 0:42:55] s = (article == '' and '' or article .. ' ') .. k.name [8/4/2015 0:42:55] end [8/4/2015 0:42:55] ret = ret .. (i == 0 and not sep and '' or ', ') .. s [8/4/2015 0:42:55] if( isContainer(v.uid) and getContainerSize(v.uid) ~= 0 )then [8/4/2015 0:42:55] table.insert(containers, v.uid) [8/4/2015 0:42:55] end [8/4/2015 0:42:55] else [8/4/2015 0:42:55] ret = ret .. (i == 0 and not sep and '' or ', ') .. 'an item of type ' .. v.itemid .. ', please report it to gamemaster' [8/4/2015 0:42:55] end [8/4/2015 0:42:55] i = i + 1 [8/4/2015 0:42:55] end [8/4/2015 0:42:55] for i = 1, #containers do [8/4/2015 0:42:55] ret = ret .. getContentDescription(containers[i], true) [8/4/2015 0:42:55] end [8/4/2015 0:42:55] return ret [8/4/2015 0:42:55] end [8/4/2015 0:42:55] [8/4/2015 0:42:55] local function send(cid, corpse, monster) [8/4/2015 0:42:55] if( isPlayer(cid) )then [8/4/2015 0:42:55] local ret = corpse and isContainer(corpse) and getContentDescription(corpse) [8/4/2015 0:42:55] doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing')) [8/4/2015 0:42:55] local party = getPlayerParty(cid) [8/4/2015 0:42:55] if( party )then [8/4/2015 0:42:55] for _, pid in ipairs(getPartyMembers(party)) do [8/4/2015 0:42:55] doPlayerSendChannelMessage(pid, '', 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing'), TALKTYPE_CHANNEL_W, CHANNEL_PARTY) [8/4/2015 0:42:55] end [8/4/2015 0:42:55] end [8/4/2015 0:42:55] end [8/4/2015 0:42:55] end [8/4/2015 0:42:56] [8/4/2015 0:42:56] local function createLoot(i, ext) [8/4/2015 0:42:56] local item = type(i.id) == 'table' and i.id[math.random(#i.id)] or i.id [8/4/2015 0:42:56] local random = math.ceil(math.random(100000) / ext) [8/4/2015 0:42:56] local tmpItem, f [8/4/2015 0:42:56] [8/4/2015 0:42:56] if( random < i.chance )then [8/4/2015 0:42:56] if i.subType == -1 then [8/4/2015 0:42:56] f = getItemInfo(item) [8/4/2015 0:42:56] end [8/4/2015 0:42:56] tmpItem = doCreateItemEx(item, [8/4/2015 0:42:56] i.subType ~= -1 and i.subType or [8/4/2015 0:42:56] f.stackable and random % i.count + 1 or [8/4/2015 0:42:56] f.charges ~= 0 and f.charges or [8/4/2015 0:42:56] 1 [8/4/2015 0:42:56] ) [8/4/2015 0:42:56] end [8/4/2015 0:42:56] [8/4/2015 0:42:56] if( not tmpItem )then [8/4/2015 0:42:56] return [8/4/2015 0:42:56] end [8/4/2015 0:42:56] [8/4/2015 0:42:56] if( i.actionId ~= -1 )then [8/4/2015 0:42:56] doItemSetAttribute(tmpItem, 'aid', i.actionId) [8/4/2015 0:42:56] end [8/4/2015 0:42:56] [8/4/2015 0:42:56] if( i.uniqueId ~= -1 )then [8/4/2015 0:42:56] doItemSetAttribute(tmpItem, 'uid', i.uniqueId) [8/4/2015 0:42:56] end [8/4/2015 0:42:56] [8/4/2015 0:42:56] if( i.text ~= '' )then [8/4/2015 0:42:56] doItemSetAttribute(tmpItem, 'text', i.text) [8/4/2015 0:42:56] end [8/4/2015 0:42:56] [8/4/2015 0:42:56] local ret, done [8/4/2015 0:42:56] [8/4/2015 0:42:56] for k, v in pairs(tiers) do [8/4/2015 0:42:56] local cur, used = {}, {} [8/4/2015 0:42:56] for i = 1, #v.chance do [8/4/2015 0:42:56] if( math.random(100000) <= v.chance[i] )then [8/4/2015 0:42:56] if( f )then [8/4/2015 0:42:56] f = getItemInfo(item) [8/4/2015 0:42:56] end [8/4/2015 0:42:56] if( not f.stackable )then [8/4/2015 0:42:56] for m, n in pairs(attr) do [8/4/2015 0:42:56] if( not table.find(used, m) and [8/4/2015 0:42:56] ( [8/4/2015 0:42:56] ( table.find(n.types, MELEE) and table.find({WEAPON_SWORD, WEAPON_CLUB, WEAPON_AXE}, f.weaponType) ) or [8/4/2015 0:42:56] ( table.find(n.types, DISTANCE) and f.weaponType == WEAPON_DIST and f.ammoType ~= 0 ) or [8/4/2015 0:42:56] ( table.find(n.types, ARMOR) and f.armor ~= 0 and f.wieldPosition ~= CONST_SLOT_NECKLACE ) or [8/4/2015 0:42:56] ( table.find(n.types, SHIELD) and f.defense ~= 0 and f.weaponType == WEAPON_SHIELD ) or [8/4/2015 0:42:56] ( table.find(n.types, WAND) and f.weaponType == WEAPON_WAND ) or [8/4/2015 0:42:56] ( table.find(n.types, DURATION_RING) and f.wieldPosition == CONST_SLOT_RING and f.transformEquipTo ~= 0 ) or [8/4/2015 0:42:56] ( table.find(n.types, CHARGES) and table.find({CONST_SLOT_RING, CONST_SLOT_NECKLACE}, f.wieldPosition) and f.charges ~= 0 ) [8/4/2015 0:42:56] ) )then [8/4/2015 0:42:56] table.insert(cur, m) [8/4/2015 0:42:56] end [8/4/2015 0:42:56] end [8/4/2015 0:42:56] [8/4/2015 0:42:56] if( #cur ~= 0 )then [8/4/2015 0:42:56] local n = cur[math.random(#cur)] [8/4/2015 0:42:56] table.insert(used, n) [8/4/2015 0:42:56] [8/4/2015 0:42:56] n = attr[n] [8/4/2015 0:42:56] local percent, new, tmp = math.random(n.percent[1] + (v.extra[1] or 0), n.percent[2] + (v.extra[2] or 0)) [8/4/2015 0:42:56] -- hacks [8/4/2015 0:42:56] if( n.attr == 'duration' )then [8/4/2015 0:42:56] tmp = getItemInfo(f.transformEquipTo) [8/4/2015 0:42:56] if tmp.transformDeEquipTo ~= item then [8/4/2015 0:42:56] break [8/4/2015 0:42:56] end [8/4/2015 0:42:56] new = round( tmp.decayTime * (1 + percent / 100) * 1000 ) [8/4/2015 0:42:57] elseif( n.attr == 'attackSpeed' )then [8/4/2015 0:42:57] new = round( vocation_base_attackspeed / (1 + percent / 100) ) [8/4/2015 0:42:57] elseif( n.attr == 'hitChance' ) then [8/4/2015 0:42:57] new = round( [8/4/2015 0:42:57] f.hitChance == -1 and [8/4/2015 0:42:57] percent [8/4/2015 0:42:57] or [8/4/2015 0:42:57] f.hitChance * (1 + percent / 100) [8/4/2015 0:42:57] ) [8/4/2015 0:42:57] else [8/4/2015 0:42:57] new = round( [8/4/2015 0:42:57] n.base and [8/4/2015 0:42:57] f[n['attr']] + f[n['base']] * (percent / 100) [8/4/2015 0:42:57] or [8/4/2015 0:42:57] f[n['attr']] * (1 + percent / 100) [8/4/2015 0:42:57] ) [8/4/2015 0:42:57] [8/4/2015 0:42:57] if( new == f[n[n.base and 'base' or 'attr']] )then -- no improvement [8/4/2015 0:42:57] break [8/4/2015 0:42:57] end [8/4/2015 0:42:57] end [8/4/2015 0:42:57] [8/4/2015 0:42:57] doItemSetAttribute(tmpItem, n.attr:lower(), new) [8/4/2015 0:42:57] [8/4/2015 0:42:57] local name = getItemAttribute(tmpItem, 'name') [8/4/2015 0:42:57] if( v.attrNames or not name )then [8/4/2015 0:42:57] local name = (v.attrNames and used[#used] or k) .. ' ' .. (name or f.name) [8/4/2015 0:42:57] doItemSetAttribute(tmpItem, 'name', name) [8/4/2015 0:42:57] [8/4/2015 0:42:57] if( f.article ~= '' )then [8/4/2015 0:42:57] local article = getArticle(name) [8/4/2015 0:42:57] if( article ~= f.article )then [8/4/2015 0:42:57] doItemSetAttribute(tmpItem, 'article', article) [8/4/2015 0:42:57] end [8/4/2015 0:42:57] end [8/4/2015 0:42:57] end [8/4/2015 0:42:57] [8/4/2015 0:42:57] local desc = getItemAttribute(tmpItem, 'description') or f.description [8/4/2015 0:42:57] doItemSetAttribute(tmpItem, 'description', '[' .. n.name .. ': +' .. percent .. '%]' .. (desc == '' and '' or '\n' .. desc)) [8/4/2015 0:42:57] [8/4/2015 0:42:57] ret = k [8/4/2015 0:42:57] end [8/4/2015 0:42:57] cur = {} [8/4/2015 0:42:57] if( #v.chance == i )then [8/4/2015 0:42:57] done = true [8/4/2015 0:42:57] end [8/4/2015 0:42:57] end [8/4/2015 0:42:57] else [8/4/2015 0:42:57] done = i ~= 1 [8/4/2015 0:42:57] break [8/4/2015 0:42:57] end [8/4/2015 0:42:57] end [8/4/2015 0:42:57] if( done )then [8/4/2015 0:42:57] break [8/4/2015 0:42:57] end [8/4/2015 0:42:57] end [8/4/2015 0:42:57] [8/4/2015 0:42:58] return tmpItem, ret [8/4/2015 0:42:58] end [8/4/2015 0:42:58] [8/4/2015 0:42:58] local function createChildLoot(parent, i, ext, pos) [8/4/2015 0:42:58] if( not i or #i == 0 )then [8/4/2015 0:42:58] return true [8/4/2015 0:42:58] end [8/4/2015 0:42:58] [8/4/2015 0:42:58] local size, cap = 0, getContainerCap(parent) [8/4/2015 0:42:58] for k = 1, #i do [8/4/2015 0:42:58] if( size == cap )then [8/4/2015 0:42:58] break [8/4/2015 0:42:58] end [8/4/2015 0:42:58] local tmp, ret = createLoot(i[k], ext) [8/4/2015 0:42:58] if( tmp )then [8/4/2015 0:42:58] if( isContainer(tmp) )then [8/4/2015 0:42:58] if( createChildLoot(tmp, i[k].child, ext, pos) )then [8/4/2015 0:42:58] doAddContainerItemEx(parent, tmp) [8/4/2015 0:42:58] size = size + 1 [8/4/2015 0:42:58] else [8/4/2015 0:42:58] doRemoveItem(tmp) [8/4/2015 0:42:58] end [8/4/2015 0:42:58] else [8/4/2015 0:42:58] if( ret )then [8/4/2015 0:42:58] doSendMagicEffect(pos, CONST_ME_MAGIC_GREEN) [8/4/2015 0:42:58] doSendAnimatedText(pos, ret:upper(), tiers[ret].color) [8/4/2015 0:42:58] end [8/4/2015 0:42:58] doAddContainerItemEx(parent, tmp) [8/4/2015 0:42:58] size = size + 1 [8/4/2015 0:42:58] end [8/4/2015 0:42:58] end [8/4/2015 0:42:58] end [8/4/2015 0:42:58] [8/4/2015 0:42:58] return size > 0 [8/4/2015 0:42:58] end [8/4/2015 0:42:58] [8/4/2015 0:42:58] local function dropLoot(pos, v, ext, master, cid, target) [8/4/2015 0:42:58] local corpse [8/4/2015 0:42:58] if( not master or master == target )then -- 0.3/4 [8/4/2015 0:42:58] corpse = getTileItemById(pos, v.lookCorpse).uid [8/4/2015 0:42:58] if( isContainer(corpse) )then [8/4/2015 0:42:58] for i = 1, getContainerSize(corpse) do [8/4/2015 0:42:58] doRemoveItem(getContainerItem(corpse, 0).uid) [8/4/2015 0:42:58] end [8/4/2015 0:42:58] local size, cap = 0, getContainerCap(corpse) [8/4/2015 0:42:58] for i = 1, #v.loot do [8/4/2015 0:42:58] if( size == cap )then [8/4/2015 0:42:58] break [8/4/2015 0:42:58] end [8/4/2015 0:42:58] local tmp, ret = createLoot(v.loot[i], ext) [8/4/2015 0:42:58] if( tmp )then [8/4/2015 0:42:58] if( isContainer(tmp) )then [8/4/2015 0:42:58] if( createChildLoot(tmp, v.loot[i].child, ext, pos) )then [8/4/2015 0:42:59] doAddContainerItemEx(corpse, tmp) [8/4/2015 0:42:59] size = size + 1 [8/4/2015 0:42:59] else [8/4/2015 0:42:59] doRemoveItem(tmp) [8/4/2015 0:42:59] end [8/4/2015 0:42:59] else [8/4/2015 0:42:59] if( ret )then [8/4/2015 0:42:59] doSendMagicEffect(pos, CONST_ME_MAGIC_GREEN) [8/4/2015 0:42:59] doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Item raro!") [8/4/2015 0:42:59] --doSendAnimatedText(pos, ret:upper(), tiers[ret].color) [8/4/2015 0:42:59] end [8/4/2015 0:42:59] doAddContainerItemEx(corpse, tmp) [8/4/2015 0:42:59] size = size + 1 [8/4/2015 0:42:59] end [8/4/2015 0:42:59] end [8/4/2015 0:42:59] end [8/4/2015 0:42:59] end [8/4/2015 0:42:59] end [8/4/2015 0:42:59] send(cid, corpse, v.description) [8/4/2015 0:42:59] end [8/4/2015 0:42:59] [8/4/2015 0:42:59] function onKill(cid, target, damage, flags) [8/4/2015 0:42:59] if( (damage == true or bit.band(flags, 1) == 1) and isMonster(target) )then -- 0.3/4 [8/4/2015 0:42:59] local creature = getCreatureName(target) [8/4/2015 0:42:59] if(creature ~= nil and creature ~= '') then [8/4/2015 0:42:59] local v = getMonsterInfo(creature) [8/4/2015 0:42:59] if( v and v.lookCorpse ~= 0 )then [8/4/2015 0:42:59] local s = getCreatureStorage(cid, extra_loot_key) [8/4/2015 0:42:59] addEvent(dropLoot, 0, getThingPos(target), v, s == -1 and rate or s, getCreatureMaster(target), cid, target) [8/4/2015 0:42:59] end [8/4/2015 0:42:59] [8/4/2015 0:42:59] end [8/4/2015 0:42:59] end [8/4/2015 0:42:59] return true [8/4/2015 0:42:59] end [8/4/2015 0:42:59] :onKill [8/4/2015 0:42:59] Description: [8/4/2015 0:42:59] [string "LuaInterface::loadBuffer"]:59: attempt to index local 'f' (a boolean value) [8/4/2015 0:42:59] stack traceback: [8/4/2015 0:42:59] [string "LuaInterface::loadBuffer"]:59: in function 'createLoot' [8/4/2015 0:42:59] [string "LuaInterface::loadBuffer"]:225: in function <[string "LuaInterface::loadBuffer"]:212> [8/4/2015 0:43:27] > Broadcasted message: "[Blood Castle] O jogador ADM Leandro derrotou o Guarda do Portao! Prossigam para proxima sala e aguardem ate o arcanjo nascer!". [8/4/2015 0:43:40] [Error - CreatureScript Interface] [8/4/2015 0:43:40] In a timer event called from: [8/4/2015 0:43:40] domodlib('itemstats_conf') [8/4/2015 0:43:40] [8/4/2015 0:43:40] function round(n, s) [8/4/2015 0:43:40] return tonumber(('%.' .. (s or 0) .. 'f'):format(n)) [8/4/2015 0:43:40] end [8/4/2015 0:43:40] [8/4/2015 0:43:40] function getContentDescription(uid, sep) [8/4/2015 0:43:40] local ret, i, containers = '', 0, {} [8/4/2015 0:43:40] while( i < getContainerSize(uid) )do [8/4/2015 0:43:40] local v, s = getContainerItem(uid, i), '' [8/4/2015 0:43:40] local k = getItemInfo(v.itemid) [8/4/2015 0:43:40] k.name = getItemAttribute(v.uid, 'name') or k.name [8/4/2015 0:43:40] if( k.name ~= '' )then [8/4/2015 0:43:40] if( v.type > 1 and k.stackable and k.showCount )then [8/4/2015 0:43:40] s = v.type .. ' ' .. k.plural [8/4/2015 0:43:40] else [8/4/2015 0:43:40] local article = getItemAttribute(v.uid, 'article') or k.article [8/4/2015 0:43:40] s = (article == '' and '' or article .. ' ') .. k.name [8/4/2015 0:43:40] end [8/4/2015 0:43:40] ret = ret .. (i == 0 and not sep and '' or ', ') .. s [8/4/2015 0:43:40] if( isContainer(v.uid) and getContainerSize(v.uid) ~= 0 )then [8/4/2015 0:43:40] table.insert(containers, v.uid) [8/4/2015 0:43:40] end [8/4/2015 0:43:40] else [8/4/2015 0:43:40] ret = ret .. (i == 0 and not sep and '' or ', ') .. 'an item of type ' .. v.itemid .. ', please report it to gamemaster' [8/4/2015 0:43:40] end [8/4/2015 0:43:40] i = i + 1 [8/4/2015 0:43:40] end [8/4/2015 0:43:40] for i = 1, #containers do [8/4/2015 0:43:40] ret = ret .. getContentDescription(containers[i], true) [8/4/2015 0:43:40] end [8/4/2015 0:43:40] return ret [8/4/2015 0:43:41] end [8/4/2015 0:43:41] [8/4/2015 0:43:41] local function send(cid, corpse, monster) [8/4/2015 0:43:41] if( isPlayer(cid) )then [8/4/2015 0:43:41] local ret = corpse and isContainer(corpse) and getContentDescription(corpse) [8/4/2015 0:43:41] doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing')) [8/4/2015 0:43:41] local party = getPlayerParty(cid) [8/4/2015 0:43:41] if( party )then [8/4/2015 0:43:41] for _, pid in ipairs(getPartyMembers(party)) do [8/4/2015 0:43:41] doPlayerSendChannelMessage(pid, '', 'Loot of ' .. monster .. ': ' .. (ret ~= '' and ret or 'nothing'), TALKTYPE_CHANNEL_W, CHANNEL_PARTY) [8/4/2015 0:43:41] end [8/4/2015 0:43:41] end [8/4/2015 0:43:41] end [8/4/2015 0:43:41] end [8/4/2015 0:43:41] [8/4/2015 0:43:41] local function createLoot(i, ext) [8/4/2015 0:43:41] local item = type(i.id) == 'table' and i.id[math.random(#i.id)] or i.id [8/4/2015 0:43:41] local random = math.ceil(math.random(100000) / ext) [8/4/2015 0:43:41] local tmpItem, f [8/4/2015 0:43:41] [8/4/2015 0:43:41] if( random < i.chance )then [8/4/2015 0:43:41] if i.subType == -1 then [8/4/2015 0:43:41] f = getItemInfo(item) [8/4/2015 0:43:41] end [8/4/2015 0:43:41] tmpItem = doCreateItemEx(item, [8/4/2015 0:43:41] i.subType ~= -1 and i.subType or [8/4/2015 0:43:41] f.stackable and random % i.count + 1 or [8/4/2015 0:43:41] f.charges ~= 0 and f.charges or [8/4/2015 0:43:41] 1 [8/4/2015 0:43:41] ) [8/4/2015 0:43:41] end [8/4/2015 0:43:41] [8/4/2015 0:43:41] if( not tmpItem )then [8/4/2015 0:43:41] return [8/4/2015 0:43:41] end [8/4/2015 0:43:41] [8/4/2015 0:43:41] if( i.actionId ~= -1 )then [8/4/2015 0:43:41] doItemSetAttribute(tmpItem, 'aid', i.actionId) [8/4/2015 0:43:41] end [8/4/2015 0:43:41] [8/4/2015 0:43:41] if( i.uniqueId ~= -1 )then [8/4/2015 0:43:41] doItemSetAttribute(tmpItem, 'uid', i.uniqueId) [8/4/2015 0:43:42] end [8/4/2015 0:43:42] [8/4/2015 0:43:42] if( i.text ~= '' )then [8/4/2015 0:43:42] doItemSetAttribute(tmpItem, 'text', i.text) [8/4/2015 0:43:42] end [8/4/2015 0:43:42] [8/4/2015 0:43:42] local ret, done [8/4/2015 0:43:42] [8/4/2015 0:43:42] for k, v in pairs(tiers) do [8/4/2015 0:43:42] local cur, used = {}, {} [8/4/2015 0:43:42] for i = 1, #v.chance do [8/4/2015 0:43:42] if( math.random(100000) <= v.chance[i] )then [8/4/2015 0:43:42] if( f )then [8/4/2015 0:43:42] f = getItemInfo(item) [8/4/2015 0:43:42] end [8/4/2015 0:43:42] if( not f.stackable )then [8/4/2015 0:43:42] for m, n in pairs(attr) do [8/4/2015 0:43:42] if( not table.find(used, m) and [8/4/2015 0:43:42] ( [8/4/2015 0:43:42] ( table.find(n.types, MELEE) and table.find({WEAPON_SWORD, WEAPON_CLUB, WEAPON_AXE}, f.weaponType) ) or [8/4/2015 0:43:42] ( table.find(n.types, DISTANCE) and f.weaponType == WEAPON_DIST and f.ammoType ~= 0 ) or [8/4/2015 0:43:42] ( table.find(n.types, ARMOR) and f.armor ~= 0 and f.wieldPosition ~= CONST_SLOT_NECKLACE ) or [8/4/2015 0:43:42] ( table.find(n.types, SHIELD) and f.defense ~= 0 and f.weaponType == WEAPON_SHIELD ) or [8/4/2015 0:43:42] ( table.find(n.types, WAND) and f.weaponType == WEAPON_WAND ) or [8/4/2015 0:43:42] ( table.find(n.types, DURATION_RING) and f.wieldPosition == CONST_SLOT_RING and f.transformEquipTo ~= 0 ) or [8/4/2015 0:43:42] ( table.find(n.types, CHARGES) and table.find({CONST_SLOT_RING, CONST_SLOT_NECKLACE}, f.wieldPosition) and f.charges ~= 0 ) [8/4/2015 0:43:42] ) )then [8/4/2015 0:43:42] table.insert(cur, m) [8/4/2015 0:43:42] end [8/4/2015 0:43:42] end [8/4/2015 0:43:42] [8/4/2015 0:43:42] if( #cur ~= 0 )then [8/4/2015 0:43:42] local n = cur[math.random(#cur)] [8/4/2015 0:43:42] table.insert(used, n) [8/4/2015 0:43:42] [8/4/2015 0:43:42] n = attr[n] [8/4/2015 0:43:42] local percent, new, tmp = math.random(n.percent[1] + (v.extra[1] or 0), n.percent[2] + (v.extra[2] or 0)) [8/4/2015 0:43:42] -- hacks [8/4/2015 0:43:42] if( n.attr == 'duration' )then [8/4/2015 0:43:43] tmp = getItemInfo(f.transformEquipTo) [8/4/2015 0:43:43] if tmp.transformDeEquipTo ~= item then [8/4/2015 0:43:43] break [8/4/2015 0:43:43] end [8/4/2015 0:43:43] new = round( tmp.decayTime * (1 + percent / 100) * 1000 ) [8/4/2015 0:43:43] elseif( n.attr == 'attackSpeed' )then [8/4/2015 0:43:43] new = round( vocation_base_attackspeed / (1 + percent / 100) ) [8/4/2015 0:43:43] elseif( n.attr == 'hitChance' ) then [8/4/2015 0:43:43] new = round( [8/4/2015 0:43:43] f.hitChance == -1 and [8/4/2015 0:43:43] percent [8/4/2015 0:43:43] or [8/4/2015 0:43:43] f.hitChance * (1 + percent / 100) [8/4/2015 0:43:43] ) [8/4/2015 0:43:43] else [8/4/2015 0:43:43] new = round( [8/4/2015 0:43:43] n.base and [8/4/2015 0:43:43] f[n['attr']] + f[n['base']] * (percent / 100) [8/4/2015 0:43:43] or [8/4/2015 0:43:43] f[n['attr']] * (1 + percent / 100) [8/4/2015 0:43:43] ) [8/4/2015 0:43:43] [8/4/2015 0:43:43] if( new == f[n[n.base and 'base' or 'attr']] )then -- no improvement [8/4/2015 0:43:43] break [8/4/2015 0:43:43] end [8/4/2015 0:43:43] end [8/4/2015 0:43:43] [8/4/2015 0:43:43] doItemSetAttribute(tmpItem, n.attr:lower(), new) [8/4/2015 0:43:43] [8/4/2015 0:43:43] local name = getItemAttribute(tmpItem, 'name') [8/4/2015 0:43:43] if( v.attrNames or not name )then [8/4/2015 0:43:43] local name = (v.attrNames and used[#used] or k) .. ' ' .. (name or f.name) [8/4/2015 0:43:43] doItemSetAttribute(tmpItem, 'name', name) [8/4/2015 0:43:43] [8/4/2015 0:43:43] if( f.article ~= '' )then [8/4/2015 0:43:43] local article = getArticle(name) [8/4/2015 0:43:44] if( article ~= f.article )then [8/4/2015 0:43:44] doItemSetAttribute(tmpItem, 'article', article) [8/4/2015 0:43:44] end [8/4/2015 0:43:44] end [8/4/2015 0:43:44] end [8/4/2015 0:43:44] [8/4/2015 0:43:44] local desc = getItemAttribute(tmpItem, 'description') or f.description [8/4/2015 0:43:44] doItemSetAttribute(tmpItem, 'description', '[' .. n.name .. ': +' .. percent .. '%]' .. (desc == '' and '' or '\n' .. desc)) [8/4/2015 0:43:44] [8/4/2015 0:43:44] ret = k [8/4/2015 0:43:44] end [8/4/2015 0:43:44] cur = {} [8/4/2015 0:43:44] if( #v.chance == i )then [8/4/2015 0:43:44] done = true [8/4/2015 0:43:44] end [8/4/2015 0:43:44] end [8/4/2015 0:43:44] else [8/4/2015 0:43:44] done = i ~= 1 [8/4/2015 0:43:44] break [8/4/2015 0:43:44] end [8/4/2015 0:43:44] end [8/4/2015 0:43:44] if( done )then [8/4/2015 0:43:44] break [8/4/2015 0:43:44] end [8/4/2015 0:43:44] end [8/4/2015 0:43:44] [8/4/2015 0:43:44] return tmpItem, ret [8/4/2015 0:43:44] end [8/4/2015 0:43:44] [8/4/2015 0:43:44] local function createChildLoot(parent, i, ext, pos) [8/4/2015 0:43:44] if( not i or #i == 0 )then [8/4/2015 0:43:44] return true [8/4/2015 0:43:44] end [8/4/2015 0:43:44] [8/4/2015 0:43:45] local size, cap = 0, getContainerCap(parent) [8/4/2015 0:43:45] for k = 1, #i do [8/4/2015 0:43:45] if( size == cap )then [8/4/2015 0:43:45] break [8/4/2015 0:43:45] end [8/4/2015 0:43:45] local tmp, ret = createLoot(i[k], ext) [8/4/2015 0:43:45] if( tmp )then [8/4/2015 0:43:45] if( isContainer(tmp) )then [8/4/2015 0:43:45] if( createChildLoot(tmp, i[k].child, ext, pos) )then [8/4/2015 0:43:45] doAddContainerItemEx(parent, tmp) [8/4/2015 0:43:45] size = size + 1 [8/4/2015 0:43:45] else [8/4/2015 0:43:45] doRemoveItem(tmp) [8/4/2015 0:43:45] end [8/4/2015 0:43:45] else [8/4/2015 0:43:45] if( ret )then [8/4/2015 0:43:45] doSendMagicEffect(pos, CONST_ME_MAGIC_GREEN) [8/4/2015 0:43:45] doSendAnimatedText(pos, ret:upper(), tiers[ret].color) [8/4/2015 0:43:45] end [8/4/2015 0:43:45] doAddContainerItemEx(parent, tmp) [8/4/2015 0:43:45] size = size + 1 [8/4/2015 0:43:45] end [8/4/2015 0:43:45] end [8/4/2015 0:43:45] end [8/4/2015 0:43:45] [8/4/2015 0:43:45] return size > 0 [8/4/2015 0:43:45] end [8/4/2015 0:43:45] [8/4/2015 0:43:45] local function dropLoot(pos, v, ext, master, cid, target) [8/4/2015 0:43:45] local corpse [8/4/2015 0:43:45] if( not master or master == target )then -- 0.3/4 [8/4/2015 0:43:45] corpse = getTileItemById(pos, v.lookCorpse).uid [8/4/2015 0:43:45] if( isContainer(corpse) )then [8/4/2015 0:43:46] for i = 1, getContainerSize(corpse) do [8/4/2015 0:43:46] doRemoveItem(getContainerItem(corpse, 0).uid) [8/4/2015 0:43:46] end [8/4/2015 0:43:46] local size, cap = 0, getContainerCap(corpse) [8/4/2015 0:43:46] for i = 1, #v.loot do [8/4/2015 0:43:46] if( size == cap )then [8/4/2015 0:43:46] break [8/4/2015 0:43:46] end [8/4/2015 0:43:46] local tmp, ret = createLoot(v.loot[i], ext) [8/4/2015 0:43:46] if( tmp )then [8/4/2015 0:43:46] if( isContainer(tmp) )then [8/4/2015 0:43:46] if( createChildLoot(tmp, v.loot[i].child, ext, pos) )then [8/4/2015 0:43:46] doAddContainerItemEx(corpse, tmp) [8/4/2015 0:43:46] size = size + 1 [8/4/2015 0:43:46] else [8/4/2015 0:43:46] doRemoveItem(tmp) [8/4/2015 0:43:46] end [8/4/2015 0:43:46] else [8/4/2015 0:43:46] if( ret )then [8/4/2015 0:43:46] doSendMagicEffect(pos, CONST_ME_MAGIC_GREEN) [8/4/2015 0:43:46] doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Item raro!") [8/4/2015 0:43:46] --doSendAnimatedText(pos, ret:upper(), tiers[ret].color) [8/4/2015 0:43:46] end [8/4/2015 0:43:46] doAddContainerItemEx(corpse, tmp) [8/4/2015 0:43:46] size = size + 1 [8/4/2015 0:43:46] end [8/4/2015 0:43:46] end [8/4/2015 0:43:46] end [8/4/2015 0:43:46] end [8/4/2015 0:43:46] end [8/4/2015 0:43:46] send(cid, corpse, v.description) [8/4/2015 0:43:46] end [8/4/2015 0:43:47] [8/4/2015 0:43:47] function onKill(cid, target, damage, flags) [8/4/2015 0:43:47] if( (damage == true or bit.band(flags, 1) == 1) and isMonster(target) )then -- 0.3/4 [8/4/2015 0:43:47] local creature = getCreatureName(target) [8/4/2015 0:43:47] if(creature ~= nil and creature ~= '') then [8/4/2015 0:43:47] local v = getMonsterInfo(creature) [8/4/2015 0:43:47] if( v and v.lookCorpse ~= 0 )then [8/4/2015 0:43:47] local s = getCreatureStorage(cid, extra_loot_key) [8/4/2015 0:43:47] addEvent(dropLoot, 0, getThingPos(target), v, s == -1 and rate or s, getCreatureMaster(target), cid, target) [8/4/2015 0:43:47] end [8/4/2015 0:43:47] [8/4/2015 0:43:47] end [8/4/2015 0:43:47] end [8/4/2015 0:43:47] return true [8/4/2015 0:43:47] end [8/4/2015 0:43:47] :onKill [8/4/2015 0:43:47] Description: [8/4/2015 0:43:47] [string "LuaInterface::loadBuffer"]:59: attempt to index local 'f' (a boolean value) [8/4/2015 0:43:47] stack traceback: [8/4/2015 0:43:47] [string "LuaInterface::loadBuffer"]:59: in function 'createLoot' [8/4/2015 0:43:47] [string "LuaInterface::loadBuffer"]:225: in function <[string "LuaInterface::loadBuffer"]:212> up I like
Postado Abril 8, 2015 10 anos mostre o erro no distro amigo Precisa de ajuda? Poste a versão de seu TFS. ************************************************************************************************************* Servidores? Eu indico: Use o cupom TIBIAKING e receba 50% de desconto na primeira mensalidade! Pague menos de R$ 19,00 no primeiro mês!
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.