johnsamir
Advanced OT User
Have certain npcs with problem like for example dermot. the npc work
but when i try to get the key this error appear in the server console
the strange part is this error
when i go to that line at dermot.lua is this:
npcHandler:say work on the other npcs so is a little strange
and many other npcs does work with the same lua structure, as boat npc, or magicshop too and they are working as stated before.
this is full dermot.lua
Edit:
changed
for this
same error
any idea? why table index is nil
but when i try to get the key this error appear in the server console
Lua:
Lua Script Error: [Npc interface]
data/npc/scripts/Dermot.lua:onCreatureSay
data/npc/scripts/lib/npcsystem/npchandler.lua:642: table index is nil
stack traceback:
[C]: in function '__newindex'
data/npc/scripts/lib/npcsystem/npchandler.lua:642: in function 'say'
data/npc/scripts/Dermot.lua:56: in function 'callback'
data/npc/scripts/lib/npcsystem/npchandler.lua:420: in function 'onCreatureSay'
data/npc/scripts/Dermot.lua:8: in function <data/npc/scripts/Dermot.lua:8>
Lua Script Error: [Npc interface]
data/npc/scripts/Dermot.lua:onCreatureSay
data/npc/scripts/lib/npcsystem/npchandler.lua:642: table index is nil
stack traceback:
[C]: in function '__newindex'
data/npc/scripts/lib/npcsystem/npchandler.lua:642: in function 'say'
data/npc/scripts/Dermot.lua:56: in function 'callback'
data/npc/scripts/lib/npcsystem/npchandler.lua:420: in function 'onCreatureSay'
data/npc/scripts/Dermot.lua:8: in function <data/npc/scripts/Dermot.lua:8>
Code:
data/npc/scripts/Dermot.lua:56: in function 'callback'
Code:
npcHandler:say('Do you want to buy the dungeon key for 2000 gold?')
npcHandler:say work on the other npcs so is a little strange
and many other npcs does work with the same lua structure, as boat npc, or magicshop too and they are working as stated before.
this is full dermot.lua
Code:
-- NPC Converter System - developed by Utroz <[email protected]>
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the magistrate of this isle.'})
keywordHandler:addKeyword({'entrance'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'The entrance is near here.'})
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
-- The Postman Missions Quest
if msgcontains(msg, 'present') and getPlayerStorageValue(cid, 231) == 0 then
npcHandler:say('I don\'t understand what you are talking about.')
topic = 0
elseif msgcontains(msg, 'present') and getPlayerStorageValue(cid, 231) == 1 then
npcHandler:say('You have a present for me?? Really?')
topic = 2
elseif msgcontains(msg, 'yes') and getPlayerItemCount(cid, 2331) >= 1 and topic == 2 then
doPlayerRemoveItem(cid,2331,1)
setPlayerStorageValue(cid,231,2)
npcHandler:say('Thank you very much!')
topic = 0
elseif msgcontains(msg, 'yes') and topic == 2 then
npcHandler:say('What? There is no present, at least none for me! Stop this foolish jokes!')
topic = 0
elseif msgcontains(msg, '') and topic == 2 then
npcHandler:say('Hmm, maybe next time.')
topic = 0
elseif msgcontains(msg, 'key') then
npcHandler:say('Do you want to buy the dungeon key for 2000 gold?')
topic = 1
elseif msgcontains(msg, 'yes') and getPlayerMoney(cid) >= 2000 and topic == 1 then
npcHandler:say('Now you own the key to the dungeon.')
doPlayerRemoveMoney(cid, 2000)
key = doPlayerAddItem(cid, 2089,1)
doSetItemActionId(key,3940)
doSetItemSpecialDescription(key, "(Key: 3940)")
topic = 0
elseif msgcontains(msg, 'yes') and getPlayerMoney(cid) < 2000 and topic == 1 then
npcHandler:say('You\'ve not enough money to buy the key.')
topic = 0
elseif msgcontains(msg, '') and topic == 2 then
npcHandler:say('Hmm, maybe next time.')
topic = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Edit:
changed
Lua:
topic
Code:
npcHandler.topic[cid]
any idea? why table index is nil
Last edited: