• 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!

Help with answer

gaku

New Member
Joined
Nov 27, 2007
Messages
33
Reaction score
0
hi guys, today I tried my npc pack on the latest tfs. Somehow my npc dont answer anymore. Can anybody give me a hint or solution please

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
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
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    if(npcHandler.focus ~= cid) then
        return false
    end

    -- use the real conversation? (true/false)
    real = false
    
    if real == true then
       


        
    else
	hasNoMsg = 'You don\'t even have that item!'
	noMsg = 'Then not.'


	combMsg = 'I might trade a demon armor for a mermaid comb.'

        

    end
        if msgcontains(msg, 'No')  then
            selfSay(noMsg)
		talk_state = 1


        elseif msgcontains(msg, 'mermaid') then
            selfSay(combMsg)
		talk_state = 2



------------------------------------------------ confirm yes ------------------------------------------------



elseif msgcontains(msg, 'yes') and talk_state == 2 then
            if getPlayerItemCount(cid,2494) >= 1 then
                if doPlayerTakeItem(cid,2494,1) == 0 then
                    selfSay('Here you are.')
                    doPlayerAddItem(cid,5945,1)
                end
            else
                selfSay(hasNoMsg)
            end
            talk_state = 0
 

 

------------------------------------------------ confirm no ------------------------------------------------
       elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
            selfSay(noMsg)
            talk_state = 0
        end







    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    return true
end

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

Would be nice, thx.
 
Moved to the correct section - Request and Support


The best way to get help is to post in the correct place :) Please keep this in mind.
 
Back
Top