Ir para conteúdo
  • Cadastre-se

[Pedido] NPC Global Teleport


Posts Recomendados

Olá galera do Tk.com  :rock:

 

Preciso de um NPC de Travel/Teleport que teleporte pra várias áreas do mapa mais ou menos assim: 

Player: Hi 

Professor(NPC): Ola |PLAYERNAME| voce quer ir para qual cidade, city 1, city 2, city 3, city 4, city 5 ou city 6?  

Ai o player fala alguma das cidades... e é teleportado(sem cobrar nada e sem level mínimo) 

ex: 

Player: City 1 

Professor(NPC): Quer ir mesmo pra City 1, la voce encontrara pokemons tipo fogo? 

Player: yes 

Professor(NPC): Aí Está. 

 

Se puderem ajudar só mandando o scripter(pode deixar que o chat eu edito e as positions também) 

-Já procurei pelo TK todo e não tem um scripter assim. 

 

Se puderem ajudar REP+ (e com outras contas dou outros Rep+)

 

Atensiosamente, Gabriel L.

Link para o post
Compartilhar em outros sites

professor.lua (data/npc/scripts):

local tab = {
	city1 = {x = 123, y = 456, z = 7},
	city2 = {x = 123, y = 456, z = 7},
	city3 = {x = 123, y = 456, z = 7},
	city4 = {x = 123, y = 456, z = 7},
	city5 = {x = 123, y = 456, z = 7},
	city6 = {x = 123, y = 456, z = 7}
}

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
	local ts = talkState[talkUser]
	local tef = doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
	if (msgcontains(msg, 'city 1')) then
		ts = 1
		selfSay('Quer ir mesmo para a City 1? La voce encontrara pokemons tipo fogo.', cid)
	elseif (msgcontains(msg, 'city 2')) then
		ts = 2
		selfSay('Quer ir mesmo para a City 2? La voce encontrara pokemons tipo agua.', cid)
	elseif (msgcontains(msg, 'city 3')) then
		ts = 3
		selfSay('Quer ir mesmo para a City 3? La voce encontrara pokemons tipo grama.', cid)
	elseif (msgcontains(msg, 'city 4')) then
		ts = 4
		selfSay('Quer ir mesmo para a City 4? La voce encontrara pokemons tipo eletrico.', cid)
	elseif (msgcontains(msg, 'city 5')) then
		ts = 5
		selfSay('Quer ir mesmo para a City 5? La voce encontrara pokemons tipo fantasma.', cid)
	elseif (msgcontains(msg, 'city 6')) then
		ts = 6
		selfSay('Quer ir mesmo para a City 6? La voce encontrara pokemons tipo psiquico.', cid)
	elseif (msgcontains(msg, 'yes')) then
		if (ts == 1) then
			doTeleportThing(cid, tab.city1)
			tef
		elseif (ts == 2) then
			doTeleportThing(cid, tab.city2)
			tef
		elseif (ts == 3) then
			doTeleportThing(cid, tab.city3)
			tef
		elseif (ts == 4) then
			doTeleportThing(cid, tab.city4)
			tef
		elseif (ts == 5) then
			doTeleportThing(cid, tab.city5)
			tef
		elseif (ts == 6) then
			doTeleportThing(cid, tab.city6)
			tef
		end
		selfSay('Ai esta.', cid)
	elseif (msgcontains(msg, 'no') and ts > 0) then
		ts = 0
		selfSay('Okay.', cid)
	end
	
	return true
end

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

Dava pra ter simplificado mais. Estou meio sem tempo, mas espero que ajude.




Professor.xml (data/npc):

<npc name="Professor" script="data/npc/scripts/professor.lua" access="5" lookdir="1">
<health now="1000" max="1000"/>
<look type="166" head="0" body="0" legs="0" feet="0" addons="0"/>
	<parameters>
		<parameter key="message_greet" value="Ola |PLAYERNAME|. Voce quer ir para qual cidade: {city 1}, {city 2}, {city 3}, {city 4}, {city 5} ou {city 6}?" />
	</parameters>
</npc>

The corrupt fear us.

The honest support us.

The heroic join us.

Link para o post
Compartilhar em outros sites

 

professor.lua (data/npc/scripts):

local tab = {
	city1 = {x = 123, y = 456, z = 7},
	city2 = {x = 123, y = 456, z = 7},
	city3 = {x = 123, y = 456, z = 7},
	city4 = {x = 123, y = 456, z = 7},
	city5 = {x = 123, y = 456, z = 7},
	city6 = {x = 123, y = 456, z = 7}
}

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
	local ts = talkState[talkUser]
	local tef = doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
	if (msgcontains(msg, 'city 1')) then
		ts = 1
		selfSay('Quer ir mesmo para a City 1? La voce encontrara pokemons tipo fogo.', cid)
	elseif (msgcontains(msg, 'city 2')) then
		ts = 2
		selfSay('Quer ir mesmo para a City 2? La voce encontrara pokemons tipo agua.', cid)
	elseif (msgcontains(msg, 'city 3')) then
		ts = 3
		selfSay('Quer ir mesmo para a City 3? La voce encontrara pokemons tipo grama.', cid)
	elseif (msgcontains(msg, 'city 4')) then
		ts = 4
		selfSay('Quer ir mesmo para a City 4? La voce encontrara pokemons tipo eletrico.', cid)
	elseif (msgcontains(msg, 'city 5')) then
		ts = 5
		selfSay('Quer ir mesmo para a City 5? La voce encontrara pokemons tipo fantasma.', cid)
	elseif (msgcontains(msg, 'city 6')) then
		ts = 6
		selfSay('Quer ir mesmo para a City 6? La voce encontrara pokemons tipo psiquico.', cid)
	elseif (msgcontains(msg, 'yes')) then
		if (ts == 1) then
			doTeleportThing(cid, tab.city1)
			tef
		elseif (ts == 2) then
			doTeleportThing(cid, tab.city2)
			tef
		elseif (ts == 3) then
			doTeleportThing(cid, tab.city3)
			tef
		elseif (ts == 4) then
			doTeleportThing(cid, tab.city4)
			tef
		elseif (ts == 5) then
			doTeleportThing(cid, tab.city5)
			tef
		elseif (ts == 6) then
			doTeleportThing(cid, tab.city6)
			tef
		end
		selfSay('Ai esta.', cid)
	elseif (msgcontains(msg, 'no') and ts > 0) then
		ts = 0
		selfSay('Okay.', cid)
	end
	
	return true
end

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

Dava pra ter simplificado mais. Estou meio sem tempo, mas espero que ajude.

Professor.xml (data/npc):

<npc name="Professor" script="data/npc/scripts/professor.lua" access="5" lookdir="1">
<health now="1000" max="1000"/>
<look type="166" head="0" body="0" legs="0" feet="0" addons="0"/>
	<parameters>
		<parameter key="message_greet" value="Ola |PLAYERNAME|. Voce quer ir para qual cidade: {city 1}, {city 2}, {city 3}, {city 4}, {city 5} ou {city 6}?" />
	</parameters>
</npc>

OBRIGADO!! irei testar já tem seu rep+ :D

Atensiosamente, Gabriel L.

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo