Vê se deu ai ![]()
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 playerHaveItems(cid, itemid) -- by MatheusMkalo
local items = type(itemid) == "table" and itemid or {itemid}
for i = 1, #items do
if getPlayerItemCount(cid, items[i]) <= 0 then
return false
end
end
return true
end
function doPlayerRemoveItems(cid, itemid, count) -- by MatheusMkalo
local items = type(itemid) == "table" and itemid or {itemid}
for i = 1, #items do
doPlayerRemoveItem(cid, items[i], count ~= nil and count or 1)
end
return nil
end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, "entregar") then
if playerHaveItems(cid, {12219}, 1) then
if getPlayerStorageValue(cid,15029) == 1 then
doPlayerRemoveItems(cid, {12219}, 1)
doPlayerAddItem(cid, 2148, 100)
setPlayerStorageValue(cid,15029,1)
else
selfSay("Voce não tem 1 Chocolate Churry.")
end
else
selfSay("Voce ja completou a missao.")
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Sobre seu 2 pedido, isso ai é task
http://www.xtibia.com/forum/topic/151636-simple-task-30/






info
Grupo: Conde
Registrado: 30/04/11
Posts: 658
Reputação: +71
Gênero: Masculino
Char no Tibia: ExTibiano
Olá pessoal, gente queria pedir ajuda de alguém para por um parametro
para fazer essa missão somente 1 vez, e quando completa-se ela manda-se uma mensagem tipo: "Parabéns Você Completou Está Missão!" e se não for pedir muito queria uma missão dessa, mas de dead, tipo vc fala com npc e ele diz "Derrote X charizard, X charmelion, e X charmander. Recompensa: 162.000 pontos de experiência." Obg pessoal se alguém poder ajuda agradecerei com REP+², boa noite!
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 playerHaveItems(cid, itemid) -- by MatheusMkalo
local items = type(itemid) == "table" and itemid or {itemid}
for i = 1, #items do
if getPlayerItemCount(cid, items) <= 0 then
return false
end
end
return true
end
function doPlayerRemoveItems(cid, itemid, count) -- by MatheusMkalo
local items = type(itemid) == "table" and itemid or {itemid}
for i = 1, #items do
doPlayerRemoveItem(cid, items, count ~= nil and count or 1)
end
return nil
end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, "entregar") then
if playerHaveItems(cid, {12219}, 1) then
doPlayerRemoveItems(cid, {12219}, 1)
doPlayerAddItem(cid, 2148, 100)
else
selfSay("Voce não tem 1 Chocolate Churry.")
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())