Ir para conteúdo

Npc De Teleporte Por Vocation!


LuKk44S

Posts Recomendados

Lembrando: Sorcerer e Druid Esta No Mesmo NPC.

 

NPCDEPALADIN.xml

 

data/npc/npcdepaladin.xml

 

<npc name="NPCDEPALADIN" script="data/npc/scripts/telepaladin.lua" walkinterval="2000" floorchange="0">

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

<look type="134" head="78" body="88" legs="0" feet="88" addons="3"/>

<parameters>

<parameter key="message_greet" value="Ola. Para mais informacoes de meus servicos diga {go}." />

<parameter key="message_farewell" value="Tchau." />

<parameter key="message_walkaway" value="Tchau." />

</parameters>

</npc>

 

data\npc\scripts\telepaladin.lua

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local pos = {x=160,y=54,z=7} -------------- Pos para onde o player sera levado

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 creatureSayCallback(cid, type, msg)

if msgcontains(msg, 'go') then

if getPlayerVocation(cid) == 3 or getPlayerVocation(cid) == 7 or getPlayerVocation(cid) == 11 then

selfSay("Boa viagem.", cid)

doTeleportThing(cid, pos)

else

selfSay("Eu Não Posso Te Teleporta só Fiel A Os Paladin. E Vc Não è UM", cid)

end

end

return TRUE

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

 

NPCDEKNIGHT.xml

 

data\npc\NPCDEKNIGHT.xml

 

<npc name="NPCDEKNIGHT" script="data/npc/scripts/teleknight.lua" walkinterval="2000" floorchange="0">

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

<look type="134" head="78" body="88" legs="0" feet="88" addons="3"/>

<parameters>

<parameter key="message_greet" value="Ola. Para mais informacoes de meus servicos diga {go}." />

<parameter key="message_farewell" value="Tchau." />

<parameter key="message_walkaway" value="Tchau." />

</parameters>

</npc>

 

data\npc\scripts\teleknight.lua

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local pos = {x=160,y=54,z=7} -------------- Pos para onde o player sera levado

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 creatureSayCallback(cid, type, msg)

if msgcontains(msg, 'go') then

if getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8 or getPlayerVocation(cid) == 12 then

selfSay("Boa viagem.", cid)

doTeleportThing(cid, pos)

else

selfSay("Eu Não Posso Te Teleporta só Fiel A Os Kinght. E Vc Não è UM", cid)

end

end

return TRUE

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

 

NPCDEMAGES.xml

 

data\npc\scripts\telemages.lua

 

<npc name="NPCDEMAGES" script="data/npc/scripts/telemages.lua" walkinterval="2000" floorchange="0">

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

<look type="134" head="78" body="88" legs="0" feet="88" addons="3"/>

<parameters>

<parameter key="message_greet" value="Ola. Para mais informacoes de meus servicos diga {go}." />

<parameter key="message_farewell" value="Tchau." />

<parameter key="message_walkaway" value="Tchau." />

</parameters>

</npc>

 

data\npc\scripts\telemages.lua

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local pos = {x=160,y=54,z=7} -------------- Pos para onde o player sera levado

 

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 creatureSayCallback(cid, type, msg)

if msgcontains(msg, 'go') then

if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 5 or getPlayerVocation(cid) == 6 or getPlayerVocation(cid) == 9 or getPlayerVocation(cid) == 10 then

selfSay("Boa viagem.", cid)

doTeleportThing(cid, pos)

else

selfSay("Eu Não Posso Te Teleporta só Fiel A Os Druds E Magos E Vc Não è UM", cid)

end

end

return TRUE

end

 

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

 

Configurando Teleportação

 

Deixei Assim

local pos = {x=160,y=54,z=7} -------------- Posição para onde o player sera levado

 

Link para o comentário
Compartilhar em outros sites

Dava pra reduzir os NPCs para um único arquivo através de uma table:

 

 

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 creatureSayCallback(cid, type, msg)

 

local t = { -- ID da Vocation / Position

[1] = {x = 160, y = 54, z = 7},

[2] = {x = 160, y = 54, z = 7},

[3] = {x = 160, y = 54, z = 7},

[4] = {x = 160, y = 54, z = 7},

[5] = {x = 160, y = 54, z = 7},

[6] = {x = 160, y = 54, z = 7},

[7] = {x = 160, y = 54, z = 7},

[8] = {x = 160, y = 54, z = 7},

}

 

local a = t[getPlayerVocation(cid)]

 

if msgcontains(msg, 'go') then

if not a then

selfSay("Eu não posso te teleportar.", cid) return true

end

 

doTeleportThing(cid, a)

selfSay("Boa viagem.", cid)

end

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

Configurando aqui:

 

local t = { -- ID da Vocation / Position
[1] = {x = 160, y = 54, z = 7},
[2] = {x = 160, y = 54, z = 7},
[3] = {x = 160, y = 54, z = 7},
[4] = {x = 160, y = 54, z = 7},
[5] = {x = 160, y = 54, z = 7},
[6] = {x = 160, y = 54, z = 7},
[7] = {x = 160, y = 54, z = 7},
[8] = {x = 160, y = 54, z = 7},
}

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

×
×
  • Criar Novo...