Ir para conteúdo

Featured Replies

Postado

Queria um scripts de um npc que teletransporta as pessoa pra um determinado local do mapa, mais que para se teleportado tem q entrega um item e pagar uma quantidade de golds ou "kk" 

 

- Creio que esse scripts http://www.tibiaking.com/forum/topic/45955-pedido-npc-que-teleporta-player/  , ja e meio caminho andando para vcs, mais nao sei configurar scripts :/

 

 

Resolvido por Wise

Ir para solução
  • Respostas 6
  • Visualizações 3.3k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • teleporterman.lua (data/npc/scripts): local tab = { pos = {x = 123, y = 456, z = 7}, -- posição x, y, z do local a teleportar o player item = {5432, 1}, -- {itemID, count} price = 15 -- quantidad

  • local tab = { pos = {x = 123, y = 456, z = 7}, -- posição x, y, z do local a teleportar o player item = {5432, 1}, -- {itemID, count} price = 15 -- quantidade em crystal coins } local keywordHandl

  • Ops, acabei me esquecendo de aplicar a função pra essa parte. Obrigado por adicionar, Nogard. Só um detalhe: Não precisa adicionar outra função de remoção do dinheiro, já que a própria checag

Postado

teleporterman.lua (data/npc/scripts):

local tab = {
	pos = {x = 123, y = 456, z = 7}, -- posição x, y, z do local a teleportar o player
	item = {5432, 1}, -- {itemID, count}
	price = 15 -- quantidade em crystal coins
}

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, 'teleport')) then
		talkState[talkUser] = 1
		selfSay('Are you sure?', cid)
		selfSay('Remember..you need '..tab.item[2]..' '..getItemNameById(tab.item[1])..' and '..tab.price..' crystal coins to be teleported.', cid)
	elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 10000)) then
			doPlayerRemoveItem(cid, tab.item[1], tab.item[2])
			doTeleportThing(cid, tab.pos)
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			selfSay('Have a good trip.', cid)
		else
			talkState[talkUser] = 0
			selfSay('I can not teleport you. You do not have the necessary items.', cid)
		end
	elseif (msgcontains(msg, 'no') and talkState[talkUser] == 1) then
		talkState[talkUser] = 0
		selfSay('Okay, maybe another time.', cid)
	end
	
	return true
end

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




Teleporter Man.xml (data/npc):

<npc name="Teleporter Man" script="data/npc/scripts/teleporterman.lua" access="5" lookdir="1">
<health now="1000" max="1000"/>
<look type="123" head="45" body="67" legs="79" feet="10" addons="1"/>
	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. I can {teleport} you to an area." />
	</parameters>
</npc>

Editado por Suicide (veja o histórico de edições)

The corrupt fear us.

The honest support us.

The heroic join us.

Postado
  • Autor

O npc nao esta recolhendo o item que eu coloquei, que no caso foi:

 

item = {8309, 200}, -- {itemID, count}

 

tem como arruma ?


Porfavor alguem me ajuda ? precisando muito

Postado
local tab = {
	pos = {x = 123, y = 456, z = 7}, -- posição x, y, z do local a teleportar o player
	item = {5432, 1}, -- {itemID, count}
	price = 15 -- quantidade em crystal coins
}

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, 'teleport')) then
		talkState[talkUser] = 1
		selfSay('Are you sure?', cid)
		selfSay('Remember..you need '..tab.item[2]..' '..getItemNameById(tab.item[1])..' and '..tab.price..' crystal coins to be teleported.', cid)
	elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 10000)) then 
			doTeleportThing(cid, tab.pos)
		 	doPlayerRemoveItem(cid, tab.item[1], tab.item[2])
            doPlayerRemoveMoney(cid, tab.price * 10000)	
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			selfSay('Have a good trip.', cid)
		else
			talkState[talkUser] = 0
			selfSay('I can not teleport you. You do not have the required items.', cid)
		end
	elseif (msgcontains(msg, 'no') and talkState[talkUser] == 1) then
		talkState[talkUser] = 0
		selfSay('Okay, maybe another time.', cid)
	end
	
	return true
end

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


spacer.png

 

 

Postado
  • Autor

Tem como coloca pro NPC que fazerar o teleporte ser uma estatua ?

- Ex: O Oraculo do global que te leva pra area de escolha das vocations !

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