Ir para conteúdo

Posts Recomendados

--Tutorial criando ncp de teleport--

1° va em data/ncp/scripts.

2° crie um arquivo.lua.

3° bote isso no arquivos

local keywordHandler =KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

 

local pos = {x=152,y=58,z=7} --->e o lugar que ele teletransporta veja isso o rme

local itemid = 2468 -->e o id do dinheiro ou de um iten que ele da em troka o teleport.

 

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(not npcHandler:isFocused(cid)) then

return false

end

 

if msgcontains(msg, "offer") or msgcontains(msg, "help") then

selfSay("Eu posso te levar a TAL lugar por um "..getItemNameById(itemid).." item, fale {travel} se quizer viajar.", cid)

talkState[cid] = 0

elseif msgcontains(msg, 'travel') then

if doPlayerRemoveItem(cid, itemid, 1) then

selfSay("Boa viagem.", cid)

doTeleportThing(cid, pos)

else

selfSay("Voce nao tem o item nescessario.", cid)

end

end

return TRUE

end

 

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

Faça outro arquivo.lua mais esse e pra fazer com o nome do ncp:

 

 

<npc name="NOMEDONPC" script="data/npc/scripts/itemtravel.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 {offer}." />

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

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

</parameters>

</npc>

 

Espero ter ajudado flw

Editado por tutumelo
Link para o comentário
https://xtibia.com/forum/topic/214763-tutorial-criando-ncp-de-teleport/
Compartilhar em outros sites

×
×
  • Criar Novo...