• 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 please :P

furstwin

New Member
Joined
Aug 9, 2007
Messages
486
Reaction score
1
Location
Sweden
Hi.

I am going to make a djinn npc but it doesnt work...

heres the script:
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

            if msgcontains(msg, 'mission') or msgcontains(msg, 'quest') or msgcontains(msg, 'passage') then
            selfSay('Do you want to face the djinns?')
            talk_state = 1
        

        elseif msgcontains(msg, 'yes') and talk_state == 1 then
                  setPlayerStorageValue(cid,968277,1)
                selfSay('You have joined the djinns.')
                end
            end
          

------------------------------------------------ 
        if msgcontains(msg, 'piano') then 
                   queststatus = getPlayerStorageValue(cid,968278)
                   if queststatus == 1 then
                    selfSay('Did you play the piano?') 
                    talk_state = 2 
                else 
                    selfSay('You have to play the piano first.') 
                    talk_state = 0 
                end 
            end 

        if msgcontains(msg, 'yes') and talk_state == 2 then 
            talk_state = 0 
                selfSay('Congratulations! You have done the test!')
                        setPlayerStorageValue(cid,968279,1) 
                    end 
          

        if msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
            selfSay('Shaki.')
            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())

and here's the error:
Code:
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/templepriest.lua
data/npc/scripts/templepriest.lua:55: '<eof>' expected near 'end'

please help me:thumbup:

Sincerly,
Furstwin.
 
elseif msgcontains(msg, 'yes') and talk_state == 1 then
setPlayerStorageValue(cid,968277,1)
selfSay('You have joined the djinns.')
end
end

why 2 ends?
 
You mean adding random ends in your script won't do a thing?

Sincerely,
Scriptha

Almost :p

But the error isnt the 'end's the error is:
Code:
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Sincerly,
Furstwin.
 
Last edited:
Back
Top