Bem eu nao sabia se era pra viajar e tirar o item ou se era pra viajar so se voce tivesse o item mas nao removesse, caso nao seja isso que voce queira me fale que eu tiro.
Va em npc/scripts e crie um arquivo itemtravel.lua e bote isto dentro:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local pos = {x=152,y=58,z=7} -------------- Pos para onde o player sera levado
local itemid = 2468 ----------------- Id do item que vai ser removido do player
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
if msgcontains(msg, "offer") or msgcontains(msg, "help") then
selfSay("Eu posso te levar a TAL lugar por um "..getItemNameById(itemid).." item, fale {travel} se quizer viajar.", cid)
talkState[cid] = 0
elseif msgcontains(msg, 'travel') then
if doPlayerRemoveItem(cid, itemid, 1) then
selfSay("Boa viagem.", cid)
doTeleportThing(cid, pos)
else
selfSay("Voce nao tem o item nescessario.", cid)
end
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Depois crie um arquivo NOMEDONPC.lua e bote isto dentro:
<npc name="NOMEDONPC" script="data/npc/scripts/itemtravel.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="134" head="78" body="88" legs="0" feet="88" addons="3"/>
<parameters>
<parameter key="message_greet" value="Ola. Para mais informacoes de meus servicos diga {offer}." />
<parameter key="message_farewell" value="Tchau." />
<parameter key="message_walkaway" value="Tchau." />
</parameters>
</npc>
NAO SE ESQUEÇA DE CONFIGURAR O LOCAL E O ITEMID NO SCRIPT....
flw










info
Grupo: Campones
Registrado: 07/04/08
Posts: 16
Reputação: +1
Galera seguinte... eu quero o script de um npc que teleporta para algum lugar que eu escolhece só se vc tivesse x item
Espero que me ajudem =D