• 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!

NPC console error

erikbs

Member
Joined
Jul 15, 2010
Messages
40
Reaction score
8
Hi the fellow OT`s.
Ive recently come over an issue with my NPCs, more exact the shop NPC`s.
I get this error in my console, and I cant seem to figure it out.


TFS 1.4.2
Client 10.98

Lua Script Error: [Npc interface]
data/npc/scripts/lars the hunter.lua:eek:nCreatureSay
LuaScriptInterface::getNumber(). Argument -1 has out-of-range value for unsigned int: -1
stack traceback:
[C]: in function 'openShopWindow'
data/npc/lib/npcsystem/modules.lua:1076: in function 'callback'
data/npc/lib/npcsystem/keywordhandler.lua:26: in function 'processMessage'
data/npc/lib/npcsystem/keywordhandler.lua:136: in function 'processNodeMessage'
data/npc/lib/npcsystem/keywordhandler.lua:111: in function 'processMessage'
data/npc/lib/npcsystem/npchandler.lua:408: in function 'onCreatureSay'
data/npc/scripts/lars the hunter.lua:7: in function <data/npc/scripts/lars the hunter.lua:7>

Anyone knows whats wrong?
Shall I post the scripts?

The shop works, its just annoying with the console error message.


- Erik
 
Hi

Error message a problem in the function openShopWindow

Try This

Lua:
function onCreatureSay(player, type, message)
    if type == TALKTYPE_PRIVATE and message:lower() == "open shop" then
        openShopWindow(player:getId(), 1)
        return true
    end
    return false
end

function openShopWindow(playerId, shopId)
    local player = Player(playerId)
    
    if player then
        local shop = Npc(shopId)
        
        if shop and shop:isShop() then
            player:openShopWindow(shop)
        else
            print("Error: Invalid shop ID or shop does not exist.")
        end
    else
        print("Error: Player does not exist.")
    end
end
 
Back
Top