Antagoreon
New Member
Im Using the TFS 0.3.3 (Crying Damson) and i want a npc to change nuggets for exp i have this script but not work anyone can repair it plx?
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, 'exchange') then
if doPlayerRemoveItem(cid, 2157, 1) then
selfSay('Would you like to change 1 nugget for 1000000 experience?', cid)
talkState[talkUser] = 1
end
end
if talkState[talkUser] == 1 then
if msgcontains(msg, 'yes') then
doPlayerAddExp(cid, 1000000)
selfSay('You have received 100000 experience!', cid)
talkState[talkUser] = 0
else
selfSay('Then not', cid)
talkState[talkUser] = 0
end
end
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())