• 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] Aruda NPC Avesta 7.6

kaspertje100

Member
Joined
May 8, 2008
Messages
236
Reaction score
7
Hi here is the error:
Lua script error: [Npc internface] data/npc/scripts/aruda.lua:oncreaturesay
data/npc/scripts/aruda.lua:12: attempt to call method 'is focused; (a nil value) stack traceback
data/npc/scripts/aruda.lua:12: in function 'callback'
data/npc/scripts/lib/npcsystem/npchandler.lua:299: in function 'oncreatureSay'
data/npc/scripts/aruda.lua:8: in function (data/npc/scripts/aruda.lua:8:)

xml code:
PHP:
<npc name="Lady Victoria" script="aruda.lua" autowalk="25" floorchange="0" access="5" level="1" maglevel="1">
	<health now="150" max="150"/>
	<look type="142" head="114" body="0" legs="95" feet="114" corpse="2212"/>
	<parameters>
		<parameter key="module_shop" value="1" />
		<parameter key="message_greet" value="Hello |PLAYERNAME|." />
	</parameters>
</npc>

rep++ if helped:)

a new aruda scripts is also rep ++!!

Yours kaspertje100


the code .lua
PHP:
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)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, 'gold') then
selfSay('I can steal your gold!".')

elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if doPlayerRemoveItem(cid,2160, 10) == TRUE then
selfSay('Thank you.')
end
else
selfSay(havent_item)
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())
 
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local Topic, Price = 0, 0

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 greetCallback(cid)
	if getPlayerSex(cid) == 0 then
		npcHandler:setMessage(MESSAGE_GREET, "Oh, hello |PLAYERNAME|, your hair looks great! Who did it for you?")
		Topic = 1
	else	
		npcHandler:setMessage(MESSAGE_GREET, "Oh, hello, handsome! It's a pleasure to meet you |PLAYERNAME|.")
		Topic = 0
	end
	Price = 0
	return true
end

