ciappabrother 9 Postado Outubro 16, 2011 Share Postado Outubro 16, 2011 (editado) Hoje tava procurando um script de NPC que vende spell, e achei um usuário, DeathSpells, com um script de um NPC que vende spells, que não estava funcionando, e então, outro usuário, Vodkart, corrigiu o script dele, e estou disponibilizando aqui, para vocês acharem com mais facilidade. Então vamos ao script. Vá até seuot/data/npc e crie um arquivo.xml e nomeie para: Marvik.xml Agora abra o arquivo, e coloque o seguinte script: <?xml version="1.0" encoding="UTF-8"?> <npc name="Marvik" script="data/npc/scripts/spells.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="130" head="0" body="101" legs="120" feet="95" addons="0"/> <parameters> <parameter key="message_greet" value="Be greeted, |PLAYERNAME|. I can teach {spells} for druids."/> <parameter key="message_farewell" value="Farewell..."/> <parameter key="message_walkaway" value="Farewell..." /> <parameter key="module_keywords" value="1" /> <parameter key="keywords" value="15;9;8;spells" /> <parameter key="keyword_reply1" value="I can teach you, light healing" /> <parameter key="keyword_reply2" value="I can teach you, find person" /> </parameters> </npc> Bom, se você ainda não sabe mexer com NPC's, voce pode ver este tutorial: - A Magia dos NPC's Voltando... Agora você vai até: Vá até seuot/data/npc/scripts e vai criar um arquivo.lua com o nome spells.lua E vai colocar o seguinte script: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) -- OTServ event handling functions start 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 -- OTServ event handling functions end local node1 = keywordHandler:addKeyword({'light healing'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn light healing for 170 gp?'}) node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'light healing', vocation = 2, price = 170, level = 9}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true}) -- Makes sure the npc reacts when you say hi, bye etc. npcHandler:addModule(FocusModule:new()) - Legenda: Cor de Pele: local node, a cada magia que voce adicionar, voce tem que aumentar o node1, exemplo, se voce colocar outra madia, todos os node1 que terão, você tera de adicionar +1, ou seja node2. Laranja: É o nome da spells que o player vai ter que dizer para aprende-la. Vermelho: Fala do NPC após o player falar o nome da magia que quer aprender. Roxo: Nome da magia configurado no spells.xml. Verde Musgo: ID da vocação que é necessaria para aprender a magia. Azul: Preço que o player ira pagar na magia. Verde: Level necessário para aprender a magia. ''~~~~~~~~~~~~''~~~~~~~~~~~~''~~~~~~~~~~~~''~~~~~~~~~~~~''~~~~~~~~~~~~''~~~~~~~~~~~~''~~~~~~~~~~~~''~~~~~~~~~~~~'' Créditos: 95% DeathSpells e Vordkart 5% A mim por fazer o Tutorial Tópico que foi retirato o conteúdo: Clique Aqui Editado Outubro 25, 2011 por anfarosx Link para o comentário https://xtibia.com/forum/topic/170068-npc-professor-de-spells/ Compartilhar em outros sites More sharing options...
soexpedito 1 Postado Novembro 1, 2011 Share Postado Novembro 1, 2011 E se eu quiser colocar para cobra 1 item como eu fasso? Link para o comentário https://xtibia.com/forum/topic/170068-npc-professor-de-spells/#findComment-1125798 Compartilhar em outros sites More sharing options...
roriscrave 21 Postado Novembro 14, 2011 Share Postado Novembro 14, 2011 como faz pra colocar para qualquer vocaçao? Link para o comentário https://xtibia.com/forum/topic/170068-npc-professor-de-spells/#findComment-1132897 Compartilhar em outros sites More sharing options...
ciappabrother 9 Postado Novembro 19, 2011 Autor Share Postado Novembro 19, 2011 (editado) E se eu quiser colocar para cobra 1 item como eu fasso? Bom, seria mais facil voce colocar o NPC em um local que so entra se você tiver x storage, que eu nao sei mecher muito com xml e lua ainda como faz pra colocar para qualquer vocaçao? Voce devera repetir o script 4 vezes se querer para todas as vocations, tipo assim: local node1 = keywordHandler:addKeyword({'light healing'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn light healing for 170 gp?'}) node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'light healing', vocation = 1, price = 170, level = 9}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true}) local node2 = keywordHandler:addKeyword({'light healing'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn light healing for 170 gp?'}) node2:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'light healing', vocation = 2, price = 170, level = 9}) node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true}) local node3 = keywordHandler:addKeyword({'light healing'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn light healing for 170 gp?'}) node3:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'light healing', vocation = 3, price = 170, level = 9}) node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true}) local node4 = keywordHandler:addKeyword({'light healing'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn light healing for 170 gp?'}) node4:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'light healing', vocation = 4, price = 170, level = 9}) node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true}) Editado Novembro 19, 2011 por anfarosx Link para o comentário https://xtibia.com/forum/topic/170068-npc-professor-de-spells/#findComment-1135947 Compartilhar em outros sites More sharing options...
Ahnnubys 0 Postado Dezembro 12, 2011 Share Postado Dezembro 12, 2011 Entaao velho eu fiz deu certin bunitin so to com uma duvida como faço pra coloca pra 1 magia do ot so ser pelo Npc ?? tipo queria colocar ele no fim de uma quest pra so quem fizer ter o spell me ajuda ae =]. Link para o comentário https://xtibia.com/forum/topic/170068-npc-professor-de-spells/#findComment-1151215 Compartilhar em outros sites More sharing options...
roriscrave 21 Postado Dezembro 15, 2011 Share Postado Dezembro 15, 2011 E se eu quiser colocar para cobra 1 item como eu fasso? Bom, seria mais facil voce colocar o NPC em um local que so entra se você tiver x storage, que eu nao sei mecher muito com xml e lua ainda como faz pra colocar para qualquer vocaçao? Voce devera repetir o script 4 vezes se querer para todas as vocations, tipo assim: local node1 = keywordHandler:addKeyword({'light healing'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn light healing for 170 gp?'}) node1:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'light healing', vocation = 1, price = 170, level = 9}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true}) local node2 = keywordHandler:addKeyword({'light healing'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn light healing for 170 gp?'}) node2:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'light healing', vocation = 2, price = 170, level = 9}) node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true}) local node3 = keywordHandler:addKeyword({'light healing'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn light healing for 170 gp?'}) node3:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'light healing', vocation = 3, price = 170, level = 9}) node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true}) local node4 = keywordHandler:addKeyword({'light healing'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to learn light healing for 170 gp?'}) node4:addChildKeyword({'yes'}, StdModule.learnSpell, {npcHandler = npcHandler, premium = false, spellName = 'light healing', vocation = 4, price = 170, level = 9}) node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Cant you handle the power of the spell?', reset = true}) Coloquei conforme vc falou ali, para qualquer vocaçao aprender a magia, porém nao esta dando certo, só a vocaçao q fica no localnode1 que aprende o que fazer? Link para o comentário https://xtibia.com/forum/topic/170068-npc-professor-de-spells/#findComment-1153792 Compartilhar em outros sites More sharing options...
chuck200 1 Postado Janeiro 11, 2012 Share Postado Janeiro 11, 2012 Está com todas as spells essa ae? se tiver + rep Link para o comentário https://xtibia.com/forum/topic/170068-npc-professor-de-spells/#findComment-1173621 Compartilhar em outros sites More sharing options...
fnd13 0 Postado Fevereiro 22, 2012 Share Postado Fevereiro 22, 2012 Olá amigo! Adorei seu tutorial parabéns... Mais ao olhar aqui melhor, vi que estão marcando como premium="false" Gostaria de deixar alguns free, do jeito que esta e alguns premium. Então minha dúvida é o seguinte, se colocar premium=true Onde coloco a frase resposta se o jogador não possuir premium? Link para o comentário https://xtibia.com/forum/topic/170068-npc-professor-de-spells/#findComment-1203645 Compartilhar em outros sites More sharing options...
Posts Recomendados