PHP:
local talkNode = 0
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThingMove(creature, thing, oldpos, oldstackpos) npcHandler:onThingMove(creature, thing, oldpos, oldstackpos) end
function onCreatureAppear(creature) npcHandler:onCreatureAppear(creature) end
function onCreatureDisappear(id) npcHandler:onCreatureDisappear(id) end
function onCreatureTurn(creature) npcHandler:onCreatureTurn(creature) end
function onCreatureChangeOutfit(creature) npcHandler:onCreatureChangeOutfit(creature) end
function onThink() npcHandler:onThink() end
-- OTServ event handling functions end
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
function creatureSayCallback(cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
local queststatus = getPlayerStorageValue(cid, 9517)
local diary = doPlayerRemoveItem(cid, 1985,1)
local diaryStatus = getPlayerStorageValue(cid, 1985)
-- getmission --
if msgcontains(msg, 'mission') then
if queststatus < 1 then
npcHandler:say("I have lost my diary... I were exploring east of Rhyves when they came, could you please find it?")
talkNode = 1
end
end
-- Confirm yes --
if msgcontains(msg, 'yes') then
if talkNode == 1 then
if queststatus < 1 then
npcHandler:say("Go and find it brave warrior!")
setPlayerStorageValue(cid, 9517, 1)
focus = 0
talkNode = 0
else
npcHandler:say("Get lost!")
end
elseif talkNode == 2 then
if queststatus == 1 then
if diaryStatus == 1 then
selfSay('Thank you! Here you got some money!')
doPlayerAddItem(cid,2152,27)
doRemoveItem(cid,1985,1)
setPlayerStorageValue(cid, 9517, 2)
focus = 0
else
selfSay('You don\'t have my diary.')
end
end
end
end
-- Confirm no --
if msgcontains(msg, 'no') then
if talkNode == 1 then
selfSay("Come back when you have grown up!")
talk_state = 0
elseif talkNode == 2 then
selfSay('Please find it for me.')
talkNode = 0
end
end
if msgcontains(msg, 'diary') then
selfSay("Did you find my diary?")
talkNode = 2
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
00:50 Imforital [3]: hi
00:50 Mission: Welcome, Imforital! I have been expecting you.
00:50 Imforital [3]: mission
00:50 Mission: I have lost my diary... I were exploring east of Rhyves when they came, could you please find it?
00:50 Imforital [3]: yes
00:50 Mission: Go and find it brave warrior!
00:50 You have found Lisas diary..
00:50 Imforital [3]: diary
(Here he takes the book)
00:50 Mission: Did you find my diary?
00:50 Imforital [3]: yes
(Here he remove the quest box and give me money, and the quest box shouldnt dissapear)
00:50 Mission: Thank you! Here you got some money!
00:51 Mission: Good bye, Imforital!
I want it to be like:
00:50 Imforital [3]: hi
00:50 Mission: Welcome, Imforital! I have been expecting you.
00:50 Imforital [3]: mission
00:50 Mission: I have lost my diary... I were exploring east of Rhyves when they came, could you please find it?
00:50 Imforital [3]: yes
00:50 Mission: Go and find it brave warrior!
00:50 You have found Lisas diary..
00:50 Imforital [3]: diary
00:50 Mission: Did you find my diary?
00:50 Imforital [3]: yes
(Here he takes the book, give me 27 platinum coins)
00:50 Mission: Thank you! Here you got some money!
00:51 Mission: Good bye, Imforital!
Sincerely,
Furswin.
Last edited: