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

Lua Help, script error :)

SirJohnsen

New Member
Joined
Sep 26, 2009
Messages
86
Reaction score
3
I can't seem to find the error in my scripts

Code:
input:1: attempt to index global 'KeywordHandler' (a nil value)


Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local spawns, necro = {}

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, "hunting task") and talkState[talkUser] == 1) then
		necro = tasks["necromancer"]
		if (getPlayerStorageValue(cid, necro.storage) == EMPTY_STORAGE) then
			selfSay("What? Who are you to imply I need help from a worm like you? ...", cid)
			selfSay("I don't need help. But if you desperately wish to do something to earn the favour of Zathroth, feel free. Don't expect any reward though. ...", cid)
			selfSay("Do you want to help and serve Zathroth out of your own free will, without demanding payment or recognition?", cid)
			talkState[talkUser] = 13
		elseif (getPlayerStorageValue(cid, necro.storage) == necro.amount) then
			selfSay("You've slain a mere 4000 necromancers and priestesses. Still, you've shown some dedication. Maybe that means you can kill one of those so-called 'leaders' too. ...", cid)
			selfSay("Deep under Drefia, a necromancer called Necropharus is hiding in the Halls of Sacrifice. I'll place a spell on you with which you will be able to pass his weak protective gate. ...", cid)
			selfSay("Know that this will be your only chance to enter his room. If you leave it or die, you won't be able to return. We'll see if you really dare enter those halls.", cid)
		end
	elseif (msgcontains(msg, "yes") and talkState[talkUser] == 13) then
		selfSay("You do? I mean - wise decision. Let me explain. By now, Tibia has been overrun by numerous followers of different cults and beliefs. The true Necromancers died or left Tibia long ago, shortly after their battle was lost. ...", cid)
		selfSay("What is left are mainly pseudo-dark pretenders, the old wisdom and power being far beyond their grasp. They think they have the right to tap that dark power, but they don't. ...", cid)
		selfSay("I want you to eliminate them. As many as you can. Both necromancers and priestesses. And as I said, don't except a reward - this is what has to be done to cleanse Tibia of its false dark prophets.", cid)		
		setPlayerStorageValue(cid, spawns.storage, 0)
		talkState[talkUser] = nil
	end
end

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

Similar threads

Back
Top