Cosmotonio
New Member
- Joined
- Nov 26, 2007
- Messages
- 142
- Reaction score
- 0
Hi i made this npc but do not work.
Code:
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
function creatureSayCallback(cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
if msgcontains(msg, 'quest') then
questv = getGlobalStorageValue(5019)
if questv == -1 then
selfSay('When I was leaving my ship, I hide priceless artifact in one of the barrels. You could bring it to me.')
else
selfSay('Bloody adventurers, always looking for trouble!')
end
else
end
end
if msgcontains(msg, 'ship') then
selfSay('My ship is on the desert. It doesn\'t look well but still can sail. Of course if you know how to steer it.')
end
if msgcontains(msg, 'steer') and getGlobalStorageValue(5019) == -1 then
selfSay('If you want to learn steering, bring me artifact from the ship.')
end
if msgcontains(msg, 'steer') and getGlobalStorageValue(5019) ~= -1 then
selfSay('You know everything I do.')
end
if msgcontains(msg, 'artifact') then
questv = getGlobalStorageValue(5019)
if questv == -1 then
itemstatus = doPlayerRemoveItem(cid,2342,1)
if itemstatus == -1 then
selfSay('It\'s in one of the barrels. Look under the deck.')
end
elseif itemstatus ~= -1 then
setPlayerStorageValue(cid,5019,1)
selfSay('Thank you! To steer a ship, just use a steering wheel.')
end
if msgcontains(msg, 'artifact') and questv ~= -1 then
selfSay('This helmet belongs to me.')
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Code:
[19/02/2008 13:00:32] Lua Script Error: [Npc interface]
[19/02/2008 13:00:32] data/npc/scripts/jack.lua
[19/02/2008 13:00:32] data/npc/scripts/bank.lua:48: bad argument #1 to 'find' (string expected, got nil)
[19/02/2008 13:00:32] Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/jack.lua