E se eu quiser colocar para cobra 1 item como eu fasso?
- Fórum
- OTServ
- Recursos
- Scripting
- NPCs, monsters e raids
- [Npc] Professor De Spells
[Npc] Professor De Spells
Por ciappabrother, 16 de out. de 2011 em NPCs, monsters e raids
info
Grupo: Campones
Registrado: 24/10/11
Posts: 9
Reputação: +1

info
Grupo: Conde
Registrado: 18/07/08
Posts: 545
Reputação: +21
Char no Tibia: Nem eu sei

como faz pra colocar para qualquer vocaçao?
info
Grupo: Campones
Registrado: 12/04/08
Posts: 75
Reputação: +9

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 por anfarosx
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 =].![]()
info
Grupo: Conde
Registrado: 18/07/08
Posts: 545
Reputação: +21
Char no Tibia: Nem eu sei

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?
Está com todas as spells essa ae? se tiver + rep
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?


info
Grupo: Campones
Registrado: 12/04/08
Posts: 75
Reputação: +9
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:
Tópico que foi retirato o conteúdo:
Clique Aqui
Editado Outubro 25 por anfarosx