Postado Julho 26, 2018 6 anos ola eu estou criado um ot e queria apeas q a pessoa escolhesse para qual cidade ela deseja ir, ja que a classe ela ja escolhe ño site. se alguem coseguir me ajudar com esse escrip ficaria grato! Qual erro está surgindo? quado coloco esse codigo o oracle ñao aparece ño jogo 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) < 8) then npcHandler:say('COME BACK WHEN YOU GROW UP, CHILD!') 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 = 8}) 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? {Rhyves}, {Varak} or {Jorvik}?'}) local node2 = node1:addChildKeyword({'varak'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, town = 3, destination = {x=242, y=429, z=12}, text = 'Varak, eh? Are you sure about that? This decision is irreversible!'}) local node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) node2 = node1:addChildKeyword({'rhyves'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, town = 2, destination = {x=159, y=387, z=6}, text = 'Rhyves, eh? Are you sure about that? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) node2 = node1:addChildKeyword({'jorvik'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, town = 4, destination = {x=469, y=172, z=7}, text = 'Jorvik, eh? Are you sure about that? 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()) Editado Julho 26, 2018 6 anos por loizlol2 (veja o histórico de edições)
Postado Julho 26, 2018 6 anos Spoiler 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 if(destination ~= nil and town ~= nil) then if(getPlayerLevel(cid) < parameters.level) then npcHandler:say('You must first reach level ' .. parameters.level .. '!', cid) npcHandler:resetNpc() else doPlayerSetTown(cid, town) npcHandler:resetNpc() local tmp = getCreaturePosition(cid) doTeleportThing(cid, destination) doSendMagicEffect(tmp, CONST_ME_POFF) doSendMagicEffect(destination, CONST_ME_TELEPORT) end end return true end function greetCallback(cid) if(getPlayerLevel(cid) < 8) then npcHandler:say('COME BACK WHEN YOU GROW UP, CHILD!') 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 = 8}) local noNode = KeywordNode:new({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then what town 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? {Rhyves}, {Varak} or {Jorvik}?'}) local node2 = node1:addChildKeyword({'varak'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, town = 3, destination = {x=242, y=429, z=12}, text = 'Varak, eh? Are you sure about that? This decision is irreversible!'}) local node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) node2 = node1:addChildKeyword({'rhyves'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, town = 2, destination = {x=159, y=387, z=6}, text = 'Rhyves, eh? Are you sure about that? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) node2 = node1:addChildKeyword({'jorvik'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, town = 4, destination = {x=469, y=172, z=7}, text = 'Jorvik, eh? Are you sure about that? 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()) Te ajudei ?? Que tal fazer uma contribuição ?
Postado Julho 26, 2018 6 anos 14 minutos atrás, loizlol2 disse: o oracaulo cotiua ñao aparecedo ☹️ No teu servidor tem o xml desse npc recebendo essa script? e ele está no mapa, checa se ñ tem nada errado Te ajudei ?? Que tal fazer uma contribuição ?
Postado Julho 26, 2018 6 anos Autor tem sim <?xml version="1.0" encoding="UTF-8"?> <npc name="The Oracle" script="oracle.lua" walkinterval="0" floorchange="0"> <health now="100" max="100"/> <look typeex="1448" corpse="3128"/> </npc>
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.