Postado Outubro 21, 2018 6 anos Bom dia galerinha tk Venho pedir a vcs encarecidamente uma grande ajuda pois já fritei minha cabeça tentado vários Scripts e tedando muda Scripts a ponto de ficar quase doido já kkkkkk. Profavorrrr eu preciso MT de NPC parecido com o Oracle Servidor 8.60 tfs 0.4 Minha classe inicial e Aluno id= 1 Eu preciso que ao pegar lvl 20 os player possa escolher entre 3 casas são elas Aluno de Grifinoria Id= 2 Aluno de Sonserina Id=3 Aluno de Cornival Id=4 Aluno de lufa lufa Id=5 O aluno falará com o NPC e o NPC dará uma dessas 4 opções para o Aluno seguir. Por favor galerinha Tk me salvem. Dês de já um abraço e agradecido.
Postado Outubro 21, 2018 6 anos Solução Olá The Oracle.xml Mostrar conteúdo oculto <?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> oracle.lua Mostrar conteúdo oculto 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) > 1) 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) < ? 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? {yes} or {no}') 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 = 'Voce realmente quer virar um aluno? {sim}'}) local node2 = node1:addChildKeyword({'sim'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, town = 1, destination = {x=242, y=429, z=12}, text = 'So what vocation do you wish to become? {grifinoria}, {sonserina}, {corvinal} or {lufalufa}?'}) local node3 = node2:addChildKeyword({'grifinoria'}, StdModule.say, {npcHandler = npcHandler, vocation = 2, onlyFocus = true, text = 'So, you wish to be a powerful magician? Are you sure about that? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) node3 = node2:addChildKeyword({'sonserina'}, StdModule.say, {npcHandler = npcHandler, vocation = 3, onlyFocus = true, text = 'Are you sure that a druid is what you wish to become? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) node3 = node2:addChildKeyword({'corvinal'}, StdModule.say, {npcHandler = npcHandler, vocation = 4, onlyFocus = true, text = 'A ranged marksman. Are you sure? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) node3 = node2:addChildKeyword({'lufalufa'}, StdModule.say, {npcHandler = npcHandler, vocation = 5, 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()) Promotion.xml Mostrar conteúdo oculto <?xml version="1.0" encoding="UTF-8"?> <npc name="Promotion" script="promotion.lua" walkinterval="0" floorchange="0"> <health now="100" max="100"/> <look type="325" head="29" body="4" legs="20" feet="96" addons="3" corpse="2212"/> </npc> promotion.lua Mostrar conteúdo oculto 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 local node1 = keywordHandler:addKeyword({'promotion'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you. Do you want me to promote you? {yes} or {no}'}) node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 0, level = 100, promotion = 1, text = 'Congratulations! You are now promoted.'}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true}) Editado Outubro 21, 2018 6 anos por tetheuscunha (veja o histórico de edições)
Postado Outubro 21, 2018 6 anos Autor Em 21/10/2018 em 20:33, tetheuscunha disse: Olá The Oracle.xml Mostrar conteúdo oculto Mostrar conteúdo oculto <?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> oracle.lua Mostrar conteúdo oculto Mostrar conteúdo oculto 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) > 1) 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) < ? 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? {yes} or {no}') 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 = 'Voce realmente quer virar um aluno? {sim}'}) local node2 = node1:addChildKeyword({'sim'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, town = 1, destination = {x=242, y=429, z=12}, text = 'So what vocation do you wish to become? {grifinoria}, {sonserina}, {corvinal} or {lufalufa}?'}) local node3 = node2:addChildKeyword({'grifinoria'}, StdModule.say, {npcHandler = npcHandler, vocation = 2, onlyFocus = true, text = 'So, you wish to be a powerful magician? Are you sure about that? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) node3 = node2:addChildKeyword({'sonserina'}, StdModule.say, {npcHandler = npcHandler, vocation = 3, onlyFocus = true, text = 'Are you sure that a druid is what you wish to become? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) node3 = node2:addChildKeyword({'corvinal'}, StdModule.say, {npcHandler = npcHandler, vocation = 4, onlyFocus = true, text = 'A ranged marksman. Are you sure? This decision is irreversible!'}) node3:addChildKeywordNode(yesNode) node3:addChildKeywordNode(noNode) node3 = node2:addChildKeyword({'lufalufa'}, StdModule.say, {npcHandler = npcHandler, vocation = 5, 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()) Promotion.xml Mostrar conteúdo oculto Mostrar conteúdo oculto <?xml version="1.0" encoding="UTF-8"?> <npc name="Promotion" script="promotion.lua" walkinterval="0" floorchange="0"> <health now="100" max="100"/> <look type="325" head="29" body="4" legs="20" feet="96" addons="3" corpse="2212"/> </npc> promotion.lua Mostrar conteúdo oculto Mostrar conteúdo oculto 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 local node1 = keywordHandler:addKeyword({'promotion'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you. Do you want me to promote you? {yes} or {no}'}) node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 0, level = 100, promotion = 1, text = 'Congratulations! You are now promoted.'}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true}) Perfeito ótima acistensia muito obg pela ajuda SZ irá ajudar a muitos.
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.