Ir para conteúdo
  • 0

Npc Que Teleporta


NewAge

Pergunta

5 respostass a esta questão

Posts Recomendados

  • 0

Crie um arquivo em Data/Npc com o nome que desejar.

Dentro cole:

 

 

 

<?xml version="1.0"?>

-<npc maglevel="1" level="1" access="5" floorchange="0" walkinterval="3" script="data/npc/scripts/teleportador.lua" name="Teleportador"> <health max="150" now="150"/> <look corpse="2212" feet="111" legs="15" body="19" head="96" type="146"/> -<parameters> <parameter value="Ola |PLAYERNAME|. ! Eu posso te levar para {kunlun}, {skin}, {deserto}, {geffen}, {lutie}, {ank} e {izlud}.. Onde deseja ir?" key="message_greet"/> <parameter value="Vai custar |TOTALCOST| gold coins. Vai viajar? Voce pode ir em outras cidades indo ao tapete do meu primo!" key="message_decline"/> </parameters> </npc>

 

 

Aqui você coloca os nomes das cidades que o npc vai:

Eu posso te levar para {kunlun}, {skin}, {deserto}, {geffen}, {lutie}, {ank} e {izlud}.. Onde deseja ir?

 

Agora em Data/Npc/Scripts:

Crie um arquivo com o nome de "teleportador.lua

E cole isso dentro:

 

 

 

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

 

 

 

-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!

local travelNode = keywordHandler:addKeyword({'kunlun'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce quer viajar para kunlun por 210 gold coins?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 2, cost = 210, destination = {x=825, y=1686, z=6} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'})

 

keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu posso te levar para {kunlun}, {skin}, {deserto}, {geffen}, {lutie} e {ank} por um pequeno custo.'})

 

-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!

local travelNode = keywordHandler:addKeyword({'skin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce quer viajar para skin por 210 gold coins?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 2, cost = 210, destination = {x=303, y=1865, z=6} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'})

 

keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to \'skin\' for just a small fee.'})

 

-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!

local travelNode = keywordHandler:addKeyword({'deserto'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce quer viajar para deserto por 210 gold coins?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 2, cost = 210, destination = {x=922, y=1446, z=5} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'})

 

keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to \'deserto\' for just a small fee.'})

 

-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!

local travelNode = keywordHandler:addKeyword({'geffen'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce quer viajar para geffen por 100 gold coins?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 2, cost = 100, destination = {x=991, y=1000, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'})

 

keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to \'geffen\' for just a small fee.'})

 

-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!

local travelNode = keywordHandler:addKeyword({'anknor'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce quer viajar para anknor por 175 gold coins?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 2, cost = 175, destination = {x=487, y=261, z=6} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'})

 

keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to \'Anknor\' for just a small fee.'})

 

-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!

local travelNode = keywordHandler:addKeyword({'anknor'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce quer viajar para anknor por 100 gold coins?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 2, cost = 100, destination = {x=487, y=261, z=6} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'})

 

keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to \'anknor\' for just a small fee.'})

 

-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!

local travelNode = keywordHandler:addKeyword({'smallville'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce quer viajar para smallville por 190 gold coins?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 2, cost = 190, destination = {x=1995, y=2394, z=6} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'})

 

keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to \'smallville\' for just a small fee.'})

 

-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!

local travelNode = keywordHandler:addKeyword({'goroma'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce quer viajar para Goroma por 55 gold coins?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 2, cost = 55, destination = {x=1367, y=195, z=6} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'})

 

keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to \'goroma\' for just a small fee.'})

 

 

-- Makes sure the npc reacts when you say hi, bye etc.

npcHandler:addModule(FocusModule:new())

 

 

Nessa parte você coloca as coordenadas pra onde o npc vai levar:

 

 

 

-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!

local travelNode = keywordHandler:addKeyword({'kunlun'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce quer viajar para kunlun "aqui vem o nome da cidade" por 210 gold coins?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 2, cost = 210, destination = {x=825, y=1686, z=6} "COORDENADAS DA CIDADE" })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'})

 

keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to \'goroma\' "aqui o nome da cidade denovo" for just a small fee.'})

 

 

 

Qualquer erro poste aqui.

Editado por Xurupito
Link para o comentário
Compartilhar em outros sites

  • 0

O meu npc não aparece no mapa, como faço pra ele aparecer? Ele não ta aparecendo nem no mapa editor, mesmo quando coloco pra importar

Editado por NewAge
Link para o comentário
Compartilhar em outros sites

  • 0

Tenta fazer assim, no mapa editor olha o nome de algum npc capitão que não tenha no seu ot.

Coloque o npc no mapa ai você vai la em data/npc na hora de criar o arquivo .xml você põe o nome do npc que ta no remeres.

Dentro cole o que te passei.

Link para o comentário
Compartilhar em outros sites

  • 0

eu ja arrumei isso, agora quando tento importar diz que o arquivo xml não ta em um formato valido

 

<?xml version="1.0"?> encoding="UTF-8"?>

<npc name="Heller" script="ilha.lua" walkinterval="2000" floorchange="0">

<health now="100" max="100"/>

<feet="128" legs="0" body="114" head="0" looktype="194"/>

<parameters>

<parameter value=" |PLAYERNAME|. ! Ate que enfim voce chegou, entre no barco, vou te levar para a ilha.(Diga ilha)" key="message_greet"/> <parameter value="Nao temos tempo a perder, vamos la. Quando chegar la procure a entrada para o refugio." key="message_decline"/> <parameter value="Onde voce vai? Temos que fugir!"/>

</parameters>

</npc>

 

olha ai como ta

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...