Ir para conteúdo

Featured Replies

Postado
  • Solução

.Server: OTX 3.7

 

El bug ocurre al crear un LOOT, afecta levemente el funcionamiento aunque se mejoran la mayoría de los ítems. 

 

El error en la consola se ve así 

Citar

Lua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
data/creaturescripts/scripts/onkill_slot.lua:23: attempt to index local 'i_Ex' (a nil value)
stack traceback:
        [C]: in function '__index'
        data/creaturescripts/scripts/onkill_slot.lua:23: in function <data/creaturescripts/scripts/onkill_slot.lua:14>
 

 

Así es como está escrito el guión en sí.

function getper()
   local n = 1
   for i=1,10 do
     n = n+math.random(0,10)
     if n < 8*i then
       break
     end
   end
   return n
end
   
local lootable_slots = {'hp','mp','ml','melee','shield','dist'}

function assign_loot_Slot(pos)
   local c = Tile(pos):getTopDownItem()
   if c ~= nil then
     if c:isContainer() then
       local h = c:getItemHoldingCount()
       if h > 0 then
         for i = 1, h do
           local i_Ex = c:getItem(i - 1)
           local itemEx = {
             itemid = i_Ex:getId(),
             uid = i_Ex:getUniqueId()
           }
           
           if (isArmor(itemEx.uid) or isWeapon(itemEx.uid) or isShield(itemEx.uid)) and not isItemStackable(itemEx.uid) then
             if math.random(1,5) == 5 then
               if math.random(1, 100) <= 15 then
				   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Great loot.")
                 nam = Item(itemEx.uid):getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
                 nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
                 doSetItemSpecialDescription(itemEx.uid, nam)
                 if math.random(1, 100) <= 10 then
				   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Amazing loot.")
                   nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
                   doSetItemSpecialDescription(itemEx.uid, nam)
                   if math.random(1, 100) <= 5 then
				   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Good loot.")
                     nam = nam..' ['..lootable_slots[math.random(1, #lootable_slots)]..'.+'..getper()..'%]'
                     doSetItemSpecialDescription(itemEx.uid, nam)
                   end
                 end
               end
             end
           end
         end
         return true
       end
     end
   end
end

function onKill(cid, target, lastHit)
   if (not isSummon(target)) then
     addEvent(assign_loot_Slot, 2, getThingPos(target))
   end
return true
end


¡Muchas gracias por toda su ayuda y sugerencias!

 

Solution!
In line 22 add:
 

Citar

if i_Ex == nil then
       break
     end

 

Resolvido por eSvira

Ir para solução

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo