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
local storage = 21389
if(msgcontains(msg, 'help') or msgcontains(msg, 'mission')) then
if getPlayerStorageValue(cid, storage) == -1 then
selfSay('Hello, I need a help in something, can you bring me {30 nails} and {a bat wing}?',cid)
talkState[talkUser] = 1
elseif getPlayerStorageValue(cid, storage) == 0 then
selfSay('Did you bring me the wings and nails?',cid)
talkState[talkUser] = 1
elseif getPlayerStorageValue(cid, storage) == 1 then
selfSay('I don\'t need any help by now.',cid)
end
elseif msgcontains(msg, 'yes') then
if talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, storage) == -1 then
selfSay('Ok, thanks for helping me! Tell me when you have everything.',cid)
setPlayerStorageValue(cid, storage, 0)
elseif getPlayerStorageValue(cid, storage) == 0 then
if (doPlayerRemoveItem(cid, getItemIdByName('nail'), 30) and doPlayerRemoveItem(cid, getItemIdByName('bat wing'), 1)) then
selfSay('Thanks for helping me.',cid)
doPlayerAddItem(cid, getItemIdByName('venom stone'), 1)
setPlayerStorageValue(cid, storage, 1)
else
selfSay('You don\'t have everything I need.',cid)
end
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
info
Grupo: Visconde
Registrado: 23/02/08
Posts: 273
Reputação: +101
Char no Tibia: Foxx Rookslayer

info
Grupo: Artesão
Registrado: 02/07/11
Posts: 129
Reputação: +6

vo testa aqui se funfa r++ pra tu
aonde ta venon e para eu por o id do item?
deu esse erro aqui
[25/01/2012 02:20:17] [Error - Npc interface]
[25/01/2012 02:20:17] data/npc/scripts/naturia.lua:onCreatureSay
[25/01/2012 02:20:17] Description:
[25/01/2012 02:20:17] (luaGetItemIdByName) Item not found
edit nao deu erro mas, so que o npc nao ta recolhendo os itens e tipo no meu servidor tem 2 tipos de bat wing e 2 de nail nao tem como ele recolher o item por id ao inves de nome?
e se eu quiser fazer outro npc com outras quets so que usando esse script ai o que eu tenho que mudar par afuncionar?
Editado Janeiro 25 por pocotozinho
info
Grupo: Campones
Registrado: 16/08/09
Posts: 57
Reputação: +16
Gênero: Masculino

vo testa aqui se funfa r++ pra tu
aonde ta venon e para eu por o id do item?
deu esse erro aqui
[25/01/2012 02:20:17] [Error - Npc interface]
[25/01/2012 02:20:17] data/npc/scripts/naturia.lua:onCreatureSay
[25/01/2012 02:20:17] Description:
[25/01/2012 02:20:17] (luaGetItemIdByName) Item not found
edit nao deu erro mas, so que o npc nao ta recolhendo os itens e tipo no meu servidor tem 2 tipos de bat wing e 2 de nail nao tem como ele recolher o item por id ao inves de nome?
e se eu quiser fazer outro npc com outras quets so que usando esse script ai o que eu tenho que mudar par afuncionar?
1º para recolher o item por id e so vc muda a funçao getItemIdByName por getItemNameById ,ai onde ta o nome do item se bota aid dele e ja era.
2º pra usa o mesmo script em outro quest e so muda a storage do script local storage = 21389 so troca o numero por um q o servidor nao esteja usano.
Qualquer duvida so posta....
Abraços
info
Grupo: Artesão
Registrado: 02/07/11
Posts: 129
Reputação: +6

Como fasso para colocar um nivel requerido para fazer a quets?
Editado Janeiro 28 por pocotozinho



info
Grupo: Artesão
Registrado: 02/07/11
Posts: 129
Reputação: +6
ola queria um script de um npc para poketibia assim
1 o player fala com ele
2 ele fala assim " Gostaria de 30 nail e 1 bat wing
3 ele daria para o player uma venon stone
4 o player nao poderia fazer a quets novamente