@bump ajuda
NPC da um item a NPC e tem acceso pra sempre
Por Sotomayor, 30 de jun. de 2018 em Scripts
info
Grupo: Visconde
Registrado: 26/12/07
Posts: 272
Reputação: +31
Char no Tibia: [ADM]Sony

Não testei, mas creio que esteja tudo ok, para configurar só alterar a parte em negrito, escolha o numero do storage que não esteja sendo utilizado por outro sistema, o item que você quer que seja removido e a quantidade e defina a posição do local que você quer que ele seja teletransportado.
travel.xml
<npc name="Travel" script="travel.lua" walkinterval="0" floorchange="0" access="5" level="1" maglevel="1">
<health now="100" max="100"/>
<look type="24" head="57" body="59" legs="40" feet="76" addons="3"/>
<parameters>
<parameter key="message_greet" value="Ola, |PLAYERNAME|. Se tiver interesse de viajar comigo diga {travel}" />
</parameters>
</npc>
travel.lua
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)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
--CONFIG
local storage = 8000
local citypos = {x = 100, y = 100, z = 7}
local itemid = 12676
local count = 100
--CONFIG
if msgcontains(msg, 'travel') then
if(getPlayerStorageValue(cid, storage) >= 1) then
npcHandler:say("Ok, boa sorte!", cid)
doTeleportThing(cid, citypos)
elseif getPlayerStorageValue(cid, storage) < 1 and not doPlayerRemoveItem(cid, itemid, count) then
npcHandler:say("Voce precisa de ".. count .."x".. getItemNameById(itemid) .. " para ter acesso a cidade.", cid)
elseif getPlayerStorageValue(cid, storage) < 1 and doPlayerRemoveItem(cid, itemid, count) then
npcHandler:say("Agora voce podera viajar sem problemas.", cid)
setPlayerStorageValue(cid, storage, 1)
doTeleportThing(cid, citypos)
end
else
npcHandler:say("Entao vai embora e economize meu tempo.", cid)
talkState[talkUser] = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Editado Julho 26 por xSONYx



info
Grupo: Campones
Registrado: 17/06/18
Posts: 6
Reputação: 0
Editado Junho 30 por Sotomayor
pregunta nao formada bom