function creatureSayCallback(cid, type, msg)
	if npcHandler.focus ~= cid then
		return false
	elseif Topic == 1 then
		npcHandler:say("I would never have guessed that.", cid)
		Topic = 0
		Price = 0
	elseif Topic == 2 then
		if doPlayerRemoveMoney(cid, Price) == TRUE then
			npcHandler:say("Oh, sorry, I was distracted, what did you say?", cid)
		else
			npcHandler:say("Oh, I just remember I have some work to do, sorry. Bye!", cid)
			npcHandler:releaseFocus(cid)
		end
		Topic = 0
		Price = 0
	elseif Topic == 3 and doPlayerRemoveItem(cid, 2036, 1) == TRUE then
		npcHandler:say("Take some time to talk to me!", cid)
		Topic = 0
		Price = 0
	elseif Topic == 4 and (msgcontains(msg, "spouse") or msgcontains(msg, "girlfriend")) then
		npcHandler:say("Well ... I  might have known him a little .. but there was nothing serious.", cid)
		Topic = 5
		Price = 0
	elseif Topic == 5 and msgcontains(msg, "fruit") then
		npcHandler:say("I remember that grapes were his favourites. He was almost addicted to them.", cid)
		Topic = 0
		Price = 0
	elseif msgcontains(msg, "how") and msgcontains(msg, "are") and msgcontains(msg, "you") then
		npcHandler:say("Thank you very much. How kind of you to care about me. I am fine, thank you.", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "sell") then
		npcHandler:say("Sorry, I have nothing to sell.", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "job") then
		npcHandler:say("I do some work now and then. Nothing unusual, though.", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "news") then
		npcHandler:say("You should ask Oswald about news. He loves them.", cid)
		Topic = 0
		Price = 0
	elseif msgcontains(msg, "name") then
		if getPlayerSex(cid) == 0 then
			npcHandler:say("I am Aruda.", cid)
		else
			npcHandler:say("I am a little sad, that you seem to have forgotten me, handsome. I am Aruda.", cid)
		end
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "aruda") then
		if getPlayerSex(cid) == 0 then
			npcHandler:say("Yes, that's me!", cid)
		else
			npcHandler:say("Oh, I like it, how you say my name.", cid)
		end
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "time") then
		npcHandler:say("Please don't be so rude to look for the time if you are talking to me.", cid)
		Topic = 3
	elseif msgcontains(msg, "help") then
		npcHandler:say("I am deeply sorry, I can't help you.", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "monster") or msgcontains(msg, "dungeon") then
		npcHandler:say("UH! What a terrifying topic. Please let us speak about something more pleasant, I am a weak and small woman after all.", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "sewer") then
		npcHandler:say("What gives you the impression, I am the kind of women, you find in sewers?", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "god") then
		npcHandler:say("You should ask about that in one of the temples.", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "king") then
		npcHandler:say("The king, that lives in this fascinating castle? I think he does look kind of cute in his luxurious robes, doesn't he?", cid)
		Topic = 2
		Price = 10
	elseif msgcontains(msg, "sam") then
		if getPlayerSex(cid) == 0 then
			npcHandler:say("He is soooo strong! What muscles! What a body! Did you ask him for a date?", cid)
		else
			npcHandler:say("He is soooo strong! What muscles! What a body! On the other hand, compared to you he looks quite puny.", cid)
		end
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "benjamin") then
		npcHandler:say("He is a little simple minded but always nice and well dressed.", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "gorn") then
		npcHandler:say("He should really sell some stylish gowns or something like that. We Tibians never get some clothing of the latest fashion. It's a shame.", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "quentin") then
		npcHandler:say("I don't understand this lonely monks. I love company too much to become one. He, he, he!", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "bozo") then
		npcHandler:say("Oh, isn't he funny? I could listen to him the whole day.", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "oswald") then
		npcHandler:say("As far as I know, he is working in the castle.", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "rumour") or msgcontains(msg, "rumor") or msgcontains(msg, "gossip") then
		npcHandler:say("I am a little shy and so don't hear many rumors.", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "fuck") or (msgcontains(msg, "kiss") and getPlayerSex(cid) == 1) then
		if getPlayerSex(cid) == 0 then
			npcHandler:say("Uhm, let us change the subject, please.", cid)
		else
			npcHandler:say("Oh, you little devil, stop talking like that! <blush>", cid)
		end
		Topic = 2
		Price = 20
	elseif msgcontains(msg, "weapon") then
		npcHandler:say("I know so little about weapons, so tell me something about weapons, please.", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "magic") then
		npcHandler:say("I believe that love is stronger then all magic, don't you agree?", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "thief") or msgcontains(msg, "theft") then
		npcHandler:say("Oh, sorry, I have to hurry, bye!", cid)
		Topic = 0
		Price = 0
		npcHandler:releaseFocus(cid)
	elseif msgcontains(msg, "tibia") then
		npcHandler:say("I would like to visit the beach more often, but I guess it's too dangerous.", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "castle") then
		npcHandler:say("I love this castle! It's so beautiful.", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "muriel") then
		npcHandler:say("Powerful sorcerers frighten me a little.", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "elane") then
		npcHandler:say("I personally think it's inappropriate for a woman to become a warrior, what do you think about that?", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "marvik") then
		npcHandler:say("Druids seldom visit a town, what do you know about druids?", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "gregor") then
		npcHandler:say("I like brave fighters like him.", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "noodles") then
		npcHandler:say("Oh, he is sooooo cute!", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "dog") or msgcontains(msg, "poodle") then
		npcHandler:say("I like dogs, the little ones at least. Do you like dogs, too?", cid)
		Topic = 2
		Price = 5
	elseif msgcontains(msg, "excalibug") then
		npcHandler:say("Oh, I am just a girl and know nothing about magic swords and such things.", cid)
		Topic = 2
		Price = 10
	elseif msgcontains(msg, "partos") then
		npcHandler:say("I ... don't know someone named like that.", cid)
		Topic = 4
		Price = 0
	elseif msgcontains(msg, "yenny") then
		npcHandler:say("Yenny? I know no Yenny, nor have I ever used that name! You have mistook me with someone else.", cid)
		Topic = 0
		Price = 0
		npcHandler:releaseFocus(cid)
	end
	return TRUE
end

npcHandler:setMessage(MESSAGE_WALKAWAY, "I hope to see you soon.")
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye. I really hope we'll talk again soon.")

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