• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ getItemAttribute error

alcapone

Member
Joined
Jan 13, 2021
Messages
246
Reaction score
19
Lua:
local teste = Action()
 
function teste.onUse(cid, item, fromPosition, itemEx, toPosition)
    if itemEx.itemid == 9957 then
        local torch_storage, torch_monsters = Event_Lightbearer.getTorchInfo(toPosition)
        if not (getPlayerStorageValue(cid, torch_storage) == 1) then
    
            for _, monsterName in ipairs(Lightbearer_Configurations.Torchs[getItemAttribute(itemEx.uid, 9957)].monsters) do
                doCreateMonster(monsterName, getThingPos(cid))
            end
            doRemoveItem(itemEx.uid)
            addEvent(Event_Lightbearer.spawnMonster, 60 * 1000, getThingPos(cid), cid, torch_monsters)
        else
            doPlayerSendCancel(cid, "Voce ja acendeu esta tocha, procure outras.")
        end
    end
    return true
end
 
teste:id(9956)
teste:register()



Lua:
Lua Script Error: [Scripts Interface]
  magical_torch.lua:callback
 magical_torch.lua:15: attempt to call global 'getItemAttribute' (a nil value)
  stack traceback:
   [C]: in function 'getItemAttribute'
  magical_torch.lua:15: in function <...ata/scripts/eventos_global/Lightbearer/magical_torch.lua:4>

when you use the item you would have to summon the mob but it is returning this error




LIB
Lua:
    Torchs = {
        {pos = {x = 33015, y = 32383, z = 1}, monsters = {"rat"}, storage= 23097},
 
   
    },
 
Last edited:
Back
Top