Ir para conteúdo

Featured Replies

Postado

Olá gostaria de um npc que acho que é fácil de fazer... simples o player irá falar com o npc..e o npc irá perguntar pra ele você desjea ir a qual desses lugares: tal,tal,tal e cada resposta diferente que o player der o npc teleporta ele para uma area diferente..... (quero que de pra configurar a area... mais o menos umas 8 areas...)Valendo rep +

 

 

OPS:Versão do tibia 8.60

Postado
12 minutos atrás, Poke Hand disse:

Olá gostaria de um npc que acho que é fácil de fazer... simples o player irá falar com o npc..e o npc irá perguntar pra ele você desjea ir a qual desses lugares: tal,tal,tal e cada resposta diferente que o player der o npc teleporta ele para uma area diferente..... (quero que de pra configurar a area... mais o menos umas 8 areas...)Valendo rep +

 

 

OPS:Versão do tibia 8.60

local tab = {
	pos = {x = 1004, y = 1021, z = 7}, -- posição x, y, z do local a teleportar o player
	pos1 = {x = 1004, y = 1021, z = 7}, -- posição x, y, z do local a teleportar o player
	pos2 = {x = 1004, y = 1021, z = 7}, -- posição x, y, z do local a teleportar o player
	pos3 = {x = 1004, y = 1021, z = 7}, -- posição x, y, z do local a teleportar o player
	pos4 = {x = 1004, y = 1021, z = 7}, -- posição x, y, z do local a teleportar o player
	pos5 = {x = 1004, y = 1021, z = 7}, -- posição x, y, z do local a teleportar o player
	pos6 = {x = 1004, y = 1021, z = 7}, -- posição x, y, z do local a teleportar o player
	pos7 = {x = 1004, y = 1021, z = 7}, -- posição x, y, z do local a teleportar o player
	}

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

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
	
	local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
	if (msgcontains(msg, 'lugar')) then
			selfSay('Boa viagem!', cid)
			doTeleportThing(cid, tab.pos)
			elseif (msgcontains(msg, 'lugar2')) then
			selfSay('Boa viagem!', cid)
			doTeleportThing(cid, tab.pos1)
			elseif msgcontains(msg, 'lugar3') then
			selfSay('Boa viagem!', cid)
			doTeleportThing(cid, tab.pos2)
			elseif msgcontains(msg, 'lugar4') then
			selfSay('Boa viagem!', cid)
			doTeleportThing(cid, tab.pos3)
			elseif msgcontains(msg, 'lugar5') then
			selfSay('Boa viagem!', cid)
			doTeleportThing(cid, tab.pos4)
			elseif msgcontains(msg, 'lugar6') then
			selfSay('Boa viagem!', cid)
			doTeleportThing(cid, tab.pos5)
			elseif msgcontains(msg, 'lugar7') then
			doTeleportThing(cid, tab.pos6)
			selfSay('Boa viagem.', cid)
			elseif msgcontains(msg, 'lugar8') then
			doTeleportThing(cid, tab.pos7)
			selfSay('Boa viagem.', cid)
			else return false	
			end
	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Postado
  • Autor
1 hora atrás, Kemmlly disse:

local tab = {
	pos = {x = 1004, y = 1021, z = 7}, -- posição x, y, z do local a teleportar o player
	pos1 = {x = 1004, y = 1021, z = 7}, -- posição x, y, z do local a teleportar o player
	pos2 = {x = 1004, y = 1021, z = 7}, -- posição x, y, z do local a teleportar o player
	pos3 = {x = 1004, y = 1021, z = 7}, -- posição x, y, z do local a teleportar o player
	pos4 = {x = 1004, y = 1021, z = 7}, -- posição x, y, z do local a teleportar o player
	pos5 = {x = 1004, y = 1021, z = 7}, -- posição x, y, z do local a teleportar o player
	pos6 = {x = 1004, y = 1021, z = 7}, -- posição x, y, z do local a teleportar o player
	pos7 = {x = 1004, y = 1021, z = 7}, -- posição x, y, z do local a teleportar o player
	}

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

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
	
	local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
	if (msgcontains(msg, 'lugar')) then
			selfSay('Boa viagem!', cid)
			doTeleportThing(cid, tab.pos)
			elseif (msgcontains(msg, 'lugar2')) then
			selfSay('Boa viagem!', cid)
			doTeleportThing(cid, tab.pos1)
			elseif msgcontains(msg, 'lugar3') then
			selfSay('Boa viagem!', cid)
			doTeleportThing(cid, tab.pos2)
			elseif msgcontains(msg, 'lugar4') then
			selfSay('Boa viagem!', cid)
			doTeleportThing(cid, tab.pos3)
			elseif msgcontains(msg, 'lugar5') then
			selfSay('Boa viagem!', cid)
			doTeleportThing(cid, tab.pos4)
			elseif msgcontains(msg, 'lugar6') then
			selfSay('Boa viagem!', cid)
			doTeleportThing(cid, tab.pos5)
			elseif msgcontains(msg, 'lugar7') then
			doTeleportThing(cid, tab.pos6)
			selfSay('Boa viagem.', cid)
			elseif msgcontains(msg, 'lugar8') then
			doTeleportThing(cid, tab.pos7)
			selfSay('Boa viagem.', cid)
			else return false	
			end
	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Vou testar ainda... mais ja dei o rep

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo