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

Need Some Help With A Skull Checking NPC

Angel Of Death

Rise Of Tibia ServerOwner
Joined
Mar 12, 2012
Messages
91
Reaction score
0
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local storage = getPlayerStorageValue(cid, 60055)
 
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
 
npcHandler:setMessage(MESSAGE_GREET, "Greetings |PLAYERNAME|.")
 
function creatureSayCallback(cid, type, msg, item, fromPosition, itemEx, toPosition, uid)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
 
 
	if(msgcontains(msg, "Join")) then
		if getPlayerSkullType(cid) =<4 then
		npcHandler:say( "Welcome", cid, 1000)
	else
		npcHandler:say( "What Are you Talking About!!!!" , cid, 1000)
	end
 
	elseif msgcontains(msg, "yes") then
		if getPlayerSkullType(cid) =<4 then
		--Do Script Functions
	else
		npcHandler:say("I Havent Said AnyThing For You To Say Yes Too!!!", cid, 1000)
	end	
	return true
end
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
it doesnt work
the npc doesnt respond at all you say hi and he keeps walking around

some where in here i screwed up
Lua:
	if(msgcontains(msg, "Join")) then
		if getPlayerSkullType(cid) =<4 then
		npcHandler:say( "Welcome", cid, 1000)
	else
		npcHandler:say( "What Are you Talking About!!!!" , cid, 1000)
	end
 
	elseif msgcontains(msg, "yes") then
		if getPlayerSkullType(cid) =<4 then
		--Do Script Functions
	else
		npcHandler:say("I Havent Said AnyThing For You To Say Yes Too!!!", cid, 1000)
	end	
	return true
end
end

Lua:
[Error - Npc interface]
data/npc/scripts/Dark BrotherHood.lua:onCreatureSay
Description:
data/npc/scripts/Dark BrotherHood.lua:17: attempt to call method 'getPlayerSkull
' (a nil value)
stack traceback:
        data/npc/scripts/Dark BrotherHood.lua:17: in function 'getPlayerSkull'
        data/npc/scripts/Dark BrotherHood.lua:32: in function 'callback'
        data/npc/lib/npcsystem/npchandler.lua:383: in function 'onCreatureSay'
        data/npc/scripts/Dark BrotherHood.lua:14: in function <data/npc/scripts/
Dark BrotherHood.lua:13>
 
Last edited:
Lua:
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 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, "Join")) then
		if getCreatureSkullType(cid) <= 4 then
			npcHandler:say("Welcome", cid, 1000)
		else
			npcHandler:say("What Are you Talking About!!!!", cid, 1000)
		end
 
	elseif msgcontains(msg, "yes") then
		if getCreatureSkullType(cid) <= 4 then
			npcHandler:say("or no", cid, 1000)
		else
			npcHandler:say("I Havent Said AnyThing For You To Say Yes Too!!!", cid, 1000)
		end

	end
	return true
end

npcHandler:setMessage(MESSAGE_GREET, "Greetings |PLAYERNAME|.")

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