--------------------------------
------- NPC MISION 1.0 --------
------ by Aveo - Otland.net ----
--------------------------------
--------------
--- Config ---
--------------
-- item required to make the quest
local i_required = 2695
-- count of item required to make the quest
local i_required_count = 50
-- reward item id default (crystal coins)
local i_reward = 2160
-- count of reward id default (10)
local i_reward_count = 10
-- storage dont touch --
local storage = 60307
-- name of the new quest --
local questname = "aveo quest"
-- NPC Messages --
local npc_message ={
"I need some item to complete this mission, procced?",
"You dont have any items to this mission.",
"Thank You for Help me, {take it.}",
"You have Already done this {mission}.",
"This Mission is, really serius, i need your help to complete it, if you help me i can give some items to you?"
}
-------------------
--- End Confing ---
-------------------
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
if(msgcontains(msg, 'eggs')) then
selfSay(npc_message[5], cid)
end
if(msgcontains(msg, questname)) then
selfSay(npc_message[1], cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,storage) > 0) then
selfSay(npc_message[4], cid)
else
if(doPlayerRemoveItem(cid,i_required,i_required_count)) then
setPlayerStorageValue(cid,storage,1)
doPlayerAddItem(cid,i_reward,i_reward_count)
selfSay(npc_message[3], cid)
doSendMagicEffect(getCreaturePosition(cid), 10)
doCreatureSay(cid, "Quest Completed!", TALKTYPE_ORANGE_1)
else
selfSay(npc_message[2], cid)
end
end
return true
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())