• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

NPC Problem. rep+

calveron

Bravemansworld
Joined
Feb 5, 2008
Messages
165
Reaction score
13
Location
Sweden
I had no problems with this npc, but then I changed map.. Now the npc wont respond to the words. Whats the problem? sorry if its messy.



Code:
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 say(param)
            npcHandler:say(param.text,param.cid)
         end
    function delayedSay(text, delay, cid)
    if(not npcHandler:isFocused(cid)) then
                return FALSE
     else
         local param = {cid = cid, text = text}
            local delay = delay or 0
            local cid = cid or 0
            local nid = getNpcCid()
            addEvent(say, delay, param)


        end
    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 quest = 76669
local reward = 90000
local TALKDELAY_ONTHINK = 1
if msgcontains(msg, 'mission') then
    delayedSay("Great, a valentuer. I need you to slay 200 dragons for me. And then, we might be able to take out those dragon lords. Well, can you slay 200 dragons for me?", 100, cid) 
    talkState[talkUser] = 2
elseif(getPlayerStorageValue(cid, quest) == 2) then
    delayedSay("Please come back for a reward.", 10, cid)
    
    elseif(getPlayerStorageValue(cid, quest) == 3) then --pirates
    delayedSay("200 dragons, allready? You're a true dragon slayer. Here's your reward as I promised.", 100, cid)
		doPlayerAddItem(cid,5877,100)
		doPlayerAddItem(cid,2160,1)
        	doPlayerAddExp(cid, 1000000)
		if getPlayerSex(cid) == 0 then
		doPlayerAddOutfit(cid, 142, 2)
	else
		doPlayerAddOutfit(cid, 134, 2)
		doPlayerSendTextMessage(cid,22,"You have been rewarded with the warrior addon!")
        	setPlayerStorageValue(cid, quest, 4)
end
        	   
    
elseif(getPlayerStorageValue(cid, quest) == 4) then
    delayedSay("You have done enough for me I will soon plan our attack!", 100, cid)

elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
    delayedSay("Great! I'll reward you greatly {ok}?.", 100, cid)
    talkState[talkUser]= 3
    elseif msgcontains(msg, 'ok') and talkState[talkUser] == 3 then
    delayedSay("Okay, Hurry up!", 100, cid)
    setPlayerStorageValue(cid, quest, 2)

end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top