kessykins
Intermediate OT User
- Joined
- Mar 15, 2010
- Messages
- 297
- Reaction score
- 105
About a week ago I made an npc with the help of a few people from these forums but now when I start up the server it's giving me this error..
Is there some way to prevent this?
This is the NPC LUA
Code:
[29/08/2010 12:56:13] [Error - Npc interface]
[29/08/2010 12:56:13] data/npc/scripts/alvin.lua
[29/08/2010 12:56:13] Description:
[29/08/2010 12:56:13] (luaGetThingPosition) Thing not found
Is there some way to prevent this?
This is the NPC LUA
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}
local storage = 30000
local exp1 = 2000
local exp2 = 4000
local pos = getPlayerPosition(cid)
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
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
elseif msgcontains(msg, 'quest') or msgcontains(msg, 'apprentice') or msgcontains(msg, 'mission') then
local v = getPlayerStorageValue(cid, storage)
if v == -1 then
npcHandler:say("You are interested in becoming an apprentice fisherman, eh? The first step is to get a pole. Deep Sea Fishing Poles are quite expensive to make... Bring me 1 Orshabaal brain, 10 Iron Ore, 10 Giant Spider Silk and 10 Yellow Pieces of Cloth. Come back to me and say mission.", cid)
setPlayerStorageValue(cid, storage, 1)
elseif v == 1 then
npcHandler:say("Did you bring me 1 Orshabaal brain, 10 Iron Ore, 10 Giant Spider Silk and 10 Yellow Pieces of Cloth?", cid)
Topic[cid] = 1
elseif v == 3 then
npcHandler:say("So! You now have your pole. The next step is to prove to me that you can fish. Bring me 10 Common Silmy Objects, 5 Uncommon Slimy Objects and 1 Rare Slimy Object. Come back to me and say mission.", cid)
setPlayerStorageValue(cid, storage, 4)
elseif v == 4 then
npcHandler:say("Did you bring me 10 Common Silmy Objects, 5 Uncommon Slimy Objects and 1 Rare Slimy Object?", cid)
Topic[cid] = 4
elseif v == 5 then
npcHandler:say("You have completed all my missions. Speak with Polgara to become an Intermediate Fisherman!", cid)
end
elseif msgcontains(msg, 'yes') and Topic[cid] == 1 then
if getPlayerItemCount(cid, 5808) >= 1 and getPlayerItemCount(cid, 5914) >= 10 and getPlayerItemCount(cid, 5879) >= 10 and getPlayerItemCount(cid, 5880) >= 10 then
doPlayerRemoveItem(cid, 5808, 1)
doPlayerRemoveItem(cid, 5914, 10)
doPlayerRemoveItem(cid, 5879, 10)
doPlayerRemoveItem(cid, 5880, 10)
npcHandler:say("Thanks! Your new Deep Sea Fishing Pole is waiting in my house. When you have it ask me about your next mission.", cid)
doPlayerAddExp(cid, exp1)
doPlayerSendTextMessage(cid,22,"You have gained 2000 experience.")
doSendMagicEffect(pos, CONST_ME_REDSHIMMER)
setPlayerStorageValue(cid, storage, 2)
Topic[cid] = 1
else
npcHandler:say("Sorry, you don\'t have everything I asked for.", cid)
Topic[cid] = 0
end
elseif msgcontains(msg, 'yes') and Topic[cid] == 4 then
if getPlayerItemCount(cid, 10556) >= 10 and getPlayerItemCount(cid, 10553) >= 5 and getPlayerItemCount(cid, 10557) >= 1 then
doPlayerRemoveItem(cid, 10556, 10)
doPlayerRemoveItem(cid, 10553, 5)
doPlayerRemoveItem(cid, 10557, 1)
npcHandler:say("Well done! You are now officially an Apprentice Fisherman! Go talk to Polgara for your next task.", cid)
doPlayerAddExp(cid, exp2)
doPlayerSendTextMessage(cid,22,"You have gained 4000 experience.")
doSendMagicEffect(pos, CONST_ME_REDSHIMMER)
setPlayerStorageValue(cid, storage, 5)
Topic[cid] = 0
else
npcHandler:say("Sorry, you don\'t have everything I asked for.", cid)
Topic[cid] = 0
end
elseif msgcontains(msg, 'no') and Topic[cid] > 0 then
npcHandler:say("Okay then.", cid)
Topic[cid] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Last edited: