Moj mistrz
Monster Creator
Hello everyone, i want a npc that gives you mission and let you pass first magic door (needed to make mission and get quest reward) and if you make mission then he'll gives you pass to next magic door. I've maked this npc, but he is not responding. Idk what i did wrong. Im noob in scripting. Sorry for my bad english.
Here is script:
Here is script:
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if(npcHandler.focus ~= cid) then
return false
end
if msgcontains(msg, 'help') then
selfSay('Lucien are thief i tell you, he stole my alchemists formulas, could you help return it?')
talk_state = 1
elseif msgcontains(msg, 'yes') and talk_state == 1 then
selfSay('Please go to his hidden spot near spike sword quest and find my {alchemists formulas}.')
doPlayerSetStorageValue(cid,58755, 1)
talk_state = 2
elseif msgcontains(msg, 'alchemists formulas') and getPlayerItemCount(cid,9733) >= 1 and getPlayerStorageValue(cid,54558) == -1 then
if doPlayerTakeItem(cid,9733,1) == 0 then
selfSay('Thank you very much! Now you can use magic door near spike sword quest!')
setPlayerStorageValue(cid,54558,1)
doSendMagicEffect(getPlayerPosition(cid), 27)
talk_state = 3
elseif msgcontains(msg, 'alchemists formulas') and talk_state == 2 and getPlayerStorageValue(cid,54558) == 1 then
selfSay('You have already done mission for me! If you want missions ask Randalf in Venore for a mission.')
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 3) then
selfSay('Good Bye. |PLAYERNAME|! Take care of yourself. ')
talk_state = 0
end
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())