Matheus Vieira
Member
- Joined
- Apr 11, 2015
- Messages
- 102
- Reaction score
- 6
0.4
Hello my dudes, i am here to ask for a help. I got a NPC script that reward a player when the task is finished. What I'd like is: When a Druid talk to the following NPC and finish the task, he would get a SnakeBite Rod, and if were a Sorcerer, he would get a "Wand of Vortex". Here is my NPC:
Hello my dudes, i am here to ask for a help. I got a NPC script that reward a player when the task is finished. What I'd like is: When a Druid talk to the following NPC and finish the task, he would get a SnakeBite Rod, and if were a Sorcerer, he would get a "Wand of Vortex". Here is my NPC:
C++:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local quest = 22542
local reward = 70000
local markTable = {
-- {markPos =
{markPos = {x = , y = , z = }, markType = MAPMARK_SWORD, markDescription = ""}
}
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 func_addMark = doPlayerAddMapMark
if(not func_addMark) then
func_addMark = doAddMapMark
end
if(msgcontains(msg, "")) then
for mark, x in pairs(markTable) do
func_addMark(cid, x.markPos, x.markType, x.markDescription ~= nil and x.markDescription or "")
end
selfSay("", cid)
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(not npcHandler:isFocused(cid)) then
return false
elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
npcHandler:say("", cid)
talkState[talkUser] = 2
elseif msgcontains(msg, "yes") and talkState[talkUser] == 2 then
npcHandler:say("", cid)
setPlayerStorageValue(cid, quest, 2)
talkState[talkUser] = 0
elseif msgcontains(msg, "") then
local str = getPlayerStorageValue(cid, quest)
if(str < 2) then
npcHandler:say("", cid)
talkState[talkUser] = 1
return true
elseif(str == 2) then
npcHandler:say("", cid)
elseif(str == 3) then
npcHandler:say("", cid)
doPlayerAddExp(cid, 10000)
doPlayerAddItem(cid,2182,1)
doPlayerAddItem(cid,8820,1)
setPlayerStorageValue(cid, quest, 4)
elseif(str == 4) then
npcHandler:say("", cid)
end
talkState[talkUser] = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())