Guys, I have this NPC script[globalBoatNpc.lua]:
In game, when I say 'city1' or any other option the npc not responds and I have this error in console:
It's an error with jiddo's library version I'm using?
Thanks
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
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
-- OTServ event handling functions end
local travelNode = keywordHandler:addKeyword({'city1'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = True, Text = 'Do you wish To travel To city1 For 240 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 8, cost = 240, destination = {x=1839, y=1819, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'})
local travelNode = keywordHandler:addKeyword({'city2'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = True, Text = 'Do you wish To travel To city2 For 200 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 8, cost = 200, destination = {x=1214, y=1802, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'})
local travelNode = keywordHandler:addKeyword({'city3'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = True, Text = 'Do you wish To travel To city3 For 150 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 8, cost = 150, destination = {x=1509, y=1252, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'})
keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to City1 or city2 or city3 For just a small fee.'})
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
In game, when I say 'city1' or any other option the npc not responds and I have this error in console:
Lua Script Error: [Npc interface]
data/npc/scripts/globalBoatNpc.luanCreatureSay
data/npc/lib/npcsystem/npchandler.lua:301: bad argument #1 to 'gsub' (string expected, got nil)
stack traceback:
[C]: in function 'gsub'
data/npc/lib/npcsystem/npchandler.lua:301: in function 'parseMessage'
data/npc/lib/npcsystem/modules.lua:55: in function 'callback'
data/npc/lib/npcsystem/keywordhandler.lua:40: in function 'processMessage'
data/npc/lib/npcsystem/keywordhandler.lua:168: in function 'processNodeMessage'
data/npc/lib/npcsystem/keywordhandler.lua:128: in function 'processMessage'
data/npc/lib/npcsystem/npchandler.lua:381: in function 'onCreatureSay'
data/npc/scripts/globalBoatNpc.lua:10: in function <data/npc/scripts/globalBoatNpc.lua:10>
It's an error with jiddo's library version I'm using?
Thanks
Last edited: