Postado Novembro 17, 2014 10 anos 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 :/
Postado Novembro 17, 2014 10 anos 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 Novembro 18, 2014 10 anos por Suicide (veja o histórico de edições) The corrupt fear us. The honest support us. The heroic join us.
Postado Novembro 18, 2014 10 anos 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 Novembro 18, 2014 10 anos 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())
Postado Novembro 18, 2014 10 anos 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.