Richi Garza
YeYe
here is my npc for demon oak i tested it on the forgotten server beta 2 and it
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 onSay(cid, words, param)
if doPlayerRemoveItem(cid,2386,1) and doPlayerRemoveMoney(cid, 1000) == TRUE then
doPlayerAddItem(cid,8293,1)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'with this axe go en defeat the demon oak if you do this task tell me i beat the demon oak or i killed the demon oak!')
else
doPlayerSendCancel(cid, "you need 1k for the enchantment!")
end
return 1
end
function Beat(cid, message, keywords, parameters, node)
if getPlayerStorageValue(cid,20000) == 1 and getPlayerStorageValue(cid,20001) == 1 and getPlayerStorageValue(cid,20002) == 1 and getPlayerStorageValue(cid,20003) == 1 then
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Excellent... go visit the tomb of my father to get your prices for clearing this task.')
setPlayerStorageValue(cid,20004,1)
else
doPlayerSendCancel(cid, "please go and defeat the demon oak!")
end
return 1
end
node1 = keywordHandler:addKeyword({'demon oak'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'the {demon oak} is an evil tree thats plagin this island ask me for an {hallowed axe} to do this quest for me.'})
node2 = keywordHandler:addKeyword({'hallowed axe'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'so you want a hallowed axe did you bring me an {axe} and {1000 gold coins}?'})
node2:addChildKeyword({'yes'}, onSay, {})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got enought money.', reset = true})
node3 = keywordHandler:addKeyword({'i beat the demon oak'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'did you really killed the demon oak???'})
node3:addChildKeyword({'yes'}, Beat, {})
node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you kill the demon oak.', reset = true})
node4 = keywordHandler:addKeyword({'i killed the demon oak'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'did you really killed the demon oak???'})
node4:addChildKeyword({'yes'}, Beat, {})
node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you kill the demon oak.', reset = true})
node5 = keywordHandler:addKeyword({'killed'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'did you really killed the demon oak???'})
node5:addChildKeyword({'yes'}, Beat, {})
node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you kill the demon oak.', reset = true})
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Last edited: