Justin123456
New Member
- Joined
- Mar 24, 2011
- Messages
- 177
- Reaction score
- 4
Hey everyone, when I try to load the npc called "Evul Eye" I get this error:
Code:
[27/06/2012 14:25:16] [Error - Npc interface]
[27/06/2012 14:25:16] data/npc/scripts/evul eye.lua
[27/06/2012 14:25:16] Description:
[27/06/2012 14:25:16] data/npc/scripts/evul eye.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[27/06/2012 14:25:16] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/evul eye.lua
I don't what's wrong with it or how to fix it but here's my evul eye.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Evul Eye" script="evul eye.lua" walkinterval="0" floorchange="0">
<health now="100" max="100"/>
<look typeex="11672"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|, I'm trading your 100 Eyes for 25x exp poem, Do you want to {change}?"/>
</parameters>
</npc>
Here's the evul eye.lua:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'change') or msgcontains(msg, '100')) then
selfSay('Do you want to give me 100 eyes for 25x exp poem?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerItemCount(cid, 11197) >= 100) then
if(doPlayerRemoveItem(cid, 11197, 100)) then
doPlayerAddItem(cid, 12466, 25)
selfSay('Here you are.', cid)
else
selfSay('Sorry, you don\'t have enough eyes.', cid)
end
else
selfSay('Sorry, you don\'t have enough eyes.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Also to let you know, what this NPC does is... It will take 100 Evul eyes and give you 25 exp scrolls~
I'm using TFS 0.3.6
- - - Updated - - -
Anyone? Bump!~