Vá em data/npc, crie um arquivo chamado Changer.xml, e adicione isso dentro;
<?xml version="1.0"?>
<npc name="Quest Changer" script="data/npc/scripts/qstchanger.lua" access="3" lookdir="1" autowalk="200" speed="200">
<health now="1" max="1"/>
<look type="120" head="38" body="79" legs="107" feet="114"/>
</npc>
Agora em data/npc/scripts, crie um arquivo chamado qstchanger.lua e adicione isso dentro:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
local addon_state = 0
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
local item1 = 2133 -- ID DO ITEM QUE O PLAYER VAI RECEBER
local item2 = 2134 -- ID DO ITEM QUE O PLAYER TEM Q DAR
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Olá, sou o NPC da Quest, tem o item necessário?')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') or msgcontains(msg, 'quest') then then
if doPlayerRemoveItem(cid,item2,1) == TRUE then
selfSay('Obrigado, aqui está sua recompensa!')
doPlayerAddItem(cid,item1,1)
addon_state = 0
else
selfSay('Você não tem o item necessário!')
talk_start = 0
end
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. getCreatureName(cid) .. '! Come back soon..')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end




info
Grupo: Artesão
Registrado: 28/10/12
Posts: 128
Reputação: +15
Char no Tibia: Tidifen
Bom, eu queria u npc de quest, o q ele tem q faser ? pedir o item de um player e dar outro e se o player n tiver o item ele n dar o outro item.