Hello I change the "oracle" to change the "no vocation=0" to "rooker miner=17".
However the new "oracle" don't response to choose the city. Can someone fix it?
However the new "oracle" don't response to choose the city. Can someone fix it?
Lua:
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 oracle(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
local cityNode = node:getParent():getParent()
local vocNode = node:getParent()
local destination = cityNode:getParameters().destination
local town = cityNode:getParameters().town
local vocation = vocNode:getParameters().vocation
if(destination ~= nil and vocation ~= nil and town ~= nil) then
if(getPlayerLevel(cid) < parameters.level) then
npcHandler:say('You must first reach level ' .. parameters.level .. '!', cid)
npcHandler:resetNpc()
else
if(getPlayerVocation(cid) > 0) then
npcHandler:say('Sorry, You already have a vocation!')
npcHandler:resetNpc()
else
doPlayerSetVocation(cid, vocation)
doPlayerSetTown(cid, town)
npcHandler:resetNpc()
local tmp = getCreaturePosition(cid)
doTeleportThing(cid, destination)
doSendMagicEffect(tmp, CONST_ME_POFF)
doSendMagicEffect(destination, CONST_ME_TELEPORT)
end
end
end
return true
end
function greetCallback(cid)
if(getPlayerLevel(cid) < 30) then
npcHandler:say('COME BACK WHEN YOU GET 30lvl, ROOKY!')
return false
else
return true
end
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setMessage(MESSAGE_GREET, 'Hello |PLAYERNAME|. Are you prepared to face your destiny?')
local yesNode = KeywordNode:new({'yes'}, oracle, {level = 30})
local noNode = KeywordNode:new({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then what vocation do you want to
become?'})
local node1 = keywordHandler:addKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'What city do you wish to live in?
{Khameiro} or {Fog Island}?'})
local node2 = node1:addChildKeyword({'Fog Island'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, town = 6, destination = {x=1441,
y=2601, z=7}, text = 'Fog Island, eh? So do you wish to become a {Rooker Miner}?'})
local node3 = node2:addChildKeyword({'Rooker Miner'}, StdModule.say, {npcHandler = npcHandler, vocation = 17, onlyFocus = true, text = 'So,
you wish to be a rooker miner? Are you sure about that? This decision is irreversible!'})
node3:addChildKeywordNode(yesNode)
node3:addChildKeywordNode(noNode)
node3 = node2:addChildKeyword({'-.-'}, StdModule.say, {npcHandler = npcHandler, vocation = 2, onlyFocus = true, text = 'Are you sure that a
-.- is what you wish to become? This decision is irreversible!'})
node3:addChildKeywordNode(yesNode)
node3:addChildKeywordNode(noNode)
node3 = node2:addChildKeyword({'-.-.'}, StdModule.say, {npcHandler = npcHandler, vocation = 3, onlyFocus = true, text = 'A ranged marksman.
Are you sure? This decision is irreversible!'})
node3:addChildKeywordNode(yesNode)
node3:addChildKeywordNode(noNode)
node3 = node2:addChildKeyword({'-.-.-'}, StdModule.say, {npcHandler = npcHandler, vocation = 4, onlyFocus = true, text = 'A mighty warrior.
Is that your final decision? This decision is irreversible!'})
node3:addChildKeywordNode(yesNode)
node3:addChildKeywordNode(noNode)
node2 = node1:addChildKeyword({'Khameiro'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, town = 5, destination = {x=1508, y=2488, z=5},
text = 'Khameiro, eh? So do you wish to become a {Rooker Miner}?'})
node3 = node2:addChildKeyword({'Rooker Miner'}, StdModule.say, {npcHandler = npcHandler, vocation = 17, onlyFocus = true, text = 'So, you
wish to be a rooker miner? Are you sure about that? This decision is irreversible!'})
node3:addChildKeywordNode(yesNode)
node3:addChildKeywordNode(noNode)
node3 = node2:addChildKeyword({'-.-'}, StdModule.say, {npcHandler = npcHandler, vocation = 2, onlyFocus = true, text = 'Are you sure that a
-.- is what you wish to become? This decision is irreversible!'})
node3:addChildKeywordNode(yesNode)
node3:addChildKeywordNode(noNode)
node3 = node2:addChildKeyword({'-.-.'}, StdModule.say, {npcHandler = npcHandler, vocation = 3, onlyFocus = true, text = 'A ranged marksman.
Are you sure? This decision is irreversible!'})
node3:addChildKeywordNode(yesNode)
node3:addChildKeywordNode(noNode)
node3 = node2:addChildKeyword({'-.-.-'}, StdModule.say, {npcHandler = npcHandler, vocation = 4, onlyFocus = true, text = 'A mighty warrior.
Is that your final decision? This decision is irreversible!'})
node3:addChildKeywordNode(yesNode)
node3:addChildKeywordNode(noNode)
keywordHandler:addKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Then come back when you are ready.'})
npcHandler:addModule(FocusModule:new())
Last edited: