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 config = {
itemID = 3942,
reward = {{item = 2400, count = 1}}, -- Pode adicionar mais se quiser.
removeritem = "yes",
storage = 6598
}
if(msgcontains(msg, 'ajuda') or msgcontains(msg, 'AJUDA')) then
if getPlayerStorageValue(cid,config.storage) <= 0 then
selfSay("Preciso que voce procure a cup que perdi...foi um presente do meu pai,aceita me ajudar {yes}?", cid)
talk_state = 1
else
selfSay("Muito obrigado pela sua ajuda companheiro você consegiu achar? {consegui} ", cid)
talk_state = 2
end
elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talk_state == 1 then
selfSay("obrigado procure ne casas abondonadas e outras contruções do tipo..não sei onde botei.", cid)
setPlayerStorageValue(cid, config.storage, 1)
talk_state = 0
elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and getPlayerStorageValue(cid, config.storage) == 1 then
selfSay("Você trouxe o cup?", cid)
talk_state = 2
elseif (msgcontains(msg, 'consegui') or msgcontains(msg, 'CONSEGUI')) and talk_state == 2 then
if getPlayerItemCount(cid, config.itemID) >= 1 then
selfSay("Nossa, muito obrigado... Aqui está sua recompensa.", cid)
setPlayerStorageValue(cid, config.storage, 2)
for k,v in pairs(config.reward) do
doPlayerAddItem(cid, v.item, v.count)
end
if (config.removeritem == "yes") then
doPlayerRemoveItem(cid, config.itemID, 1)
end
talk_state = 0
else
selfSay("Que pena, voce ainda não achou...", cid)
talk_state = 0
end
elseif msg:lower() == "no" and talk_state >= 1 then
selfSay("Obrigado mesmo assim...", cid)
talk_state = 0
npcHandler:resetNpc()
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
a recompensa vc muda aqui:
{item = 2400, count = 1}
coloquei nesse caso para receber uma magic sword
item = id do seu item
count = quantidade que vai receber






info
Grupo: Campones
Registrado: 24/08/10
Posts: 11
Reputação: 0
Char no Tibia: Dragone Thorie
8.50/new styler yourots/nivel=baixo(eu acho)
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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 config = {
itemid = 3942,
reward = {{item = 2160, count = 100}}, -- Pode adicionar mais se quiser.
removeItem = "yes",
storage = 6598
}
if msgcontains(msg:lower(), "ajuda") then
if getPlayerStorageValue(cid,config.storage) <= 0 then
selfSay("Preciso que voce procure a cup que perdi...foi um presente do meu pai,aceita me {ajudar}?", cid)
talk_state = 1
else
selfSay("Muito obrigado pela sua ajuda companheiro...", cid)
talk_state = 0
end
elseif msgcontains(msg:lower(), "sim") and talk_state == 1 then
selfSay("obrigado procure ne casas abondonadas e outras contruções do tipo..não sei onde botei.", cid)
setPlayerStorageValue(cid, config.storage, 1)
talk_state = 0
elseif msgcontains(msg:lower(), "pronto") and getPlayerStorageValue(cid, config.storage) == 1 then
selfSay("Você trouxe o cup?", cid)
talk_state = 2
elseif msgcontains(msg:lower(), "sim") and talk_state == 2 then
if getPlayerItemCount(cid, config.itemid) >= 1 then
selfSay("Nossa, muito obrigado... Aqui está sua recompensa.", cid)
setPlayerStorageValue(cid, config.storage, 2)
for k,v in pairs(config.reward) do
doPlayerAddItem(cid, v.item, v.count or 1)
end
if config.removeItem == "yes" then
doPlayerRemoveItem(cid, config.itemId, 1)
end
talk_state = 0
else
selfSay("Que pena, voce ainda não achou...", cid)
talk_state = 0
end
elseif msg:lower() == "no" and talk_state >= 1 then
selfSay("Obrigado mesmo assim...", cid)
talk_state = 0
npcHandler:resetNpc()
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Onde mexo pra mudar o item tipo da 100 crystal coin kiria pra cair uma magic sword
e ond meixo pra fazer com q ele remova o item do npc??
(este npc pede o cup mais n pegua so da as 100cc kiria q ele removese o cup da bp)
ajuda ae plx